Deduplicate a bit
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// doublethink.cleverweb.cz
|
||||
session_start();
|
||||
// inicializace
|
||||
require './imagelightnessat.func.php';
|
||||
require './linear_perspective.class.php';
|
||||
require __DIR__ . '/imagelightnessat.func.php';
|
||||
require __DIR__ . '/linear_perspective.class.php';
|
||||
$perspective = new linear_perspective();
|
||||
|
||||
// konfigurace rozměrů a pozic
|
||||
@@ -23,7 +23,7 @@ $white = imagecolorexact($matrix, 255, 255, 255);
|
||||
imagefill($matrix, 0, 0, $white);
|
||||
|
||||
// font calibri neni kvůli licenčním podmínkám připojen, použijte jakýkoliv svůj
|
||||
imagefttext($matrix, 20, 0, 2, 25, $black, './3DCaptcha.ttf', $_SESSION['captcha']);
|
||||
imagefttext($matrix, 20, 0, 2, 25, $black, __DIR__ . '/3DCaptcha.ttf', $_SESSION['captcha']);
|
||||
|
||||
// výpočet bodů ve 3d
|
||||
$point = [];
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Martin Hozik
|
||||
// 24.5.2008
|
||||
// doublethink.cleverweb.cz
|
||||
session_start();
|
||||
// inicializace
|
||||
require './imagelightnessat.func.php';
|
||||
require './linear_perspective.class.php';
|
||||
$perspective = new linear_perspective();
|
||||
|
||||
// konfigurace rozměrů a pozic
|
||||
$matrix_dim = ['x' => 80, 'y' => 30];
|
||||
$captcha_dim = ['x' => 300, 'y' => 90];
|
||||
$distance = ['x' => 1, 'y' => 1, 'z' => 1];
|
||||
$metric = ['x' => 10, 'y' => 20, 'z' => 5];
|
||||
$offset = ['x' => 0, 'y' => -60];
|
||||
|
||||
// matrice
|
||||
$matrix = imagecreatetruecolor($matrix_dim['x'], $matrix_dim['y']);
|
||||
$black = imagecolorexact($matrix, 0, 0, 0);
|
||||
$white = imagecolorexact($matrix, 255, 255, 255);
|
||||
imagefill($matrix, 0, 0, $white);
|
||||
|
||||
// font calibri neni kvůli licenčním podmínkám připojen, použijte jakýkoliv svůj
|
||||
imagefttext($matrix, 20, 0, 2, 25, $black, './3DCaptcha.ttf', $_SESSION['captcha']);
|
||||
|
||||
// výpočet bodů ve 3d
|
||||
$point = [];
|
||||
for ($x = 0; $x < $matrix_dim['x']; ++$x) {
|
||||
for ($y = 0; $y < $matrix_dim['y']; ++$y) {
|
||||
$lightness = imagelightnessat($matrix, $x, $y);
|
||||
$point[$x][$y] = $perspective->get_projection(['x' => $x * $metric['x'] + $distance['x'], 'y' => $lightness * $metric['y'] + $distance['y'], 'z' => ($matrix_dim['y'] - $y) * $metric['z'] + $distance['z']]);
|
||||
}
|
||||
}
|
||||
imagedestroy($matrix);
|
||||
|
||||
// obrázek captcha
|
||||
$captcha = imagecreatetruecolor($captcha_dim['x'], $captcha_dim['y']);
|
||||
|
||||
// antialiasing čar - pro menší zátěž lze vypnout
|
||||
//imageantialias($captcha, true);
|
||||
|
||||
$black = imagecolorexact($captcha, 255, 0, 0);
|
||||
$white = imagecolorexact($captcha, 255, 255, 255);
|
||||
imagefill($captcha, 0, 0, $white);
|
||||
|
||||
// vykreslení vrstevnic
|
||||
for ($x = 1; $x < $matrix_dim['x']; ++$x) {
|
||||
for ($y = 1; $y < $matrix_dim['y']; ++$y) {
|
||||
imageline($captcha, -$point[$x - 1][$y - 1]['x'] + $offset['x'], -$point[$x - 1][$y - 1]['y'] + $offset['y'], -$point[$x][$y]['x'] + $offset['x'], -$point[$x][$y]['y'] + $offset['y'], $black);
|
||||
}
|
||||
}
|
||||
|
||||
// výstup
|
||||
header('Content-type: image/png');
|
||||
imagepng($captcha);
|
||||
Binary file not shown.
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Computes the lightness of a pixel. Lightness is used in HSL notation, as well
|
||||
* as in various operations on images. This function returns a normalized value
|
||||
* for lightness between 0 and 1, inclusive (0.0 being black, 1.0 being white).
|
||||
*
|
||||
* double imagelightnessat(resource img, int x, int y)
|
||||
* img An open image resource to operate on (true color or palette)
|
||||
* x, y The coordinates of the pixel to work on
|
||||
*
|
||||
* by Jed Smith <?php $u = "jed"; $d = "bz"; printf("<%s@%s.%s>", $u, $u, $d) ?>
|
||||
*/
|
||||
function imagelightnessat($img, $x, $y) {
|
||||
if (!is_resource($img)) {
|
||||
trigger_error('imagelightnessat(): supplied argument is not a valid '
|
||||
. 'Image resource', E_USER_WARNING);
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
$c = @imagecolorat($img, $x, $y);
|
||||
if ($c === false) {
|
||||
return false;
|
||||
}
|
||||
if (imageistruecolor($img)) {
|
||||
$red = ($c >> 16) & 0xFF;
|
||||
$green = ($c >> 8) & 0xFF;
|
||||
$blue = $c & 0xFF;
|
||||
} else {
|
||||
$i = imagecolorsforindex($img, $c);
|
||||
$red = $i['red'];
|
||||
$green = $i['green'];
|
||||
$blue = $i['blue'];
|
||||
}
|
||||
$m = min($red, $green, $blue);
|
||||
$n = max($red, $green, $blue);
|
||||
/* Because RGB isn't normalized in GD, we divide by 510 here.
|
||||
* Lightness = (Max(RGB) + Min(RGB)) / 2
|
||||
* But that's assuming red, green, and blue are 0 through 1 inclusive.
|
||||
* Red, green, and blue are actually 0-255 (255 + 255 = 510).
|
||||
*/
|
||||
$lightness = (float) (($m + $n) / 510.0);
|
||||
|
||||
return $lightness;
|
||||
}
|
||||
@@ -21,8 +21,8 @@ function rplc($string) {
|
||||
|
||||
return str_replace(array_keys($CMS), $CMS, $string);
|
||||
}
|
||||
include 'sboard.php';
|
||||
include 'load.lib.php';
|
||||
include __DIR__ . '/../sboard.php';
|
||||
include __DIR__ . '/../load.lib.php';
|
||||
readPage($page);
|
||||
$CMS['%releasedate%'] = toDate($date);
|
||||
$CMS['%releasetime%'] = toTime($date);
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Martin Hozik
|
||||
// 24.5.2008
|
||||
// doublethink.cleverweb.cz
|
||||
|
||||
class linear_perspective {
|
||||
public $cam_location = ['x' => 10, 'y' => 0, 'z' => -240];
|
||||
public $cam_rotation = ['x' => -1, 'y' => 0, 'z' => 0];
|
||||
public $viewer_position = ['x' => 0, 'y' => -540, 'z' => -65];
|
||||
|
||||
public function get_projection(array $point) {
|
||||
$translation = [];
|
||||
$projection = [];
|
||||
|
||||
$translation['x'] = cos($this->cam_rotation['y']) * (sin($this->cam_rotation['z']) * ($point['y'] - $this->cam_location['y']) + cos($this->cam_rotation['z']) * ($point['x'] - $this->cam_location['x'])) - sin($this->cam_rotation['y']) * ($point['z'] - $this->cam_location['z']);
|
||||
$translation['y'] = sin($this->cam_rotation['x']) * (cos($this->cam_rotation['y']) * ($point['z'] - $this->cam_location['z']) + sin($this->cam_rotation['y']) * (sin($this->cam_rotation['z']) * ($point['y'] - $this->cam_location['y']) + cos($this->cam_rotation['z']) * ($point['x'] - $this->cam_location['x']))) + cos($this->cam_rotation['z']) * (cos($this->cam_rotation['z']) * ($point['y'] - $this->cam_location['y']) - sin($this->cam_rotation['z']) * ($point['x'] - $this->cam_location['x']));
|
||||
$translation['z'] = cos($this->cam_rotation['x']) * (cos($this->cam_rotation['y']) * ($point['z'] - $this->cam_location['z']) + sin($this->cam_rotation['y']) * (sin($this->cam_rotation['z']) * ($point['y'] - $this->cam_location['y']) + cos($this->cam_rotation['z']) * ($point['x'] - $this->cam_location['x']))) - sin($this->cam_rotation['z']) * (cos($this->cam_rotation['z']) * ($point['y'] - $this->cam_location['y']) - sin($this->cam_rotation['z']) * ($point['x'] - $this->cam_location['x']));
|
||||
|
||||
$projection['x'] = ($translation['x'] - $this->viewer_position['x']) * ($this->viewer_position['z'] / $translation['z']);
|
||||
$projection['y'] = ($translation['y'] - $this->viewer_position['y']) * ($this->viewer_position['z'] / $translation['z']);
|
||||
|
||||
return $projection;
|
||||
}
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
<?php
|
||||
|
||||
if ($included == true) {
|
||||
// boolean readPage(string $page)
|
||||
function readPage($page) {//main function
|
||||
global $lang,$realPageType,$menuUrl,$article,$title,$author,$date,$time,$menu,$mainMail,$langPanel,$notreleased, $eu;
|
||||
if (empty($page)) {//page specification
|
||||
$realPage = 'pages/' . $lang . '/main.pg';
|
||||
} else {
|
||||
if (file_exists('pages/' . $lang . '/' . $page . '.pg')) {
|
||||
$realPage = 'pages/' . $lang . '/' . $page . '.pg';
|
||||
} else {
|
||||
$realPage = 'pages/' . $lang . '/error/404.pg';
|
||||
$log404 = fopen('404.log', 'a+');
|
||||
if (!ereg($page . "\n", file_get_contents('404.log'))) {
|
||||
fwrite($log404, $page . "\n");
|
||||
mail($mainMail, "Stranka nenalezena http://skirogaining.tojnar.cz/$page", rplc('Prichozi z: %comefrom%'));
|
||||
}
|
||||
fclose($log404);
|
||||
}
|
||||
}
|
||||
//end of page specification
|
||||
$errPageStart = 'pages/' . $lang . '/error/';
|
||||
if (substr($realPage, 0, strlen($errPageStart)) == $errPageStart) {//page type setting
|
||||
$realPageType = 2;
|
||||
} elseif ($realPage == 'pages/' . $lang . '/main.pg') {
|
||||
$realPageType = 1;
|
||||
} else {
|
||||
$realPageType = 0;
|
||||
}
|
||||
//end of page type setting
|
||||
|
||||
$fileContent = rplc(file_get_contents($realPage));
|
||||
//echo($fileContent);
|
||||
$fileContent = ereg_replace('<a([^>]*)hs="([1-9][0-9]?)"([^>]*)>', '<a\\1onclick="return hs.expand(this,{slideshowGroup:\\2})"\\3>', $fileContent);
|
||||
$sbContent = rplc(sboard_generate($realPage));
|
||||
$fileContent = str_replace('<board>', $sbContent, $fileContent);
|
||||
|
||||
ereg("<article>(.*)<\/article>", $fileContent, $article); //article body
|
||||
$article = trim($article[1]);
|
||||
|
||||
ereg("<title>(.*)<\/title>", $fileContent, $title); //article title
|
||||
$title = trim($title[1]);
|
||||
|
||||
ereg("<date>(.*)<\/date>", $fileContent, $date); //article title
|
||||
$date = trim($date[1]);
|
||||
|
||||
ereg("<author>(.*)<\/author>", $fileContent, $author); //article title
|
||||
$author = trim($author[1]);
|
||||
|
||||
$languages = ['cs', 'en', 'de'];
|
||||
|
||||
ereg('<alias([^>]*)cs="([^"]*)"([^>]*)>', $fileContent, $cs); //article czech version link
|
||||
$aliases['cs'] = trim($cs[2]);
|
||||
|
||||
ereg('<alias([^>]*)en="([^"]*)"([^>]*)>', $fileContent, $en); //article english version link
|
||||
$aliases['en'] = trim($en[2]);
|
||||
|
||||
ereg('<alias([^>]*)de="([^"]*)"([^>]*)>', $fileContent, $de); //article german version link
|
||||
$aliases['de'] = trim($de[2]);
|
||||
|
||||
ereg('<menu url="([^"]*)">', $fileContent, $menuUrl); //article menu url
|
||||
$menuUrl = trim($menuUrl[1]);
|
||||
foreach ($languages as $language) {//language box generator
|
||||
if (!empty($aliases[$language]) and file_exists('pages/' . $language . '/' . $aliases[$language] . '.pg')) {
|
||||
$langPanel .= rplc('<a href="%root%/' . $language . '/' . ($aliases[$language] == 'main' ? '' : $aliases[$language]) . '"><img src="%root%/gpx/' . $language . 'flag.png" alt="' . $language . '"></a>');
|
||||
}
|
||||
}
|
||||
//end of language box generator
|
||||
|
||||
$author = $realPageType == 1 ? '' : rplc($author);
|
||||
/*if($realPageType==0){
|
||||
if(empty($date)){
|
||||
$date=date(rplc("%dateFormat%"),filemtime($realPage));
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (empty($menuUrl) or !file_exists($menuUrl)) {
|
||||
$menuUrl = 'main';
|
||||
}
|
||||
$menu = rplc(file_get_contents('pages/' . $lang . '/' . $menuUrl . '.mn'));
|
||||
$article = rplc($article);
|
||||
if (ereg('<goto url="([^"]+)">', $fileContent, $gotoUrl)) {
|
||||
if ($page == $gotoUrl[1]) {
|
||||
$logrecursive = fopen('syntax.log', 'a+');
|
||||
if (!ereg($realPage . "\n", file_get_contents('recursive.log'))) {
|
||||
fwrite($logrecursive, $realPage . "\n");
|
||||
mail($mainMail, "Presmerovaci smycka http://skirogaining.tojnar.cz/$realPage", 'Stranka se presmerovava sama na sebe');
|
||||
}
|
||||
fclose($logrecursive);
|
||||
readPage('error/recursive');
|
||||
} else {
|
||||
readPage($gotoUrl[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($fileContent, '<eu>') != false) {
|
||||
$eu = true;
|
||||
} else {
|
||||
$eu = false;
|
||||
}
|
||||
|
||||
if (empty($title) and empty($article)) {
|
||||
$logsyntax = fopen('syntax.log', 'a+');
|
||||
if (!ereg($realPage . "\n", file_get_contents('syntax.log'))) {
|
||||
fwrite($logsyntax, $realPage . "\n");
|
||||
mail($mainMail, "Chyba syntaxe http://skirogaining.tojnar.cz/$realPage", 'Nerozpoznan titulek a clanek');
|
||||
}
|
||||
fclose($logsyntax);
|
||||
readPage('error/syntax');
|
||||
|
||||
return false;
|
||||
} elseif (empty($title)) {
|
||||
$logsyntax = fopen('syntax.log', 'a+');
|
||||
if (!ereg($realPage . "\n", file_get_contents('syntax.log'))) {
|
||||
fwrite($logsyntax, $realPage . "\n");
|
||||
mail($mainMail, "Chyba syntaxe http://skirogaining.tojnar.cz/$realPage", 'Nerozpoznan titulek');
|
||||
}
|
||||
fclose($logsyntax);
|
||||
readPage('error/syntax');
|
||||
|
||||
return false;
|
||||
} elseif (empty($article)) {
|
||||
$logsyntax = fopen('syntax.log', 'a+');
|
||||
if (!ereg($realPage . "\n", file_get_contents('syntax.log'))) {
|
||||
fwrite($logsyntax, $realPage . "\n");
|
||||
mail($mainMail, "Chyba syntaxe http://skirogaining.tojnar.cz/$realPage", 'Nerozpoznan clanek');
|
||||
}
|
||||
fclose($logsyntax);
|
||||
readPage('error/syntax');
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// string|null author(string $author)
|
||||
function author($author) {
|
||||
global $realPageType;
|
||||
if ($realPageType == 0) {
|
||||
if (empty($author)) {
|
||||
return rplc('%unknownAuthor%');
|
||||
} else {
|
||||
return $author;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// string|null toDate(string $date)
|
||||
function toDate($dateStr) {
|
||||
if (!empty($dateStr)) {
|
||||
$dateStr = explode(' ', $dateStr);
|
||||
$dateStr = $dateStr[0];
|
||||
$dateStr = explode('-', $dateStr);
|
||||
$year = $dateStr[0];
|
||||
$month = ltrim($dateStr[1], '0');
|
||||
$day = ltrim($dateStr[2], '0');
|
||||
|
||||
return str_replace(['%y%', '%m%', '%d%'], [$year, $month, $day], rplc('%date%'));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function isReleased($dateStr) {
|
||||
$dateStr = explode(' ', $dateStr);
|
||||
$dateStr = $dateStr[0];
|
||||
$dateStr = explode('-', $dateStr);
|
||||
$year = $dateStr[0];
|
||||
$month = ltrim($dateStr[1], '0');
|
||||
$day = ltrim($dateStr[2], '0');
|
||||
$time = explode(' ', $dateStr);
|
||||
$time = explode(':', $time[1]);
|
||||
$hour = $time[0];
|
||||
$minute = $time[1];
|
||||
if (date('Y') >= $year) {
|
||||
if (date('m') >= $month) {
|
||||
if (date('d') >= $day) {
|
||||
if (date('H') >= $hour) {
|
||||
if (date('i') >= $minute) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// string|null toTime(string $date)
|
||||
function toTime($dateStr) {
|
||||
if (!empty($dateStr)) {
|
||||
$time = explode(' ', $dateStr);
|
||||
$time = $time[1];
|
||||
|
||||
return $time;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
header('Location: /en/error/403');
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
<?php
|
||||
|
||||
$sbnum = 0;
|
||||
if (0 == 9) {
|
||||
header('HTTP/1.0 303 See Other');
|
||||
}
|
||||
/** replaces bb tags on html
|
||||
* @param string $buffer text with bb codes
|
||||
*
|
||||
* @return string replaced string
|
||||
*
|
||||
* @copyright Jan Tojnar, http://jtojnar.php5.cz/
|
||||
*/
|
||||
function bb2html($buffer) {
|
||||
$buffer = ereg_replace("\[b\](.*)\[/b\]", '<span class="bold">\\1</span>', $buffer);
|
||||
$buffer = ereg_replace("\[i\](.*)\[/i\]", '<span class="italic">\\1</span>', $buffer);
|
||||
$buffer = ereg_replace("\[red\](.*)\[/red\]", '<span class="red">\\1</span>', $buffer);
|
||||
$buffer = ereg_replace("\[green\](.*)\[/green\]", '<span class="green">\\1</span>', $buffer);
|
||||
$buffer = ereg_replace("\[blue\](.*)\[/blue\]", '<span class="blue">\\1</span>', $buffer);
|
||||
$buffer = ereg_replace("\[purple\](.*)\[/purple\]", '<span class="purple">\\1</span>', $buffer);
|
||||
$buffer = ereg_replace("\[yellow\](.*)\[/yellow\]", '<span class="yellow">\\1</span>', $buffer);
|
||||
$buffer = ereg_replace('%(.*)%', '%\\1%', $buffer);
|
||||
$buffer = ereg_replace("\n", "<br>\n", $buffer);
|
||||
$buffer = ereg_replace("\r\n", "<br>\n", $buffer);
|
||||
$buffer = ereg_replace("\r", "<br>\n", $buffer);
|
||||
|
||||
return htmlspecialchars($buffer);
|
||||
}
|
||||
/** control e-mail address
|
||||
* @param string $email e-mail address
|
||||
*
|
||||
* @return bool is right address syntax
|
||||
*
|
||||
* @copyright Jakub Vrána, http://php.vrana.cz
|
||||
*/
|
||||
function check_email($email) {
|
||||
$atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]';
|
||||
$domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';
|
||||
|
||||
return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$", $email);
|
||||
}
|
||||
|
||||
/** control www address
|
||||
* @param string $url www address
|
||||
*
|
||||
* @return bool is right address syntax
|
||||
*
|
||||
* @copyright Jan Tojnar, http://jtojnar.php5.cz
|
||||
*/
|
||||
function check_url($url) {
|
||||
return eregi("^http[s]?://[-a-z0-9]*\.[-a-z0-9]+\.[a-z]+$", $url);
|
||||
}
|
||||
|
||||
/** returns text of shoutboard
|
||||
* @param string $file page filename
|
||||
*
|
||||
* @return string shoutboard html
|
||||
*
|
||||
* @copyright Jan Tojnar, http://jtojnar.php5.cz/
|
||||
*/
|
||||
function sboard_generate($file) {
|
||||
++$sbnum;
|
||||
$name = htmlspecialchars($_POST['name']);
|
||||
$www = htmlspecialchars($_POST['www']);
|
||||
$post = htmlspecialchars($_POST['post']);
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$timestamp = date(rplc('%dateFormat%'));
|
||||
$formCaptchaSum = sha1($_POST['captcha']);
|
||||
$showmail = $_POST['showmail'];
|
||||
$checkedshowmailfalse = $showmail == 'false' ? ' checked="checked"' : '';
|
||||
$checkedshowmailtrue = empty($showmail) ? ' checked="checked"' : ($showmail == 'true' ? ' checked="checked"' : '');
|
||||
if ($showmail == 'true') {
|
||||
$email = htmlspecialchars($_POST['email']);
|
||||
} else {
|
||||
$hemail = htmlspecialchars($_POST['email']);
|
||||
}
|
||||
$formCaptchaSumPre = $_POST['captchasum'];
|
||||
$captcha = mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9);
|
||||
$_SESSION['captcha'] = $captcha;
|
||||
$captchasum = sha1($captcha);
|
||||
//echo($timestamp);
|
||||
//echo($post);
|
||||
if (isset($_POST['post'])) {
|
||||
if (empty($post)) {
|
||||
$sbError .= '<p>' . '%misspost%' . "</p>\n";
|
||||
}
|
||||
if (empty($name)) {
|
||||
$sbError .= '<p>' . '%missname%' . "</p>\n";
|
||||
}
|
||||
if ($formCaptchaSumPre != $formCaptchaSum) {
|
||||
$sbError .= '<p>' . '%wrongcode%' . "</p>\n";
|
||||
}
|
||||
if (!empty($email) && !check_email($email)) {
|
||||
$sbError .= '<p>' . '%wrongmail%' . "</p>\n";
|
||||
}
|
||||
if (!empty($www) && !check_url($www)) {
|
||||
$sbError .= '<p>' . '%wrongwww%' . "</p>\n";
|
||||
}
|
||||
if (empty($sbError)) {
|
||||
$sbmail = !empty($email) ? "<span class=\"sbmail\"><span>{$email}</span></span>\n" : (!empty($hemail) ? "<hemail>{$hemail}</hemail>" : '');
|
||||
$sbwww = !empty($www) ? "<span class=\"sbwww\"><span>{$www}</span></span>\n" : '';
|
||||
$post = bb2html($post);
|
||||
$write = <<<EOT
|
||||
<div class="sbcomment">
|
||||
<div class="sbheader">
|
||||
<span class="sbname">{$name}</span>
|
||||
<span class="sbdate">{$timestamp}</span>
|
||||
<ip>{$ip}</ip>
|
||||
{$sbmail}{$sbwww}</div>
|
||||
{$post}
|
||||
</div>
|
||||
|
||||
|
||||
EOT;
|
||||
$shoutfile = fopen($file . 'c' . $sbnum, 'a+');
|
||||
chmod($file . 'c' . $sbnum, 0777);
|
||||
if (fwrite($shoutfile, $write)) {
|
||||
$sbError .= '<p>' . '%saved%' . "</p>\n";
|
||||
unset($name,$email,$www,$captcha,$post,$ip,$timestamp,$formCaptchaSum,$formCaptchaSumPre,$captchasum,$sbname,$sbdate,$sbwww,$sbmail);
|
||||
fclose($shoutfile);
|
||||
} else {
|
||||
$sbError .= '<p>' . '%notsaved%' . "</p>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (file_exists($file . 'c' . $sbnum)) {
|
||||
$comments = ereg_replace('<ip>([^<]+)</ip>', '', ereg_replace('<hemail>([^<]+)</hemail>', '', file_get_contents($file . 'c' . $sbnum)));
|
||||
} else {
|
||||
$comments = '';
|
||||
}
|
||||
$form = $comments . "<hr class=\"sboard\" id=\"sboard{$sbnum}\">" . (empty($sbError) ? '' : '<div class="sberrors">' . rplc($sbError) . '</div>') . <<<EOT
|
||||
<form method="post" action="#sboard{$sbnum}" class="sbform">
|
||||
<div>
|
||||
<dl>
|
||||
<dt><label for="name">%name:% %req%</label></dt><dd><input type="text" name="name" id="name" value="{$name}"></dd>
|
||||
<dt><label for="email">%email:%</label></dt><dd><input type="text" name="email" id="email" value="{$email}"></dd>
|
||||
<dt>%showmail%</dt><dd><label><input type="radio" name="showmail" value="true"{$checkedshowmailtrue}>%yes%</label><label><input type="radio" name="showmail" value="false"{$checkedshowmailfalse}>%no%</label></dd>
|
||||
<dt><label for="www">%www:%</label></dt><dd><input type="text" name="www" id="www" value="{$www}"></dd>
|
||||
<dt id="captchaLabelParent"><label for="captcha"><img src="%root%/3DCaptcha.php" alt="captcha"></label></dt><dd id="captchaParent"><input type="text" name="captcha" id="captcha" size="4" maxlength="4"></dd>
|
||||
<dt><label for="post">%message:% %req%</label></dt><dd><textarea name="post" id="post" rows="5" cols="25">{$post}</textarea></dd>
|
||||
<dt><button>%send%</button></dt><dd><input type="hidden" name="captchasum" value="{$captchasum}"></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</form>
|
||||
<div class="sbhelp">
|
||||
%sbhelp%
|
||||
</div>
|
||||
EOT;
|
||||
|
||||
return $form;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ EOT;
|
||||
<dt><label for="email">%email:%</label></dt><dd><input type="text" name="email" id="email" value="{$email}"></dd>
|
||||
<dt>%showmail%</dt><dd><label><input type="radio" name="showmail" value="true"{$checkedshowmailtrue}>%yes%</label><label><input type="radio" name="showmail" value="false"{$checkedshowmailfalse}>%no%</label></dd>
|
||||
<dt><label for="www">%www:%</label></dt><dd><input type="text" name="www" id="www" value="{$www}"></dd>
|
||||
<dt id="captchaLabelParent"><label for="captcha"><img src="%root%/3DCaptcha.php" alt="captcha"></label></dt><dd id="captchaParent"><input type="text" name="captcha" id="captcha" size="4" maxlength="4"></dd>
|
||||
<dt id="captchaLabelParent"><label for="captcha"><img src="/3DCaptcha.php" alt="captcha"></label></dt><dd id="captchaParent"><input type="text" name="captcha" id="captcha" size="4" maxlength="4"></dd>
|
||||
<dt><label for="post">%message:% %req%</label></dt><dd><textarea name="post" id="post" rows="5" cols="25">{$post}</textarea></dd>
|
||||
<dt><button>%send%</button></dt><dd><input type="hidden" name="captchasum" value="{$captchasum}"></dd>
|
||||
</dl>
|
||||
|
||||
Reference in New Issue
Block a user