Format PHP code

This commit is contained in:
2022-01-13 23:09:36 +01:00
parent c56a9bf56d
commit 9a3656ef28
20 changed files with 1229 additions and 1219 deletions

View File

@@ -1,59 +1,57 @@
<?php <?php
# Martin Hozik
# 24.5.2008 // Martin Hozik
# doublethink.cleverweb.cz // 24.5.2008
// doublethink.cleverweb.cz
session_start(); session_start();
# inicializace // inicializace
require './imagelightnessat.func.php'; require './imagelightnessat.func.php';
require './linear_perspective.class.php'; require './linear_perspective.class.php';
$perspective = new linear_perspective(); $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];
# konfigurace rozměrů a pozic // matrice
$matrix_dim = array('x' => 80, 'y' => 30);
$captcha_dim = array('x' => 300, 'y' => 90);
$distance = array('x' => 1, 'y' => 1, 'z' => 1);
$metric = array('x' => 10, 'y' => 20, 'z' => 5);
$offset = array('x' => 0, 'y' => -60);
# matrice
$matrix = imagecreatetruecolor($matrix_dim['x'], $matrix_dim['y']); $matrix = imagecreatetruecolor($matrix_dim['x'], $matrix_dim['y']);
$black = imagecolorexact($matrix, 0, 0, 0); $black = imagecolorexact($matrix, 0, 0, 0);
$white = imagecolorexact($matrix, 255, 255, 255); $white = imagecolorexact($matrix, 255, 255, 255);
imagefill($matrix, 0, 0, $white); imagefill($matrix, 0, 0, $white);
# font calibri neni kvůli licenčním podmínkám připojen, použijte jakýkoliv svůj // 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, './3DCaptcha.ttf', $_SESSION['captcha']);
# výpočet bodů ve 3d // výpočet bodů ve 3d
$point = array(); $point = [];
for ($x = 0; $x < $matrix_dim['x']; $x++) { for ($x = 0; $x < $matrix_dim['x']; ++$x) {
for ($y = 0; $y < $matrix_dim['y']; $y++) { for ($y = 0; $y < $matrix_dim['y']; ++$y) {
$lightness = imagelightnessat($matrix, $x, $y); $lightness = imagelightnessat($matrix, $x, $y);
$point[$x][$y] = $perspective->get_projection(array('x' => $x * $metric['x'] + $distance['x'], 'y' => $lightness * $metric['y'] + $distance['y'], 'z' => ($matrix_dim['y'] - $y) * $metric['z'] + $distance['z'])); $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); imagedestroy($matrix);
// obrázek captcha
# obrázek captcha
$captcha = imagecreatetruecolor($captcha_dim['x'], $captcha_dim['y']); $captcha = imagecreatetruecolor($captcha_dim['x'], $captcha_dim['y']);
# antialiasing čar - pro menší zátěž lze vypnout // antialiasing čar - pro menší zátěž lze vypnout
//imageantialias($captcha, true); //imageantialias($captcha, true);
$black = imagecolorexact($captcha, 255, 0, 0); $black = imagecolorexact($captcha, 255, 0, 0);
$white = imagecolorexact($captcha, 255, 255, 255); $white = imagecolorexact($captcha, 255, 255, 255);
imagefill($captcha, 0, 0, $white); imagefill($captcha, 0, 0, $white);
# vykreslení vrstevnic // vykreslení vrstevnic
for ($x = 1; $x < $matrix_dim['x']; $x++) { for ($x = 1; $x < $matrix_dim['x']; ++$x) {
for ($y = 1; $y < $matrix_dim['y']; $y++) { 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); 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 // výstup
header('Content-type: image/png'); header('Content-type: image/png');
imagepng($captcha); imagepng($captcha);
?>

View File

@@ -1,59 +1,57 @@
<?php <?php
# Martin Hozik
# 24.5.2008 // Martin Hozik
# doublethink.cleverweb.cz // 24.5.2008
// doublethink.cleverweb.cz
session_start(); session_start();
# inicializace // inicializace
require './imagelightnessat.func.php'; require './imagelightnessat.func.php';
require './linear_perspective.class.php'; require './linear_perspective.class.php';
$perspective = new linear_perspective(); $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];
# konfigurace rozměrů a pozic // matrice
$matrix_dim = array('x' => 80, 'y' => 30);
$captcha_dim = array('x' => 300, 'y' => 90);
$distance = array('x' => 1, 'y' => 1, 'z' => 1);
$metric = array('x' => 10, 'y' => 20, 'z' => 5);
$offset = array('x' => 0, 'y' => -60);
# matrice
$matrix = imagecreatetruecolor($matrix_dim['x'], $matrix_dim['y']); $matrix = imagecreatetruecolor($matrix_dim['x'], $matrix_dim['y']);
$black = imagecolorexact($matrix, 0, 0, 0); $black = imagecolorexact($matrix, 0, 0, 0);
$white = imagecolorexact($matrix, 255, 255, 255); $white = imagecolorexact($matrix, 255, 255, 255);
imagefill($matrix, 0, 0, $white); imagefill($matrix, 0, 0, $white);
# font calibri neni kvůli licenčním podmínkám připojen, použijte jakýkoliv svůj // 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, './3DCaptcha.ttf', $_SESSION['captcha']);
# výpočet bodů ve 3d // výpočet bodů ve 3d
$point = array(); $point = [];
for ($x = 0; $x < $matrix_dim['x']; $x++) { for ($x = 0; $x < $matrix_dim['x']; ++$x) {
for ($y = 0; $y < $matrix_dim['y']; $y++) { for ($y = 0; $y < $matrix_dim['y']; ++$y) {
$lightness = imagelightnessat($matrix, $x, $y); $lightness = imagelightnessat($matrix, $x, $y);
$point[$x][$y] = $perspective->get_projection(array('x' => $x * $metric['x'] + $distance['x'], 'y' => $lightness * $metric['y'] + $distance['y'], 'z' => ($matrix_dim['y'] - $y) * $metric['z'] + $distance['z'])); $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); imagedestroy($matrix);
// obrázek captcha
# obrázek captcha
$captcha = imagecreatetruecolor($captcha_dim['x'], $captcha_dim['y']); $captcha = imagecreatetruecolor($captcha_dim['x'], $captcha_dim['y']);
# antialiasing čar - pro menší zátěž lze vypnout // antialiasing čar - pro menší zátěž lze vypnout
//imageantialias($captcha, true); //imageantialias($captcha, true);
$black = imagecolorexact($captcha, 255, 0, 0); $black = imagecolorexact($captcha, 255, 0, 0);
$white = imagecolorexact($captcha, 255, 255, 255); $white = imagecolorexact($captcha, 255, 255, 255);
imagefill($captcha, 0, 0, $white); imagefill($captcha, 0, 0, $white);
# vykreslení vrstevnic // vykreslení vrstevnic
for ($x = 1; $x < $matrix_dim['x']; $x++) { for ($x = 1; $x < $matrix_dim['x']; ++$x) {
for ($y = 1; $y < $matrix_dim['y']; $y++) { 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); 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 // výstup
header('Content-type: image/png'); header('Content-type: image/png');
imagepng($captcha); imagepng($captcha);
?>

View File

@@ -1,52 +1,53 @@
<?php <?php
if($included==true){
$CMS["%by%"]="%author% ~ %date%, %time%"; if ($included == true) {
$CMS["%january%"]="leden"; $CMS['%by%'] = '%author% ~ %date%, %time%';
$CMS["%february%"]="únor"; $CMS['%january%'] = 'leden';
$CMS["%march%"]="březen"; $CMS['%february%'] = 'únor';
$CMS["%april%"]="duben"; $CMS['%march%'] = 'březen';
$CMS["%may%"]="květen"; $CMS['%april%'] = 'duben';
$CMS["%june%"]="červen"; $CMS['%may%'] = 'květen';
$CMS["%july%"]="červenec"; $CMS['%june%'] = 'červen';
$CMS["%august%"]="srpen"; $CMS['%july%'] = 'červenec';
$CMS["%september%"]="září"; $CMS['%august%'] = 'srpen';
$CMS["%october%"]="říjen"; $CMS['%september%'] = 'září';
$CMS["%november%"]="listopad"; $CMS['%october%'] = 'říjen';
$CMS["%december%"]="prosinec"; $CMS['%november%'] = 'listopad';
$CMS["%date%"]="%d%. %m%. %y%"; $CMS['%december%'] = 'prosinec';
$CMS["%byAuthor%"]="%author%"; $CMS['%date%'] = '%d%. %m%. %y%';
$CMS["%byDate%"]="%date%, %time%"; $CMS['%byAuthor%'] = '%author%';
$CMS["%longTitle%"]="%title% - %pretitle%"; $CMS['%byDate%'] = '%date%, %time%';
$CMS["%enterpost%"]="Zadejte zprávu"; $CMS['%longTitle%'] = '%title% - %pretitle%';
$CMS["%messages:%"]="Vzkazy:"; $CMS['%enterpost%'] = 'Zadejte zprávu';
$CMS["%name:%"]="Jméno:"; $CMS['%messages:%'] = 'Vzkazy:';
$CMS["%message:%"]="Vzkaz:"; $CMS['%name:%'] = 'Jméno:';
$CMS["%password:%"]="Heslo:"; $CMS['%message:%'] = 'Vzkaz:';
$CMS["%red%"]="červená"; $CMS['%password:%'] = 'Heslo:';
$CMS["%green%"]="zelená"; $CMS['%red%'] = 'červená';
$CMS["%blue%"]="modrá"; $CMS['%green%'] = 'zelená';
$CMS["%yellow%"]="žlutá"; $CMS['%blue%'] = 'modrá';
$CMS["%purple%"]="fialová"; $CMS['%yellow%'] = 'žlutá';
$CMS["%color:%"]="Barva:"; $CMS['%purple%'] = 'fialová';
$CMS["%send%"]="Odeslat"; $CMS['%color:%'] = 'Barva:';
$CMS["%notrequiredpassword%"]="Není vyžadováno"; $CMS['%send%'] = 'Odeslat';
$CMS["%no%"]="ne"; $CMS['%notrequiredpassword%'] = 'Není vyžadováno';
$CMS["%yes%"]="ano"; $CMS['%no%'] = 'ne';
$CMS["%areyourobot%"]="Jste robot?"; $CMS['%yes%'] = 'ano';
$CMS["%www:%"]="WWW:"; $CMS['%areyourobot%'] = 'Jste robot?';
$CMS["%email:%"]="E-Mail:"; $CMS['%www:%'] = 'WWW:';
$CMS["%search%"]="Hledat"; $CMS['%email:%'] = 'E-Mail:';
$CMS["%req%"]="(vyžadováno)"; $CMS['%search%'] = 'Hledat';
$CMS["%gotop%"]="&#8593;Nahoru"; $CMS['%req%'] = '(vyžadováno)';
$CMS["%misspost%"]="Nezadali jste zprávu"; $CMS['%gotop%'] = '&#8593;Nahoru';
$CMS["%missname%"]="Nezadali jste jméno"; $CMS['%misspost%'] = 'Nezadali jste zprávu';
$CMS["%wrongcode%"]="Zadal jste špatný ověřovací kód"; $CMS['%missname%'] = 'Nezadali jste jméno';
$CMS["%wrongmail%"]="To co jste zadali není platný e-mail"; $CMS['%wrongcode%'] = 'Zadal jste špatný ověřovací kód';
$CMS["%saved%"]="Zpráva byla odeslána"; $CMS['%wrongmail%'] = 'To co jste zadali není platný e-mail';
$CMS["%notsaved%"]="Zpráva nebyla odeslána"; $CMS['%saved%'] = 'Zpráva byla odeslána';
$CMS["%showmail%"]="Zobrazovat e-mail každému"; $CMS['%notsaved%'] = 'Zpráva nebyla odeslána';
$CMS["%wrongwww%"]="To co jste zadali není platné <abbr title=\"Uniform Resource Locale\">URL</abbr>"; $CMS['%showmail%'] = 'Zobrazovat e-mail každému';
$CMS["%sbhelp%"]=<<<EOT $CMS['%wrongwww%'] = 'To co jste zadali není platné <abbr title="Uniform Resource Locale">URL</abbr>';
$CMS['%sbhelp%'] = <<<EOT
<h3>Nápověda</h3> <h3>Nápověda</h3>
<dl> <dl>
<dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>není podporováno</dd> <dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>není podporováno</dd>
@@ -59,10 +60,9 @@ $CMS["%sbhelp%"]=<<<EOT
<dt>[yellow]žluté písmo[/yellow]</dt><dd><span class="yellow">žluté písmo</span></dd> <dt>[yellow]žluté písmo[/yellow]</dt><dd><span class="yellow">žluté písmo</span></dd>
</dl> </dl>
EOT; EOT;
$CMS["%searchform%"]="006883172923970328180:3wantrdnnzy"; $CMS['%searchform%'] = '006883172923970328180:3wantrdnnzy';
$CMS["%eustring%"]="Tento projekt byl podpořen z Evropského fondu pro regionální rozvoj, fondu malých projektů Programu Cíl 3 na podporu přeshraniční spolupráce mezi Českou republikou a Svobodným státem Sasko 2007-2013."; $CMS['%eustring%'] = 'Tento projekt byl podpořen z Evropského fondu pro regionální rozvoj, fondu malých projektů Programu Cíl 3 na podporu přeshraniční spolupráce mezi Českou republikou a Svobodným státem Sasko 2007-2013.';
}else{ } else {
header("HTTP/1.0 403 Forbidden"); header('HTTP/1.0 403 Forbidden');
header("Location: /en/error/403"); header('Location: /en/error/403');
} }
?>

View File

@@ -1,52 +1,53 @@
<?php <?php
if($included==true){
$CMS["%by%"]="%author% ~ %date%, %time%"; if ($included == true) {
$CMS["%january%"]="of January"; $CMS['%by%'] = '%author% ~ %date%, %time%';
$CMS["%february%"]="of February"; $CMS['%january%'] = 'of January';
$CMS["%march%"]="of March"; $CMS['%february%'] = 'of February';
$CMS["%april%"]="of April"; $CMS['%march%'] = 'of March';
$CMS["%may%"]="of May"; $CMS['%april%'] = 'of April';
$CMS["%june%"]="of June"; $CMS['%may%'] = 'of May';
$CMS["%july%"]="of July"; $CMS['%june%'] = 'of June';
$CMS["%august%"]="of August"; $CMS['%july%'] = 'of July';
$CMS["%september%"]="of September"; $CMS['%august%'] = 'of August';
$CMS["%october%"]="of October"; $CMS['%september%'] = 'of September';
$CMS["%november%"]="of November"; $CMS['%october%'] = 'of October';
$CMS["%december%"]="of December"; $CMS['%november%'] = 'of November';
$CMS["%date%"]="%d%. %m%. %y%"; $CMS['%december%'] = 'of December';
$CMS["%byAuthor%"]="%author%"; $CMS['%date%'] = '%d%. %m%. %y%';
$CMS["%byDate%"]="%date%, %time%"; $CMS['%byAuthor%'] = '%author%';
$CMS["%longTitle%"]="%title% - %pretitle%"; $CMS['%byDate%'] = '%date%, %time%';
$CMS["%enterpost%"]="Enter message"; $CMS['%longTitle%'] = '%title% - %pretitle%';
$CMS["%messages:%"]="Messages:"; $CMS['%enterpost%'] = 'Enter message';
$CMS["%name:%"]="Name:"; $CMS['%messages:%'] = 'Messages:';
$CMS["%message:%"]="Message:"; $CMS['%name:%'] = 'Name:';
$CMS["%password:%"]="Password:"; $CMS['%message:%'] = 'Message:';
$CMS["%red%"]="red"; $CMS['%password:%'] = 'Password:';
$CMS["%green%"]="green"; $CMS['%red%'] = 'red';
$CMS["%blue%"]="blue"; $CMS['%green%'] = 'green';
$CMS["%yellow%"]="yellow"; $CMS['%blue%'] = 'blue';
$CMS["%purple%"]="purple"; $CMS['%yellow%'] = 'yellow';
$CMS["%color:%"]="Color:"; $CMS['%purple%'] = 'purple';
$CMS["%send%"]="Submit"; $CMS['%color:%'] = 'Color:';
$CMS["%notrequiredpassword%"]="Not required"; $CMS['%send%'] = 'Submit';
$CMS["%no%"]="no"; $CMS['%notrequiredpassword%'] = 'Not required';
$CMS["%yes%"]="yes"; $CMS['%no%'] = 'no';
$CMS["%areyourobot%"]="Are you robot?"; $CMS['%yes%'] = 'yes';
$CMS["%www:%"]="WWW:"; $CMS['%areyourobot%'] = 'Are you robot?';
$CMS["%email:%"]="E-Mail:"; $CMS['%www:%'] = 'WWW:';
$CMS["%search%"]="Search"; $CMS['%email:%'] = 'E-Mail:';
$CMS["%req%"]="(required)"; $CMS['%search%'] = 'Search';
$CMS["%gotop%"]="&#8593;Go top"; $CMS['%req%'] = '(required)';
$CMS["%misspost%"]="Message is missing"; $CMS['%gotop%'] = '&#8593;Go top';
$CMS["%missname%"]="Name is missing"; $CMS['%misspost%'] = 'Message is missing';
$CMS["%wrongcode%"]="You have entered wrong verification code"; $CMS['%missname%'] = 'Name is missing';
$CMS["%wrongmail%"]="You have entered wrong e-mail"; $CMS['%wrongcode%'] = 'You have entered wrong verification code';
$CMS["%saved%"]="Message have been sent"; $CMS['%wrongmail%'] = 'You have entered wrong e-mail';
$CMS["%notsaved%"]="Message have not been sent"; $CMS['%saved%'] = 'Message have been sent';
$CMS["%showmail%"]="Show e-mail to everyone"; $CMS['%notsaved%'] = 'Message have not been sent';
$CMS["%wrongwww%"]="You have entered wrong <abbr title=\"Uniform Resource Locale\">URL</abbr>"; $CMS['%showmail%'] = 'Show e-mail to everyone';
$CMS["%sbhelp%"]=<<<EOT $CMS['%wrongwww%'] = 'You have entered wrong <abbr title="Uniform Resource Locale">URL</abbr>';
$CMS['%sbhelp%'] = <<<EOT
<h3>Help</h3> <h3>Help</h3>
<dl> <dl>
<dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>not supported</dd> <dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>not supported</dd>
@@ -59,10 +60,9 @@ $CMS["%sbhelp%"]=<<<EOT
<dt>[yellow]yellow text[/yellow]</dt><dd><span class="yellow">yellow text</span></dd> <dt>[yellow]yellow text[/yellow]</dt><dd><span class="yellow">yellow text</span></dd>
</dl> </dl>
EOT; EOT;
$CMS["%searchform%"]="006883172923970328180:bfehocs55i8"; $CMS['%searchform%'] = '006883172923970328180:bfehocs55i8';
$CMS["%eustring%"]="Das Projekt wurde von dem Europäischen Fonds für Regionalentwicklung (KPF, Ziel 3 - Programm zur Förderung der grenzübergreifenden Zusammenarbeit zwischen dem Freistaat Sachsen und der Tschechischen Republik 2007-2013) unterstützt."; $CMS['%eustring%'] = 'Das Projekt wurde von dem Europäischen Fonds für Regionalentwicklung (KPF, Ziel 3 - Programm zur Förderung der grenzübergreifenden Zusammenarbeit zwischen dem Freistaat Sachsen und der Tschechischen Republik 2007-2013) unterstützt.';
}else{ } else {
header("HTTP/1.0 403 Forbidden"); header('HTTP/1.0 403 Forbidden');
header("Location: /en/error/403"); header('Location: /en/error/403');
} }
?>

View File

@@ -1,52 +1,53 @@
<?php <?php
if($included==true){
$CMS["%by%"]="%author% ~ %date%, %time%"; if ($included == true) {
$CMS["%january%"]="of January"; $CMS['%by%'] = '%author% ~ %date%, %time%';
$CMS["%february%"]="of February"; $CMS['%january%'] = 'of January';
$CMS["%march%"]="of March"; $CMS['%february%'] = 'of February';
$CMS["%april%"]="of April"; $CMS['%march%'] = 'of March';
$CMS["%may%"]="of May"; $CMS['%april%'] = 'of April';
$CMS["%june%"]="of June"; $CMS['%may%'] = 'of May';
$CMS["%july%"]="of July"; $CMS['%june%'] = 'of June';
$CMS["%august%"]="of August"; $CMS['%july%'] = 'of July';
$CMS["%september%"]="of September"; $CMS['%august%'] = 'of August';
$CMS["%october%"]="of October"; $CMS['%september%'] = 'of September';
$CMS["%november%"]="of November"; $CMS['%october%'] = 'of October';
$CMS["%december%"]="of December"; $CMS['%november%'] = 'of November';
$CMS["%date%"]="%d%. %m%. %y%"; $CMS['%december%'] = 'of December';
$CMS["%byAuthor%"]="%author%"; $CMS['%date%'] = '%d%. %m%. %y%';
$CMS["%byDate%"]="%date%, %time%"; $CMS['%byAuthor%'] = '%author%';
$CMS["%longTitle%"]="%title% - %pretitle%"; $CMS['%byDate%'] = '%date%, %time%';
$CMS["%enterpost%"]="Enter message"; $CMS['%longTitle%'] = '%title% - %pretitle%';
$CMS["%messages:%"]="Messages:"; $CMS['%enterpost%'] = 'Enter message';
$CMS["%name:%"]="Name:"; $CMS['%messages:%'] = 'Messages:';
$CMS["%message:%"]="Message:"; $CMS['%name:%'] = 'Name:';
$CMS["%password:%"]="Password:"; $CMS['%message:%'] = 'Message:';
$CMS["%red%"]="red"; $CMS['%password:%'] = 'Password:';
$CMS["%green%"]="green"; $CMS['%red%'] = 'red';
$CMS["%blue%"]="blue"; $CMS['%green%'] = 'green';
$CMS["%yellow%"]="yellow"; $CMS['%blue%'] = 'blue';
$CMS["%purple%"]="purple"; $CMS['%yellow%'] = 'yellow';
$CMS["%color:%"]="Color:"; $CMS['%purple%'] = 'purple';
$CMS["%send%"]="Submit"; $CMS['%color:%'] = 'Color:';
$CMS["%notrequiredpassword%"]="Not required"; $CMS['%send%'] = 'Submit';
$CMS["%no%"]="no"; $CMS['%notrequiredpassword%'] = 'Not required';
$CMS["%yes%"]="yes"; $CMS['%no%'] = 'no';
$CMS["%areyourobot%"]="Are you robot?"; $CMS['%yes%'] = 'yes';
$CMS["%www:%"]="WWW:"; $CMS['%areyourobot%'] = 'Are you robot?';
$CMS["%email:%"]="E-Mail:"; $CMS['%www:%'] = 'WWW:';
$CMS["%search%"]="Search"; $CMS['%email:%'] = 'E-Mail:';
$CMS["%req%"]="(required)"; $CMS['%search%'] = 'Search';
$CMS["%gotop%"]="&#8593;Go top"; $CMS['%req%'] = '(required)';
$CMS["%misspost%"]="Message is missing"; $CMS['%gotop%'] = '&#8593;Go top';
$CMS["%missname%"]="Name is missing"; $CMS['%misspost%'] = 'Message is missing';
$CMS["%wrongcode%"]="You have entered wrong verification code"; $CMS['%missname%'] = 'Name is missing';
$CMS["%wrongmail%"]="You have entered wrong e-mail"; $CMS['%wrongcode%'] = 'You have entered wrong verification code';
$CMS["%saved%"]="Message have been sent"; $CMS['%wrongmail%'] = 'You have entered wrong e-mail';
$CMS["%notsaved%"]="Message have not been sent"; $CMS['%saved%'] = 'Message have been sent';
$CMS["%showmail%"]="Show e-mail to everyone"; $CMS['%notsaved%'] = 'Message have not been sent';
$CMS["%wrongwww%"]="You have entered wrong <abbr title=\"Uniform Resource Locale\">URL</abbr>"; $CMS['%showmail%'] = 'Show e-mail to everyone';
$CMS["%sbhelp%"]=<<<EOT $CMS['%wrongwww%'] = 'You have entered wrong <abbr title="Uniform Resource Locale">URL</abbr>';
$CMS['%sbhelp%'] = <<<EOT
<h3>Help</h3> <h3>Help</h3>
<dl> <dl>
<dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>not supported</dd> <dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>not supported</dd>
@@ -59,10 +60,9 @@ $CMS["%sbhelp%"]=<<<EOT
<dt>[yellow]yellow text[/yellow]</dt><dd><span class="yellow">yellow text</span></dd> <dt>[yellow]yellow text[/yellow]</dt><dd><span class="yellow">yellow text</span></dd>
</dl> </dl>
EOT; EOT;
$CMS["%searchform%"]="006883172923970328180:bfehocs55i8"; $CMS['%searchform%'] = '006883172923970328180:bfehocs55i8';
$CMS["%eustring%"]="The project was supported from European fund of regional development, Common fund of small projects, Programme \"Cil 3\" supporting collaboration of the Czech Republic and Free State Saxony 2007-2013."; $CMS['%eustring%'] = 'The project was supported from European fund of regional development, Common fund of small projects, Programme "Cil 3" supporting collaboration of the Czech Republic and Free State Saxony 2007-2013.';
}else{ } else {
header("HTTP/1.0 403 Forbidden"); header('HTTP/1.0 403 Forbidden');
header("Location: /en/error/403"); header('Location: /en/error/403');
} }
?>

View File

@@ -9,30 +9,28 @@
* x, y The coordinates of the pixel to work on * 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) ?> * by Jed Smith <?php $u = "jed"; $d = "bz"; printf("<%s@%s.%s>", $u, $u, $d) ?>
*/ */
function imagelightnessat($img, $x, $y) function imagelightnessat($img, $x, $y) {
{ if (!is_resource($img)) {
if(!is_resource($img)) trigger_error('imagelightnessat(): supplied argument is not a valid '
{ . 'Image resource', E_USER_WARNING);
trigger_error("imagelightnessat(): supplied argument is not a valid "
. "Image resource", E_USER_WARNING);
return 0.0; return 0.0;
} }
$c = @imagecolorat($img, $x, $y); $c = @imagecolorat($img, $x, $y);
if($c === false) return false; if ($c === false) {
if(imageistruecolor($img)) return false;
{ }
if (imageistruecolor($img)) {
$red = ($c >> 16) & 0xFF; $red = ($c >> 16) & 0xFF;
$green = ($c >> 8) & 0xFF; $green = ($c >> 8) & 0xFF;
$blue = $c & 0xFF; $blue = $c & 0xFF;
} } else {
else
{
$i = imagecolorsforindex($img, $c); $i = imagecolorsforindex($img, $c);
$red = $i['red']; $red = $i['red'];
$green = $i['green']; $green = $i['green'];
$blue = $i['blue']; $blue = $i['blue'];
} }
$m = min($red, $green, $blue); $m = min($red, $green, $blue);
$n = max($red, $green, $blue); $n = max($red, $green, $blue);
/* Because RGB isn't normalized in GD, we divide by 510 here. /* Because RGB isn't normalized in GD, we divide by 510 here.
@@ -40,8 +38,7 @@ function imagelightnessat($img, $x, $y)
* But that's assuming red, green, and blue are 0 through 1 inclusive. * But that's assuming red, green, and blue are 0 through 1 inclusive.
* Red, green, and blue are actually 0-255 (255 + 255 = 510). * Red, green, and blue are actually 0-255 (255 + 255 = 510).
*/ */
$lightness = (double)(($m + $n) / 510.0); $lightness = (float) (($m + $n) / 510.0);
return($lightness);
}
?> return $lightness;
}

View File

@@ -1,67 +1,68 @@
<?php <?php
session_start(); session_start();
$included=true; $included = true;
$lang=empty($_GET["lang"])?"cs":$_GET["lang"]; $lang = empty($_GET['lang']) ? 'cs' : $_GET['lang'];
$page=htmlspecialchars($_GET["page"]); $page = htmlspecialchars($_GET['page']);
$url=$_SERVER["REQUEST_URI"]; $url = $_SERVER['REQUEST_URI'];
$root="/Skirogaining_2010"; $root = '/Skirogaining_2010';
$pretitle="1. Skirogaining 2010"; $pretitle = '1. Skirogaining 2010';
$mainMail="tojnar@gmail.com"; $mainMail = 'tojnar@gmail.com';
include($lang.".php"); include $lang . '.php';
$CMS["%url%"]="http://skirogaining.tojnar.cz".htmlspecialchars($url); $CMS['%url%'] = 'http://skirogaining.tojnar.cz' . htmlspecialchars($url);
$CMS["%root%"]=$root; $CMS['%root%'] = $root;
$CMS["%lang%"]=$lang; $CMS['%lang%'] = $lang;
$CMS["%unknownAuthor%"]="Jan Tojnar"; $CMS['%unknownAuthor%'] = 'Jan Tojnar';
$CMS["%headerLinkHref%"]=rplc("%root%/").$lang; $CMS['%headerLinkHref%'] = rplc('%root%/') . $lang;
$CMS["%pretitle%"]=$pretitle; $CMS['%pretitle%'] = $pretitle;
$CMS["%comefrom%"]=$_SERVER["HTTP_REFERER"]; $CMS['%comefrom%'] = $_SERVER['HTTP_REFERER'];
$CMS["%dateFormat%"]="d.m.Y H:i"; $CMS['%dateFormat%'] = 'd.m.Y H:i';
function rplc($string){ function rplc($string) {
global $CMS; global $CMS;
return str_replace(array_keys($CMS),$CMS,$string);
return str_replace(array_keys($CMS), $CMS, $string);
} }
include("sboard.php"); include 'sboard.php';
include("load.lib.php"); include 'load.lib.php';
readPage($page); readPage($page);
$CMS["%releasedate%"]=toDate($date); $CMS['%releasedate%'] = toDate($date);
$CMS["%releasetime%"]=toTime($date); $CMS['%releasetime%'] = toTime($date);
if(isReleased($date)==false){ if (isReleased($date) == false) {
$notreleased=true; $notreleased = true;
}else{ } else {
$notreleased=false; $notreleased = false;
} }
if($notreleased==true){ if ($notreleased == true) {
readPage("error/notreleased"); readPage('error/notreleased');
} }
$CMS["%title%"]=$title; $CMS['%title%'] = $title;
$CMS["%titleTag%"]=str_replace(array("%pretitle%","%title%"),array($pretitle,$title),rplc("%longTitle%")); $CMS['%titleTag%'] = str_replace(['%pretitle%', '%title%'], [$pretitle, $title], rplc('%longTitle%'));
$CMS["%langPanel%"]=$langPanel; $CMS['%langPanel%'] = $langPanel;
$CMS["%article%"]=$article; $CMS['%article%'] = $article;
$CMS["%menu%"]=$menu; $CMS['%menu%'] = $menu;
if(!empty($author) AND !empty($date)){ if (!empty($author) and !empty($date)) {
$aInfo=str_replace(array("%author%","%date%","%time%"),array(author($author),toDate($date),toTime($date)),rplc("%by%")); $aInfo = str_replace(['%author%', '%date%', '%time%'], [author($author), toDate($date), toTime($date)], rplc('%by%'));
}elseif(!empty($author)){ } elseif (!empty($author)) {
$aInfo=str_replace("%author%",author($author),rplc("%byAuthor%")); $aInfo = str_replace('%author%', author($author), rplc('%byAuthor%'));
}elseif(!empty($date)){ } elseif (!empty($date)) {
$aInfo=str_replace(array("%date%","%time%"),array(toDate($date),toTime($date)),rplc("%byDate%")); $aInfo = str_replace(['%date%', '%time%'], [toDate($date), toTime($date)], rplc('%byDate%'));
}else{ } else {
$aInfo=""; $aInfo = '';
} }
//var_dump(date(rplc("%dateFormat%"),filemtime($realPage))); //var_dump(date(rplc("%dateFormat%"),filemtime($realPage)));
$CMS["%author%"]=$author; $CMS['%author%'] = $author;
$CMS["%ainfo%"]=$aInfo; $CMS['%ainfo%'] = $aInfo;
if($eu==true){ if ($eu == true) {
$CMS["%eu%"]="<table class=\"table-no-border\" id=\"ziel3\"> $CMS['%eu%'] = '<table class="table-no-border" id="ziel3">
<tr><td colspan=\"2\"><h6>%eustring%</h6></td></tr> <tr><td colspan="2"><h6>%eustring%</h6></td></tr>
<tr><td><img src=\"/images/EU-Logo_rgb.jpg\" height=\"45\" width=\"361\"></td><td><img src=\"/images/ziel-small.jpg\" class=\"margin-05\"></td></tr> <tr><td><img src="/images/EU-Logo_rgb.jpg" height="45" width="361"></td><td><img src="/images/ziel-small.jpg" class="margin-05"></td></tr>
</table>"; </table>';
}else{ } else {
$CMS["%eu%"]=""; $CMS['%eu%'] = '';
} }
?> ?>
<?php <?php
ob_start(/*"ob_gzhandler"*/); ob_start(/*"ob_gzhandler"*/);
include("template.html"); include 'template.html';
$buffer=ob_get_clean(); $buffer = ob_get_clean();
echo(rplc(rplc($buffer))); echo rplc(rplc($buffer));
?> ?>

View File

@@ -1,28 +1,25 @@
<?php <?php
# Martin Hozik
# 24.5.2008
# doublethink.cleverweb.cz
// Martin Hozik
// 24.5.2008
// doublethink.cleverweb.cz
class linear_perspective { 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 $cam_location = array('x' => 10, 'y' => 0, 'z' => -240); public function get_projection(array $point) {
public $cam_rotation = array('x' => -1, 'y' => 0, 'z' => 0); $translation = [];
public $viewer_position = array('x' => 0, 'y' => -540, 'z' => -65); $projection = [];
public function get_projection(array $point) {
$translation = array(); $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']);
$projection = array(); $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']));
$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']); $projection['x'] = ($translation['x'] - $this->viewer_position['x']) * ($this->viewer_position['z'] / $translation['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'])); $projection['y'] = ($translation['y'] - $this->viewer_position['y']) * ($this->viewer_position['z'] / $translation['z']);
$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']); return $projection;
$projection['y'] = ($translation['y'] - $this->viewer_position['y']) * ($this->viewer_position['z'] / $translation['z']); }
return $projection;
}
} }
?>

View File

@@ -1,216 +1,216 @@
<?php <?php
if($included==true){
// boolean readPage(string $page) if ($included == true) {
function readPage($page){//main function // boolean readPage(string $page)
function readPage($page) {//main function
global $lang,$realPageType,$menuUrl,$article,$title,$author,$date,$time,$menu,$mainMail,$langPanel,$notreleased, $eu; global $lang,$realPageType,$menuUrl,$article,$title,$author,$date,$time,$menu,$mainMail,$langPanel,$notreleased, $eu;
if(empty($page)){//page specification if (empty($page)) {//page specification
$realPage="pages/".$lang."/main.pg"; $realPage = 'pages/' . $lang . '/main.pg';
}else{ } else {
if(file_exists("pages/".$lang."/".$page.".pg")){ if (file_exists('pages/' . $lang . '/' . $page . '.pg')) {
$realPage="pages/".$lang."/".$page.".pg"; $realPage = 'pages/' . $lang . '/' . $page . '.pg';
}else{ } else {
$realPage="pages/".$lang."/error/404.pg"; $realPage = 'pages/' . $lang . '/error/404.pg';
$log404=fopen("404.log","a+"); $log404 = fopen('404.log', 'a+');
if(!ereg($page."\n",file_get_contents("404.log"))){ if (!ereg($page . "\n", file_get_contents('404.log'))) {
fwrite($log404,$page."\n"); fwrite($log404, $page . "\n");
mail($mainMail,"Stranka nenalezena http://skirogaining.tojnar.cz/$page",rplc("Prichozi z: %comefrom%")); mail($mainMail, "Stranka nenalezena http://skirogaining.tojnar.cz/$page", rplc('Prichozi z: %comefrom%'));
} }
fclose($log404); fclose($log404);
} }
} }
//end of page specification //end of page specification
$errPageStart="pages/".$lang."/error/"; $errPageStart = 'pages/' . $lang . '/error/';
if(substr($realPage,0,strlen($errPageStart))==$errPageStart){//page type setting if (substr($realPage, 0, strlen($errPageStart)) == $errPageStart) {//page type setting
$realPageType=2; $realPageType = 2;
}elseif($realPage=="pages/".$lang."/main.pg"){ } elseif ($realPage == 'pages/' . $lang . '/main.pg') {
$realPageType=1; $realPageType = 1;
}else{ } else {
$realPageType=0; $realPageType = 0;
} }
//end of page type setting //end of page type setting
$fileContent=rplc(file_get_contents($realPage)); $fileContent = rplc(file_get_contents($realPage));
//echo($fileContent); //echo($fileContent);
$fileContent=ereg_replace("<a([^>]*)hs=\"([1-9][0-9]?)\"([^>]*)>","<a\\1onclick=\"return hs.expand(this,{slideshowGroup:\\2})\"\\3>",$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)); $sbContent = rplc(sboard_generate($realPage));
$fileContent=str_replace("<board>",$sbContent,$fileContent); $fileContent = str_replace('<board>', $sbContent, $fileContent);
ereg("<article>(.*)<\/article>",$fileContent,$article);//article body ereg("<article>(.*)<\/article>", $fileContent, $article); //article body
$article=trim($article[1]); $article = trim($article[1]);
ereg("<title>(.*)<\/title>",$fileContent,$title);//article title ereg("<title>(.*)<\/title>", $fileContent, $title); //article title
$title=trim($title[1]); $title = trim($title[1]);
ereg("<date>(.*)<\/date>",$fileContent,$date);//article title ereg("<date>(.*)<\/date>", $fileContent, $date); //article title
$date=trim($date[1]); $date = trim($date[1]);
ereg("<author>(.*)<\/author>",$fileContent,$author);//article title ereg("<author>(.*)<\/author>", $fileContent, $author); //article title
$author=trim($author[1]); $author = trim($author[1]);
$languages=array("cs","en","de"); $languages = ['cs', 'en', 'de'];
ereg("<alias([^>]*)cs=\"([^\"]*)\"([^>]*)>",$fileContent,$cs);//article czech version link ereg('<alias([^>]*)cs="([^"]*)"([^>]*)>', $fileContent, $cs); //article czech version link
$aliases["cs"]=trim($cs[2]); $aliases['cs'] = trim($cs[2]);
ereg("<alias([^>]*)en=\"([^\"]*)\"([^>]*)>",$fileContent,$en);//article english version link ereg('<alias([^>]*)en="([^"]*)"([^>]*)>', $fileContent, $en); //article english version link
$aliases["en"]=trim($en[2]); $aliases['en'] = trim($en[2]);
ereg("<alias([^>]*)de=\"([^\"]*)\"([^>]*)>",$fileContent,$de);//article german version link ereg('<alias([^>]*)de="([^"]*)"([^>]*)>', $fileContent, $de); //article german version link
$aliases["de"]=trim($de[2]); $aliases['de'] = trim($de[2]);
ereg("<menu url=\"([^\"]*)\">",$fileContent,$menuUrl);//article menu url ereg('<menu url="([^"]*)">', $fileContent, $menuUrl); //article menu url
$menuUrl=trim($menuUrl[1]); $menuUrl = trim($menuUrl[1]);
foreach($languages as $language){//language box generator foreach ($languages as $language) {//language box generator
if(!empty($aliases[$language]) AND file_exists("pages/".$language."/".$aliases[$language].".pg")){ 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>"); $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 //end of language box generator
$author=$realPageType==1?"":rplc($author); $author = $realPageType == 1 ? '' : rplc($author);
/*if($realPageType==0){ /*if($realPageType==0){
if(empty($date)){ if(empty($date)){
$date=date(rplc("%dateFormat%"),filemtime($realPage)); $date=date(rplc("%dateFormat%"),filemtime($realPage));
} }
} }
*/ */
if(empty($menuUrl) OR !file_exists($menuUrl)){ if (empty($menuUrl) or !file_exists($menuUrl)) {
$menuUrl="main"; $menuUrl = 'main';
} }
$menu=rplc(file_get_contents("pages/".$lang."/".$menuUrl.".mn")); $menu = rplc(file_get_contents('pages/' . $lang . '/' . $menuUrl . '.mn'));
$article=rplc($article); $article = rplc($article);
if(ereg("<goto url=\"([^\"]+)\">",$fileContent,$gotoUrl)){ if (ereg('<goto url="([^"]+)">', $fileContent, $gotoUrl)) {
if($page==$gotoUrl[1]){ if ($page == $gotoUrl[1]) {
$logrecursive=fopen("syntax.log","a+"); $logrecursive = fopen('syntax.log', 'a+');
if(!ereg($realPage."\n",file_get_contents("recursive.log"))){ if (!ereg($realPage . "\n", file_get_contents('recursive.log'))) {
fwrite($logrecursive,$realPage."\n"); fwrite($logrecursive, $realPage . "\n");
mail($mainMail,"Presmerovaci smycka http://skirogaining.tojnar.cz/$realPage","Stranka se presmerovava sama na sebe"); mail($mainMail, "Presmerovaci smycka http://skirogaining.tojnar.cz/$realPage", 'Stranka se presmerovava sama na sebe');
} }
fclose($logrecursive); fclose($logrecursive);
readPage("error/recursive"); readPage('error/recursive');
}else{ } else {
readPage($gotoUrl[1]); 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');
if(strpos($fileContent,"<eu>")!=false){ return str_replace(['%y%', '%m%', '%d%'], [$year, $month, $day], rplc('%date%'));
$eu=true; } else {
}else{ return null;
$eu=false; }
} }
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];
if(empty($title) AND empty($article)){ return $time;
$logsyntax=fopen("syntax.log","a+"); } else {
if(!ereg($realPage."\n",file_get_contents("syntax.log"))){ return null;
fwrite($logsyntax,$realPage."\n"); }
mail($mainMail,"Chyba syntaxe http://skirogaining.tojnar.cz/$realPage","Nerozpoznan titulek a clanek"); }
} else {
header('HTTP/1.0 403 Forbidden');
header('Location: /en/error/403');
} }
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(array("%y%","%m%","%d%"),array($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");
}
?>

View File

@@ -1,95 +1,106 @@
<?php <?php
$sbnum=0;
if(0==9){ $sbnum = 0;
header("HTTP/1.0 303 See Other"); if (0 == 9) {
header('HTTP/1.0 303 See Other');
} }
/** replaces bb tags on html /** replaces bb tags on html
* @param string $buffer text with bb codes * @param string $buffer text with bb codes
* @return string replaced string *
* @copyright Jan Tojnar, http://jtojnar.php5.cz/ * @return string replaced string
*/ *
function bb2html($buffer){ * @copyright Jan Tojnar, http://jtojnar.php5.cz/
$buffer=ereg_replace("\[b\](.*)\[/b\]","<span class=\"bold\">\\1</span>",$buffer); */
$buffer=ereg_replace("\[i\](.*)\[/i\]","<span class=\"italic\">\\1</span>",$buffer); function bb2html($buffer) {
$buffer=ereg_replace("\[red\](.*)\[/red\]","<span class=\"red\">\\1</span>",$buffer); $buffer = ereg_replace("\[b\](.*)\[/b\]", '<span class="bold">\\1</span>', $buffer);
$buffer=ereg_replace("\[green\](.*)\[/green\]","<span class=\"green\">\\1</span>",$buffer); $buffer = ereg_replace("\[i\](.*)\[/i\]", '<span class="italic">\\1</span>', $buffer);
$buffer=ereg_replace("\[blue\](.*)\[/blue\]","<span class=\"blue\">\\1</span>",$buffer); $buffer = ereg_replace("\[red\](.*)\[/red\]", '<span class="red">\\1</span>', $buffer);
$buffer=ereg_replace("\[purple\](.*)\[/purple\]","<span class=\"purple\">\\1</span>",$buffer); $buffer = ereg_replace("\[green\](.*)\[/green\]", '<span class="green">\\1</span>', $buffer);
$buffer=ereg_replace("\[yellow\](.*)\[/yellow\]","<span class=\"yellow\">\\1</span>",$buffer); $buffer = ereg_replace("\[blue\](.*)\[/blue\]", '<span class="blue">\\1</span>', $buffer);
$buffer=ereg_replace("%(.*)%","&#37;\\1&#37;",$buffer); $buffer = ereg_replace("\[purple\](.*)\[/purple\]", '<span class="purple">\\1</span>', $buffer);
$buffer=ereg_replace("\n","<br>\n",$buffer); $buffer = ereg_replace("\[yellow\](.*)\[/yellow\]", '<span class="yellow">\\1</span>', $buffer);
$buffer=ereg_replace("\r\n","<br>\n",$buffer); $buffer = ereg_replace('%(.*)%', '&#37;\\1&#37;', $buffer);
$buffer=ereg_replace("\r","<br>\n",$buffer); $buffer = ereg_replace("\n", "<br>\n", $buffer);
return htmlspecialchars($buffer); $buffer = ereg_replace("\r\n", "<br>\n", $buffer);
$buffer = ereg_replace("\r", "<br>\n", $buffer);
return htmlspecialchars($buffer);
} }
/** control e-mail address /** control e-mail address
* @param string $email e-mail address * @param string $email e-mail address
* @return bool is right address syntax *
* @copyright Jakub Vrána, http://php.vrana.cz * @return bool is right address syntax
*/ *
function check_email($email){ * @copyright Jakub Vrána, http://php.vrana.cz
$atom='[-a-z0-9!#$%&\'*+/=?^_`{|}~]'; */
$domain='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; function check_email($email) {
return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$",$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 /** control www address
* @param string $url www address * @param string $url www address
* @return bool is right address syntax *
* @copyright Jan Tojnar, http://jtojnar.php5.cz * @return bool is right address syntax
*/ *
function check_url($url){ * @copyright Jan Tojnar, http://jtojnar.php5.cz
return eregi("^http[s]?://[-a-z0-9]*\.[-a-z0-9]+\.[a-z]+$",$url); */
function check_url($url) {
return eregi("^http[s]?://[-a-z0-9]*\.[-a-z0-9]+\.[a-z]+$", $url);
} }
/** returns text of shoutboard /** returns text of shoutboard
* @param string $file page filename * @param string $file page filename
* @return string shoutboard html *
* @copyright Jan Tojnar, http://jtojnar.php5.cz/ * @return string shoutboard html
*/ *
function sboard_generate($file){ * @copyright Jan Tojnar, http://jtojnar.php5.cz/
$sbnum++; */
$name=htmlspecialchars($_POST["name"]); function sboard_generate($file) {
$www=htmlspecialchars($_POST["www"]); ++$sbnum;
$post=htmlspecialchars($_POST["post"]); $name = htmlspecialchars($_POST['name']);
$ip=$_SERVER["REMOTE_ADDR"]; $www = htmlspecialchars($_POST['www']);
$timestamp=date(rplc("%dateFormat%")); $post = htmlspecialchars($_POST['post']);
$formCaptchaSum=sha1($_POST["captcha"]); $ip = $_SERVER['REMOTE_ADDR'];
$showmail=$_POST["showmail"]; $timestamp = date(rplc('%dateFormat%'));
$checkedshowmailfalse=$showmail=="false"?" checked=\"checked\"":""; $formCaptchaSum = sha1($_POST['captcha']);
$checkedshowmailtrue=empty($showmail)?" checked=\"checked\"":($showmail=="true"?" checked=\"checked\"":""); $showmail = $_POST['showmail'];
if($showmail=="true"){ $checkedshowmailfalse = $showmail == 'false' ? ' checked="checked"' : '';
$email=htmlspecialchars($_POST["email"]); $checkedshowmailtrue = empty($showmail) ? ' checked="checked"' : ($showmail == 'true' ? ' checked="checked"' : '');
}else{ if ($showmail == 'true') {
$hemail=htmlspecialchars($_POST["email"]); $email = htmlspecialchars($_POST['email']);
} } else {
$formCaptchaSumPre=$_POST["captchasum"]; $hemail = htmlspecialchars($_POST['email']);
$captcha=mt_rand(0,9).mt_rand(0,9).mt_rand(0,9).mt_rand(0,9); }
$_SESSION["captcha"]=$captcha; $formCaptchaSumPre = $_POST['captchasum'];
$captchasum=sha1($captcha); $captcha = mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9);
#echo($timestamp); $_SESSION['captcha'] = $captcha;
#echo($post); $captchasum = sha1($captcha);
if(isset($_POST["post"])){ //echo($timestamp);
if(empty($post)){ //echo($post);
$sbError.="<p>"."%misspost%"."</p>\n"; if (isset($_POST['post'])) {
} if (empty($post)) {
if(empty($name)){ $sbError .= '<p>' . '%misspost%' . "</p>\n";
$sbError.="<p>"."%missname%"."</p>\n"; }
} if (empty($name)) {
if($formCaptchaSumPre!=$formCaptchaSum){ $sbError .= '<p>' . '%missname%' . "</p>\n";
$sbError.="<p>"."%wrongcode%"."</p>\n"; }
} if ($formCaptchaSumPre != $formCaptchaSum) {
if(!empty($email) && !check_email($email)){ $sbError .= '<p>' . '%wrongcode%' . "</p>\n";
$sbError.="<p>"."%wrongmail%"."</p>\n"; }
} if (!empty($email) && !check_email($email)) {
if(!empty($www) && !check_url($www)){ $sbError .= '<p>' . '%wrongmail%' . "</p>\n";
$sbError.="<p>"."%wrongwww%"."</p>\n"; }
} if (!empty($www) && !check_url($www)) {
if(empty($sbError)){ $sbError .= '<p>' . '%wrongwww%' . "</p>\n";
$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":""; if (empty($sbError)) {
$post=bb2html($post); $sbmail = !empty($email) ? "<span class=\"sbmail\"><span>{$email}</span></span>\n" : (!empty($hemail) ? "<hemail>{$hemail}</hemail>" : '');
$write=<<<EOT $sbwww = !empty($www) ? "<span class=\"sbwww\"><span>{$www}</span></span>\n" : '';
$post = bb2html($post);
$write = <<<EOT
<div class="sbcomment"> <div class="sbcomment">
<div class="sbheader"> <div class="sbheader">
<span class="sbname">{$name}</span> <span class="sbname">{$name}</span>
@@ -101,23 +112,23 @@ $write=<<<EOT
EOT; EOT;
$shoutfile=fopen($file."c".$sbnum,"a+"); $shoutfile = fopen($file . 'c' . $sbnum, 'a+');
chmod($file."c".$sbnum,0777); chmod($file . 'c' . $sbnum, 0777);
if(fwrite($shoutfile,$write)){ if (fwrite($shoutfile, $write)) {
$sbError.="<p>"."%saved%"."</p>\n"; $sbError .= '<p>' . '%saved%' . "</p>\n";
unset($name,$email,$www,$captcha,$post,$ip,$timestamp,$formCaptchaSum,$formCaptchaSumPre,$captchasum,$sbname,$sbdate,$sbwww,$sbmail); unset($name,$email,$www,$captcha,$post,$ip,$timestamp,$formCaptchaSum,$formCaptchaSumPre,$captchasum,$sbname,$sbdate,$sbwww,$sbmail);
fclose($shoutfile); fclose($shoutfile);
}else{ } else {
$sbError.="<p>"."%notsaved%"."</p>\n"; $sbError .= '<p>' . '%notsaved%' . "</p>\n";
} }
} }
} }
if(file_exists($file."c".$sbnum)){ if (file_exists($file . 'c' . $sbnum)) {
$comments=ereg_replace("<ip>([^<]+)</ip>","",ereg_replace("<hemail>([^<]+)</hemail>","",file_get_contents($file."c".$sbnum))); $comments = ereg_replace('<ip>([^<]+)</ip>', '', ereg_replace('<hemail>([^<]+)</hemail>', '', file_get_contents($file . 'c' . $sbnum)));
}else{ } else {
$comments=""; $comments = '';
} }
$form=$comments."<hr class=\"sboard\" id=\"sboard{$sbnum}\">".(empty($sbError)?"":"<div class=\"sberrors\">".rplc($sbError)."</div>").<<<EOT $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"> <form method="post" action="#sboard{$sbnum}" class="sbform">
<div> <div>
<dl> <dl>
@@ -135,6 +146,6 @@ $form=$comments."<hr class=\"sboard\" id=\"sboard{$sbnum}\">".(empty($sbError)?"
%sbhelp% %sbhelp%
</div> </div>
EOT; EOT;
return $form;
return $form;
} }
?>

View File

@@ -1,30 +1,31 @@
<?php <?php
header("Content-Type: text/plain; charset=utf-8");
function directoryToArray($directory,$recursive){ header('Content-Type: text/plain; charset=utf-8');
$array_items=array(); function directoryToArray($directory, $recursive) {
if($handle=opendir($directory)){ $array_items = [];
while(false!==($file=readdir($handle))){ if ($handle = opendir($directory)) {
if($file!="."&&$file!=".."){ while (false !== ($file = readdir($handle))) {
if(is_dir($directory."/".$file)){ if ($file != '.' && $file != '..') {
if($recursive){ if (is_dir($directory . '/' . $file)) {
$array_items=array_merge($array_items,directoryToArray($directory. "/".$file,$recursive)); if ($recursive) {
$array_items = array_merge($array_items, directoryToArray($directory . '/' . $file, $recursive));
}
$file = $directory . '/' . $file;
} else {
$file = $directory . '/' . $file;
$array_items[] = preg_replace("/\/\//si", '/', $file);
}
}
}
closedir($handle);
}
return $array_items;
} }
$file=$directory."/".$file; $files = directoryToArray('./pages', true);
}else{ foreach ($files as $file) {
$file=$directory."/".$file; if (substr($file, -3) == '.pg' and (substr($file, 0, 17) != './pages/cs/error/' and substr($file, 0, 17) != './pages/en/error/' and substr($file, 0, 17) != './pages/de/error/')) {
$array_items[]=preg_replace("/\/\//si","/",$file); $list .= substr($file, 0, -3) . "\n";
}
} }
} echo str_replace('./pages', 'http://' . $_SERVER['HTTP_HOST'], $list);
}
closedir($handle);
}
return $array_items;
}
$files=directoryToArray("./pages",true);
foreach($files as $file){
if(substr($file,-3)==".pg" AND (substr($file,0,17)!="./pages/cs/error/" AND substr($file,0,17)!="./pages/en/error/" AND substr($file,0,17)!="./pages/de/error/")){
$list.=substr($file,0,-3)."\n";
}
}
echo(str_replace("./pages","http://".$_SERVER["HTTP_HOST"],$list));
?>

108
cs.php
View File

@@ -1,52 +1,53 @@
<?php <?php
if($included==true){
$CMS["%by%"]="%author% ~ %date%, %time%"; if ($included == true) {
$CMS["%january%"]="leden"; $CMS['%by%'] = '%author% ~ %date%, %time%';
$CMS["%february%"]="únor"; $CMS['%january%'] = 'leden';
$CMS["%march%"]="březen"; $CMS['%february%'] = 'únor';
$CMS["%april%"]="duben"; $CMS['%march%'] = 'březen';
$CMS["%may%"]="květen"; $CMS['%april%'] = 'duben';
$CMS["%june%"]="červen"; $CMS['%may%'] = 'květen';
$CMS["%july%"]="červenec"; $CMS['%june%'] = 'červen';
$CMS["%august%"]="srpen"; $CMS['%july%'] = 'červenec';
$CMS["%september%"]="září"; $CMS['%august%'] = 'srpen';
$CMS["%october%"]="říjen"; $CMS['%september%'] = 'září';
$CMS["%november%"]="listopad"; $CMS['%october%'] = 'říjen';
$CMS["%december%"]="prosinec"; $CMS['%november%'] = 'listopad';
$CMS["%date%"]="%d%. %m%. %y%"; $CMS['%december%'] = 'prosinec';
$CMS["%byAuthor%"]="%author%"; $CMS['%date%'] = '%d%. %m%. %y%';
$CMS["%byDate%"]="%date%, %time%"; $CMS['%byAuthor%'] = '%author%';
$CMS["%longTitle%"]="%title% - %pretitle%"; $CMS['%byDate%'] = '%date%, %time%';
$CMS["%enterpost%"]="Zadejte zprávu"; $CMS['%longTitle%'] = '%title% - %pretitle%';
$CMS["%messages:%"]="Vzkazy:"; $CMS['%enterpost%'] = 'Zadejte zprávu';
$CMS["%name:%"]="Jméno:"; $CMS['%messages:%'] = 'Vzkazy:';
$CMS["%message:%"]="Vzkaz:"; $CMS['%name:%'] = 'Jméno:';
$CMS["%password:%"]="Heslo:"; $CMS['%message:%'] = 'Vzkaz:';
$CMS["%red%"]="červená"; $CMS['%password:%'] = 'Heslo:';
$CMS["%green%"]="zelená"; $CMS['%red%'] = 'červená';
$CMS["%blue%"]="modrá"; $CMS['%green%'] = 'zelená';
$CMS["%yellow%"]="žlutá"; $CMS['%blue%'] = 'modrá';
$CMS["%purple%"]="fialová"; $CMS['%yellow%'] = 'žlutá';
$CMS["%color:%"]="Barva:"; $CMS['%purple%'] = 'fialová';
$CMS["%send%"]="Odeslat"; $CMS['%color:%'] = 'Barva:';
$CMS["%notrequiredpassword%"]="Není vyžadováno"; $CMS['%send%'] = 'Odeslat';
$CMS["%no%"]="ne"; $CMS['%notrequiredpassword%'] = 'Není vyžadováno';
$CMS["%yes%"]="ano"; $CMS['%no%'] = 'ne';
$CMS["%areyourobot%"]="Jste robot?"; $CMS['%yes%'] = 'ano';
$CMS["%www:%"]="WWW:"; $CMS['%areyourobot%'] = 'Jste robot?';
$CMS["%email:%"]="E-Mail:"; $CMS['%www:%'] = 'WWW:';
$CMS["%search%"]="Hledat"; $CMS['%email:%'] = 'E-Mail:';
$CMS["%req%"]="(vyžadováno)"; $CMS['%search%'] = 'Hledat';
$CMS["%gotop%"]="&#8593;Nahoru"; $CMS['%req%'] = '(vyžadováno)';
$CMS["%misspost%"]="Nezadali jste zprávu"; $CMS['%gotop%'] = '&#8593;Nahoru';
$CMS["%missname%"]="Nezadali jste jméno"; $CMS['%misspost%'] = 'Nezadali jste zprávu';
$CMS["%wrongcode%"]="Zadal jste špatný ověřovací kód"; $CMS['%missname%'] = 'Nezadali jste jméno';
$CMS["%wrongmail%"]="To co jste zadali není platný e-mail"; $CMS['%wrongcode%'] = 'Zadal jste špatný ověřovací kód';
$CMS["%saved%"]="Zpráva byla odeslána"; $CMS['%wrongmail%'] = 'To co jste zadali není platný e-mail';
$CMS["%notsaved%"]="Zpráva nebyla odeslána"; $CMS['%saved%'] = 'Zpráva byla odeslána';
$CMS["%showmail%"]="Zobrazovat e-mail každému"; $CMS['%notsaved%'] = 'Zpráva nebyla odeslána';
$CMS["%wrongwww%"]="To co jste zadali není platné <abbr title=\"Uniform Resource Locale\">URL</abbr>"; $CMS['%showmail%'] = 'Zobrazovat e-mail každému';
$CMS["%sbhelp%"]=<<<EOT $CMS['%wrongwww%'] = 'To co jste zadali není platné <abbr title="Uniform Resource Locale">URL</abbr>';
$CMS['%sbhelp%'] = <<<EOT
<h3>Nápověda</h3> <h3>Nápověda</h3>
<dl> <dl>
<dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>není podporováno</dd> <dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>není podporováno</dd>
@@ -59,10 +60,9 @@ $CMS["%sbhelp%"]=<<<EOT
<dt>[yellow]žluté písmo[/yellow]</dt><dd><span class="yellow">žluté písmo</span></dd> <dt>[yellow]žluté písmo[/yellow]</dt><dd><span class="yellow">žluté písmo</span></dd>
</dl> </dl>
EOT; EOT;
$CMS["%searchform%"]="006883172923970328180:3wantrdnnzy"; $CMS['%searchform%'] = '006883172923970328180:3wantrdnnzy';
$CMS["%eustring%"]="Tento projekt byl podpořen z Evropského fondu pro regionální rozvoj, fondu malých projektů Programu Cíl 3 na podporu přeshraniční spolupráce mezi Českou republikou a Svobodným státem Sasko 2007-2013."; $CMS['%eustring%'] = 'Tento projekt byl podpořen z Evropského fondu pro regionální rozvoj, fondu malých projektů Programu Cíl 3 na podporu přeshraniční spolupráce mezi Českou republikou a Svobodným státem Sasko 2007-2013.';
}else{ } else {
header("HTTP/1.0 403 Forbidden"); header('HTTP/1.0 403 Forbidden');
header("Location: /en/error/403"); header('Location: /en/error/403');
} }
?>

108
de.php
View File

@@ -1,52 +1,53 @@
<?php <?php
if($included==true){
$CMS["%by%"]="%author% ~ %date%, %time%"; if ($included == true) {
$CMS["%january%"]="of January"; $CMS['%by%'] = '%author% ~ %date%, %time%';
$CMS["%february%"]="of February"; $CMS['%january%'] = 'of January';
$CMS["%march%"]="of March"; $CMS['%february%'] = 'of February';
$CMS["%april%"]="of April"; $CMS['%march%'] = 'of March';
$CMS["%may%"]="of May"; $CMS['%april%'] = 'of April';
$CMS["%june%"]="of June"; $CMS['%may%'] = 'of May';
$CMS["%july%"]="of July"; $CMS['%june%'] = 'of June';
$CMS["%august%"]="of August"; $CMS['%july%'] = 'of July';
$CMS["%september%"]="of September"; $CMS['%august%'] = 'of August';
$CMS["%october%"]="of October"; $CMS['%september%'] = 'of September';
$CMS["%november%"]="of November"; $CMS['%october%'] = 'of October';
$CMS["%december%"]="of December"; $CMS['%november%'] = 'of November';
$CMS["%date%"]="%d%. %m%. %y%"; $CMS['%december%'] = 'of December';
$CMS["%byAuthor%"]="%author%"; $CMS['%date%'] = '%d%. %m%. %y%';
$CMS["%byDate%"]="%date%, %time%"; $CMS['%byAuthor%'] = '%author%';
$CMS["%longTitle%"]="%title% - %pretitle%"; $CMS['%byDate%'] = '%date%, %time%';
$CMS["%enterpost%"]="Enter message"; $CMS['%longTitle%'] = '%title% - %pretitle%';
$CMS["%messages:%"]="Messages:"; $CMS['%enterpost%'] = 'Enter message';
$CMS["%name:%"]="Name:"; $CMS['%messages:%'] = 'Messages:';
$CMS["%message:%"]="Message:"; $CMS['%name:%'] = 'Name:';
$CMS["%password:%"]="Password:"; $CMS['%message:%'] = 'Message:';
$CMS["%red%"]="red"; $CMS['%password:%'] = 'Password:';
$CMS["%green%"]="green"; $CMS['%red%'] = 'red';
$CMS["%blue%"]="blue"; $CMS['%green%'] = 'green';
$CMS["%yellow%"]="yellow"; $CMS['%blue%'] = 'blue';
$CMS["%purple%"]="purple"; $CMS['%yellow%'] = 'yellow';
$CMS["%color:%"]="Color:"; $CMS['%purple%'] = 'purple';
$CMS["%send%"]="Submit"; $CMS['%color:%'] = 'Color:';
$CMS["%notrequiredpassword%"]="Not required"; $CMS['%send%'] = 'Submit';
$CMS["%no%"]="no"; $CMS['%notrequiredpassword%'] = 'Not required';
$CMS["%yes%"]="yes"; $CMS['%no%'] = 'no';
$CMS["%areyourobot%"]="Are you robot?"; $CMS['%yes%'] = 'yes';
$CMS["%www:%"]="WWW:"; $CMS['%areyourobot%'] = 'Are you robot?';
$CMS["%email:%"]="E-Mail:"; $CMS['%www:%'] = 'WWW:';
$CMS["%search%"]="Search"; $CMS['%email:%'] = 'E-Mail:';
$CMS["%req%"]="(required)"; $CMS['%search%'] = 'Search';
$CMS["%gotop%"]="&#8593;Go top"; $CMS['%req%'] = '(required)';
$CMS["%misspost%"]="Message is missing"; $CMS['%gotop%'] = '&#8593;Go top';
$CMS["%missname%"]="Name is missing"; $CMS['%misspost%'] = 'Message is missing';
$CMS["%wrongcode%"]="You have entered wrong verification code"; $CMS['%missname%'] = 'Name is missing';
$CMS["%wrongmail%"]="You have entered wrong e-mail"; $CMS['%wrongcode%'] = 'You have entered wrong verification code';
$CMS["%saved%"]="Message have been sent"; $CMS['%wrongmail%'] = 'You have entered wrong e-mail';
$CMS["%notsaved%"]="Message have not been sent"; $CMS['%saved%'] = 'Message have been sent';
$CMS["%showmail%"]="Show e-mail to everyone"; $CMS['%notsaved%'] = 'Message have not been sent';
$CMS["%wrongwww%"]="You have entered wrong <abbr title=\"Uniform Resource Locale\">URL</abbr>"; $CMS['%showmail%'] = 'Show e-mail to everyone';
$CMS["%sbhelp%"]=<<<EOT $CMS['%wrongwww%'] = 'You have entered wrong <abbr title="Uniform Resource Locale">URL</abbr>';
$CMS['%sbhelp%'] = <<<EOT
<h3>Help</h3> <h3>Help</h3>
<dl> <dl>
<dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>not supported</dd> <dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>not supported</dd>
@@ -59,10 +60,9 @@ $CMS["%sbhelp%"]=<<<EOT
<dt>[yellow]yellow text[/yellow]</dt><dd><span class="yellow">yellow text</span></dd> <dt>[yellow]yellow text[/yellow]</dt><dd><span class="yellow">yellow text</span></dd>
</dl> </dl>
EOT; EOT;
$CMS["%searchform%"]="006883172923970328180:bfehocs55i8"; $CMS['%searchform%'] = '006883172923970328180:bfehocs55i8';
$CMS["%eustring%"]="Das Projekt wurde von dem Europäischen Fonds für Regionalentwicklung (KPF, Ziel 3 - Programm zur Förderung der grenzübergreifenden Zusammenarbeit zwischen dem Freistaat Sachsen und der Tschechischen Republik 2007-2013) unterstützt."; $CMS['%eustring%'] = 'Das Projekt wurde von dem Europäischen Fonds für Regionalentwicklung (KPF, Ziel 3 - Programm zur Förderung der grenzübergreifenden Zusammenarbeit zwischen dem Freistaat Sachsen und der Tschechischen Republik 2007-2013) unterstützt.';
}else{ } else {
header("HTTP/1.0 403 Forbidden"); header('HTTP/1.0 403 Forbidden');
header("Location: /en/error/403"); header('Location: /en/error/403');
} }
?>

108
en.php
View File

@@ -1,52 +1,53 @@
<?php <?php
if($included==true){
$CMS["%by%"]="%author% ~ %date%, %time%"; if ($included == true) {
$CMS["%january%"]="of January"; $CMS['%by%'] = '%author% ~ %date%, %time%';
$CMS["%february%"]="of February"; $CMS['%january%'] = 'of January';
$CMS["%march%"]="of March"; $CMS['%february%'] = 'of February';
$CMS["%april%"]="of April"; $CMS['%march%'] = 'of March';
$CMS["%may%"]="of May"; $CMS['%april%'] = 'of April';
$CMS["%june%"]="of June"; $CMS['%may%'] = 'of May';
$CMS["%july%"]="of July"; $CMS['%june%'] = 'of June';
$CMS["%august%"]="of August"; $CMS['%july%'] = 'of July';
$CMS["%september%"]="of September"; $CMS['%august%'] = 'of August';
$CMS["%october%"]="of October"; $CMS['%september%'] = 'of September';
$CMS["%november%"]="of November"; $CMS['%october%'] = 'of October';
$CMS["%december%"]="of December"; $CMS['%november%'] = 'of November';
$CMS["%date%"]="%d%. %m%. %y%"; $CMS['%december%'] = 'of December';
$CMS["%byAuthor%"]="%author%"; $CMS['%date%'] = '%d%. %m%. %y%';
$CMS["%byDate%"]="%date%, %time%"; $CMS['%byAuthor%'] = '%author%';
$CMS["%longTitle%"]="%title% - %pretitle%"; $CMS['%byDate%'] = '%date%, %time%';
$CMS["%enterpost%"]="Enter message"; $CMS['%longTitle%'] = '%title% - %pretitle%';
$CMS["%messages:%"]="Messages:"; $CMS['%enterpost%'] = 'Enter message';
$CMS["%name:%"]="Name:"; $CMS['%messages:%'] = 'Messages:';
$CMS["%message:%"]="Message:"; $CMS['%name:%'] = 'Name:';
$CMS["%password:%"]="Password:"; $CMS['%message:%'] = 'Message:';
$CMS["%red%"]="red"; $CMS['%password:%'] = 'Password:';
$CMS["%green%"]="green"; $CMS['%red%'] = 'red';
$CMS["%blue%"]="blue"; $CMS['%green%'] = 'green';
$CMS["%yellow%"]="yellow"; $CMS['%blue%'] = 'blue';
$CMS["%purple%"]="purple"; $CMS['%yellow%'] = 'yellow';
$CMS["%color:%"]="Color:"; $CMS['%purple%'] = 'purple';
$CMS["%send%"]="Submit"; $CMS['%color:%'] = 'Color:';
$CMS["%notrequiredpassword%"]="Not required"; $CMS['%send%'] = 'Submit';
$CMS["%no%"]="no"; $CMS['%notrequiredpassword%'] = 'Not required';
$CMS["%yes%"]="yes"; $CMS['%no%'] = 'no';
$CMS["%areyourobot%"]="Are you robot?"; $CMS['%yes%'] = 'yes';
$CMS["%www:%"]="WWW:"; $CMS['%areyourobot%'] = 'Are you robot?';
$CMS["%email:%"]="E-Mail:"; $CMS['%www:%'] = 'WWW:';
$CMS["%search%"]="Search"; $CMS['%email:%'] = 'E-Mail:';
$CMS["%req%"]="(required)"; $CMS['%search%'] = 'Search';
$CMS["%gotop%"]="&#8593;Go top"; $CMS['%req%'] = '(required)';
$CMS["%misspost%"]="Message is missing"; $CMS['%gotop%'] = '&#8593;Go top';
$CMS["%missname%"]="Name is missing"; $CMS['%misspost%'] = 'Message is missing';
$CMS["%wrongcode%"]="You have entered wrong verification code"; $CMS['%missname%'] = 'Name is missing';
$CMS["%wrongmail%"]="You have entered wrong e-mail"; $CMS['%wrongcode%'] = 'You have entered wrong verification code';
$CMS["%saved%"]="Message have been sent"; $CMS['%wrongmail%'] = 'You have entered wrong e-mail';
$CMS["%notsaved%"]="Message have not been sent"; $CMS['%saved%'] = 'Message have been sent';
$CMS["%showmail%"]="Show e-mail to everyone"; $CMS['%notsaved%'] = 'Message have not been sent';
$CMS["%wrongwww%"]="You have entered wrong <abbr title=\"Uniform Resource Locale\">URL</abbr>"; $CMS['%showmail%'] = 'Show e-mail to everyone';
$CMS["%sbhelp%"]=<<<EOT $CMS['%wrongwww%'] = 'You have entered wrong <abbr title="Uniform Resource Locale">URL</abbr>';
$CMS['%sbhelp%'] = <<<EOT
<h3>Help</h3> <h3>Help</h3>
<dl> <dl>
<dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>not supported</dd> <dt><abbr title="HyperText Markup Language">HTML</abbr></dt><dd>not supported</dd>
@@ -59,10 +60,9 @@ $CMS["%sbhelp%"]=<<<EOT
<dt>[yellow]yellow text[/yellow]</dt><dd><span class="yellow">yellow text</span></dd> <dt>[yellow]yellow text[/yellow]</dt><dd><span class="yellow">yellow text</span></dd>
</dl> </dl>
EOT; EOT;
$CMS["%searchform%"]="006883172923970328180:bfehocs55i8"; $CMS['%searchform%'] = '006883172923970328180:bfehocs55i8';
$CMS["%eustring%"]="The project was supported from European fund of regional development, Common fund of small projects, Programme \"Cil 3\" supporting collaboration of the Czech Republic and Free State Saxony 2007-2013."; $CMS['%eustring%'] = 'The project was supported from European fund of regional development, Common fund of small projects, Programme "Cil 3" supporting collaboration of the Czech Republic and Free State Saxony 2007-2013.';
}else{ } else {
header("HTTP/1.0 403 Forbidden"); header('HTTP/1.0 403 Forbidden');
header("Location: /en/error/403"); header('Location: /en/error/403');
} }
?>

View File

@@ -9,30 +9,28 @@
* x, y The coordinates of the pixel to work on * 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) ?> * by Jed Smith <?php $u = "jed"; $d = "bz"; printf("<%s@%s.%s>", $u, $u, $d) ?>
*/ */
function imagelightnessat($img, $x, $y) function imagelightnessat($img, $x, $y) {
{ if (!is_resource($img)) {
if(!is_resource($img)) trigger_error('imagelightnessat(): supplied argument is not a valid '
{ . 'Image resource', E_USER_WARNING);
trigger_error("imagelightnessat(): supplied argument is not a valid "
. "Image resource", E_USER_WARNING);
return 0.0; return 0.0;
} }
$c = @imagecolorat($img, $x, $y); $c = @imagecolorat($img, $x, $y);
if($c === false) return false; if ($c === false) {
if(imageistruecolor($img)) return false;
{ }
if (imageistruecolor($img)) {
$red = ($c >> 16) & 0xFF; $red = ($c >> 16) & 0xFF;
$green = ($c >> 8) & 0xFF; $green = ($c >> 8) & 0xFF;
$blue = $c & 0xFF; $blue = $c & 0xFF;
} } else {
else
{
$i = imagecolorsforindex($img, $c); $i = imagecolorsforindex($img, $c);
$red = $i['red']; $red = $i['red'];
$green = $i['green']; $green = $i['green'];
$blue = $i['blue']; $blue = $i['blue'];
} }
$m = min($red, $green, $blue); $m = min($red, $green, $blue);
$n = max($red, $green, $blue); $n = max($red, $green, $blue);
/* Because RGB isn't normalized in GD, we divide by 510 here. /* Because RGB isn't normalized in GD, we divide by 510 here.
@@ -40,8 +38,7 @@ function imagelightnessat($img, $x, $y)
* But that's assuming red, green, and blue are 0 through 1 inclusive. * But that's assuming red, green, and blue are 0 through 1 inclusive.
* Red, green, and blue are actually 0-255 (255 + 255 = 510). * Red, green, and blue are actually 0-255 (255 + 255 = 510).
*/ */
$lightness = (double)(($m + $n) / 510.0); $lightness = (float) (($m + $n) / 510.0);
return($lightness);
}
?> return $lightness;
}

119
index.php
View File

@@ -1,74 +1,75 @@
<?php <?php
session_start(); session_start();
$included=true; $included = true;
$lang=empty($_GET["lang"])?"cs":$_GET["lang"]; $lang = empty($_GET['lang']) ? 'cs' : $_GET['lang'];
$page=htmlspecialchars($_GET["page"]); $page = htmlspecialchars($_GET['page']);
$url=$_SERVER["REQUEST_URI"]; $url = $_SERVER['REQUEST_URI'];
$root=""; $root = '';
$pretitle="2. Skirogaining 2012"; $pretitle = '2. Skirogaining 2012';
$mainMail="tojnar@gmail.com"; $mainMail = 'tojnar@gmail.com';
include($lang.".php"); include $lang . '.php';
$CMS["%url%"]="http://skirogaining.tojnar.cz".htmlspecialchars($url); $CMS['%url%'] = 'http://skirogaining.tojnar.cz' . htmlspecialchars($url);
$CMS["%root%"]=$root; $CMS['%root%'] = $root;
$CMS["%lang%"]=$lang; $CMS['%lang%'] = $lang;
$CMS["%unknownAuthor%"]="Jan Tojnar"; $CMS['%unknownAuthor%'] = 'Jan Tojnar';
$CMS["%headerLinkHref%"]=rplc("%root%/").$lang; $CMS['%headerLinkHref%'] = rplc('%root%/') . $lang;
$CMS["%pretitle%"]=$pretitle; $CMS['%pretitle%'] = $pretitle;
$CMS["%comefrom%"]=$_SERVER["HTTP_REFERER"]; $CMS['%comefrom%'] = $_SERVER['HTTP_REFERER'];
$CMS["%dateFormat%"]="d.m.Y H:i"; $CMS['%dateFormat%'] = 'd.m.Y H:i';
if($lang=='cs') { if ($lang == 'cs') {
$CMS["%old%"]='<p class="old"><a href="http://skirogaining.tojnar.cz/Skirogaining_2010/">1. Skirogaining 2010</a> <a href="http://skirogaining.krk-litvinov.cz/">3. Skirogaining 2012</a></p>'; $CMS['%old%'] = '<p class="old"><a href="http://skirogaining.tojnar.cz/Skirogaining_2010/">1. Skirogaining 2010</a> <a href="http://skirogaining.krk-litvinov.cz/">3. Skirogaining 2012</a></p>';
} elseif($lang=='de') { } elseif ($lang == 'de') {
$CMS["%old%"]='<p class="old"><a href="http://skirogaining.tojnar.cz/Skirogaining_2010/de/">1. Skirogaining 2010</a> <a href="http://skirogaining.krk-litvinov.cz/de/">3. Skirogaining 2012</a></p>'; $CMS['%old%'] = '<p class="old"><a href="http://skirogaining.tojnar.cz/Skirogaining_2010/de/">1. Skirogaining 2010</a> <a href="http://skirogaining.krk-litvinov.cz/de/">3. Skirogaining 2012</a></p>';
} else { } else {
$CMS["%old%"]=''; $CMS['%old%'] = '';
} }
function rplc($string){ function rplc($string) {
global $CMS; global $CMS;
return str_replace(array_keys($CMS),$CMS,$string);
return str_replace(array_keys($CMS), $CMS, $string);
} }
include("sboard.php"); include 'sboard.php';
include("load.lib.php"); include 'load.lib.php';
readPage($page); readPage($page);
$CMS["%releasedate%"]=toDate($date); $CMS['%releasedate%'] = toDate($date);
$CMS["%releasetime%"]=toTime($date); $CMS['%releasetime%'] = toTime($date);
if(isReleased($date)==false){ if (isReleased($date) == false) {
$notreleased=true; $notreleased = true;
}else{ } else {
$notreleased=false; $notreleased = false;
} }
if($notreleased==true){ if ($notreleased == true) {
readPage("error/notreleased"); readPage('error/notreleased');
} }
$CMS["%title%"]=$title; $CMS['%title%'] = $title;
$CMS["%titleTag%"]=str_replace(array("%pretitle%","%title%"),array($pretitle,$title),rplc("%longTitle%")); $CMS['%titleTag%'] = str_replace(['%pretitle%', '%title%'], [$pretitle, $title], rplc('%longTitle%'));
$CMS["%langPanel%"]=$langPanel; $CMS['%langPanel%'] = $langPanel;
$CMS["%article%"]=$article; $CMS['%article%'] = $article;
$CMS["%menu%"]=$menu; $CMS['%menu%'] = $menu;
if(!empty($author) AND !empty($date)){ if (!empty($author) and !empty($date)) {
$aInfo=str_replace(array("%author%","%date%","%time%"),array(author($author),toDate($date),toTime($date)),rplc("%by%")); $aInfo = str_replace(['%author%', '%date%', '%time%'], [author($author), toDate($date), toTime($date)], rplc('%by%'));
}elseif(!empty($author)){ } elseif (!empty($author)) {
$aInfo=str_replace("%author%",author($author),rplc("%byAuthor%")); $aInfo = str_replace('%author%', author($author), rplc('%byAuthor%'));
}elseif(!empty($date)){ } elseif (!empty($date)) {
$aInfo=str_replace(array("%date%","%time%"),array(toDate($date),toTime($date)),rplc("%byDate%")); $aInfo = str_replace(['%date%', '%time%'], [toDate($date), toTime($date)], rplc('%byDate%'));
}else{ } else {
$aInfo=""; $aInfo = '';
} }
//var_dump(date(rplc("%dateFormat%"),filemtime($realPage))); //var_dump(date(rplc("%dateFormat%"),filemtime($realPage)));
$CMS["%author%"]=$author; $CMS['%author%'] = $author;
$CMS["%ainfo%"]=$aInfo; $CMS['%ainfo%'] = $aInfo;
if($eu==true){ if ($eu == true) {
$CMS["%eu%"]="<table class=\"table-no-border\" id=\"ziel3\"> $CMS['%eu%'] = '<table class="table-no-border" id="ziel3">
<tr><td colspan=\"2\"><h6>%eustring%</h6></td></tr> <tr><td colspan="2"><h6>%eustring%</h6></td></tr>
<tr><td><img src=\"/images/EU-Logo_rgb.jpg\" height=\"45\" width=\"361\"></td><td><img src=\"/images/ziel-small.jpg\" class=\"margin-05\"></td></tr> <tr><td><img src="/images/EU-Logo_rgb.jpg" height="45" width="361"></td><td><img src="/images/ziel-small.jpg" class="margin-05"></td></tr>
</table>"; </table>';
}else{ } else {
$CMS["%eu%"]=""; $CMS['%eu%'] = '';
} }
?> ?>
<?php <?php
ob_start(/*"ob_gzhandler"*/); ob_start(/*"ob_gzhandler"*/);
include("template.html"); include 'template.html';
$buffer=ob_get_clean(); $buffer = ob_get_clean();
echo(rplc(rplc($buffer))); echo rplc(rplc($buffer));
?> ?>

View File

@@ -1,28 +1,25 @@
<?php <?php
# Martin Hozik
# 24.5.2008
# doublethink.cleverweb.cz
// Martin Hozik
// 24.5.2008
// doublethink.cleverweb.cz
class linear_perspective { 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 $cam_location = array('x' => 10, 'y' => 0, 'z' => -240); public function get_projection(array $point) {
public $cam_rotation = array('x' => -1, 'y' => 0, 'z' => 0); $translation = [];
public $viewer_position = array('x' => 0, 'y' => -540, 'z' => -65); $projection = [];
public function get_projection(array $point) {
$translation = array(); $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']);
$projection = array(); $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']));
$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']); $projection['x'] = ($translation['x'] - $this->viewer_position['x']) * ($this->viewer_position['z'] / $translation['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'])); $projection['y'] = ($translation['y'] - $this->viewer_position['y']) * ($this->viewer_position['z'] / $translation['z']);
$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']); return $projection;
$projection['y'] = ($translation['y'] - $this->viewer_position['y']) * ($this->viewer_position['z'] / $translation['z']); }
return $projection;
}
} }
?>

View File

@@ -1,216 +1,216 @@
<?php <?php
if($included==true){
// boolean readPage(string $page) if ($included == true) {
function readPage($page){//main function // boolean readPage(string $page)
function readPage($page) {//main function
global $lang,$realPageType,$menuUrl,$article,$title,$author,$date,$time,$menu,$mainMail,$langPanel,$notreleased, $eu; global $lang,$realPageType,$menuUrl,$article,$title,$author,$date,$time,$menu,$mainMail,$langPanel,$notreleased, $eu;
if(empty($page)){//page specification if (empty($page)) {//page specification
$realPage="pages/".$lang."/main.pg"; $realPage = 'pages/' . $lang . '/main.pg';
}else{ } else {
if(file_exists("pages/".$lang."/".$page.".pg")){ if (file_exists('pages/' . $lang . '/' . $page . '.pg')) {
$realPage="pages/".$lang."/".$page.".pg"; $realPage = 'pages/' . $lang . '/' . $page . '.pg';
}else{ } else {
$realPage="pages/".$lang."/error/404.pg"; $realPage = 'pages/' . $lang . '/error/404.pg';
$log404=fopen("404.log","a+"); $log404 = fopen('404.log', 'a+');
if(!ereg($page."\n",file_get_contents("404.log"))){ if (!ereg($page . "\n", file_get_contents('404.log'))) {
fwrite($log404,$page."\n"); fwrite($log404, $page . "\n");
mail($mainMail,"Stranka nenalezena http://skirogaining.tojnar.cz/$page",rplc("Prichozi z: %comefrom%")); mail($mainMail, "Stranka nenalezena http://skirogaining.tojnar.cz/$page", rplc('Prichozi z: %comefrom%'));
} }
fclose($log404); fclose($log404);
} }
} }
//end of page specification //end of page specification
$errPageStart="pages/".$lang."/error/"; $errPageStart = 'pages/' . $lang . '/error/';
if(substr($realPage,0,strlen($errPageStart))==$errPageStart){//page type setting if (substr($realPage, 0, strlen($errPageStart)) == $errPageStart) {//page type setting
$realPageType=2; $realPageType = 2;
}elseif($realPage=="pages/".$lang."/main.pg"){ } elseif ($realPage == 'pages/' . $lang . '/main.pg') {
$realPageType=1; $realPageType = 1;
}else{ } else {
$realPageType=0; $realPageType = 0;
} }
//end of page type setting //end of page type setting
$fileContent=rplc(file_get_contents($realPage)); $fileContent = rplc(file_get_contents($realPage));
//echo($fileContent); //echo($fileContent);
$fileContent=ereg_replace("<a([^>]*)hs=\"([1-9][0-9]?)\"([^>]*)>","<a\\1onclick=\"return hs.expand(this,{slideshowGroup:\\2})\"\\3>",$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)); $sbContent = rplc(sboard_generate($realPage));
$fileContent=str_replace("<board>",$sbContent,$fileContent); $fileContent = str_replace('<board>', $sbContent, $fileContent);
ereg("<article>(.*)<\/article>",$fileContent,$article);//article body ereg("<article>(.*)<\/article>", $fileContent, $article); //article body
$article=trim($article[1]); $article = trim($article[1]);
ereg("<title>(.*)<\/title>",$fileContent,$title);//article title ereg("<title>(.*)<\/title>", $fileContent, $title); //article title
$title=trim($title[1]); $title = trim($title[1]);
ereg("<date>(.*)<\/date>",$fileContent,$date);//article title ereg("<date>(.*)<\/date>", $fileContent, $date); //article title
$date=trim($date[1]); $date = trim($date[1]);
ereg("<author>(.*)<\/author>",$fileContent,$author);//article title ereg("<author>(.*)<\/author>", $fileContent, $author); //article title
$author=trim($author[1]); $author = trim($author[1]);
$languages=array("cs","en","de"); $languages = ['cs', 'en', 'de'];
ereg("<alias([^>]*)cs=\"([^\"]*)\"([^>]*)>",$fileContent,$cs);//article czech version link ereg('<alias([^>]*)cs="([^"]*)"([^>]*)>', $fileContent, $cs); //article czech version link
$aliases["cs"]=trim($cs[2]); $aliases['cs'] = trim($cs[2]);
ereg("<alias([^>]*)en=\"([^\"]*)\"([^>]*)>",$fileContent,$en);//article english version link ereg('<alias([^>]*)en="([^"]*)"([^>]*)>', $fileContent, $en); //article english version link
$aliases["en"]=trim($en[2]); $aliases['en'] = trim($en[2]);
ereg("<alias([^>]*)de=\"([^\"]*)\"([^>]*)>",$fileContent,$de);//article german version link ereg('<alias([^>]*)de="([^"]*)"([^>]*)>', $fileContent, $de); //article german version link
$aliases["de"]=trim($de[2]); $aliases['de'] = trim($de[2]);
ereg("<menu url=\"([^\"]*)\">",$fileContent,$menuUrl);//article menu url ereg('<menu url="([^"]*)">', $fileContent, $menuUrl); //article menu url
$menuUrl=trim($menuUrl[1]); $menuUrl = trim($menuUrl[1]);
foreach($languages as $language){//language box generator foreach ($languages as $language) {//language box generator
if(!empty($aliases[$language]) AND file_exists("pages/".$language."/".$aliases[$language].".pg")){ 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>"); $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 //end of language box generator
$author=$realPageType==1?"":rplc($author); $author = $realPageType == 1 ? '' : rplc($author);
/*if($realPageType==0){ /*if($realPageType==0){
if(empty($date)){ if(empty($date)){
$date=date(rplc("%dateFormat%"),filemtime($realPage)); $date=date(rplc("%dateFormat%"),filemtime($realPage));
} }
} }
*/ */
if(empty($menuUrl) OR !file_exists($menuUrl)){ if (empty($menuUrl) or !file_exists($menuUrl)) {
$menuUrl="main"; $menuUrl = 'main';
} }
$menu=rplc(file_get_contents("pages/".$lang."/".$menuUrl.".mn")); $menu = rplc(file_get_contents('pages/' . $lang . '/' . $menuUrl . '.mn'));
$article=rplc($article); $article = rplc($article);
if(ereg("<goto url=\"([^\"]+)\">",$fileContent,$gotoUrl)){ if (ereg('<goto url="([^"]+)">', $fileContent, $gotoUrl)) {
if($page==$gotoUrl[1]){ if ($page == $gotoUrl[1]) {
$logrecursive=fopen("syntax.log","a+"); $logrecursive = fopen('syntax.log', 'a+');
if(!ereg($realPage."\n",file_get_contents("recursive.log"))){ if (!ereg($realPage . "\n", file_get_contents('recursive.log'))) {
fwrite($logrecursive,$realPage."\n"); fwrite($logrecursive, $realPage . "\n");
mail($mainMail,"Presmerovaci smycka http://skirogaining.tojnar.cz/$realPage","Stranka se presmerovava sama na sebe"); mail($mainMail, "Presmerovaci smycka http://skirogaining.tojnar.cz/$realPage", 'Stranka se presmerovava sama na sebe');
} }
fclose($logrecursive); fclose($logrecursive);
readPage("error/recursive"); readPage('error/recursive');
}else{ } else {
readPage($gotoUrl[1]); 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');
if(strpos($fileContent,"<eu>")!=false){ return str_replace(['%y%', '%m%', '%d%'], [$year, $month, $day], rplc('%date%'));
$eu=true; } else {
}else{ return null;
$eu=false; }
} }
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];
if(empty($title) AND empty($article)){ return $time;
$logsyntax=fopen("syntax.log","a+"); } else {
if(!ereg($realPage."\n",file_get_contents("syntax.log"))){ return null;
fwrite($logsyntax,$realPage."\n"); }
mail($mainMail,"Chyba syntaxe http://skirogaining.tojnar.cz/$realPage","Nerozpoznan titulek a clanek"); }
} else {
header('HTTP/1.0 403 Forbidden');
header('Location: /en/error/403');
} }
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(array("%y%","%m%","%d%"),array($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");
}
?>

View File

@@ -1,95 +1,106 @@
<?php <?php
$sbnum=0;
if(0==9){ $sbnum = 0;
header("HTTP/1.0 303 See Other"); if (0 == 9) {
header('HTTP/1.0 303 See Other');
} }
/** replaces bb tags on html /** replaces bb tags on html
* @param string $buffer text with bb codes * @param string $buffer text with bb codes
* @return string replaced string *
* @copyright Jan Tojnar, http://jtojnar.php5.cz/ * @return string replaced string
*/ *
function bb2html($buffer){ * @copyright Jan Tojnar, http://jtojnar.php5.cz/
$buffer=ereg_replace("\[b\](.*)\[/b\]","<span class=\"bold\">\\1</span>",$buffer); */
$buffer=ereg_replace("\[i\](.*)\[/i\]","<span class=\"italic\">\\1</span>",$buffer); function bb2html($buffer) {
$buffer=ereg_replace("\[red\](.*)\[/red\]","<span class=\"red\">\\1</span>",$buffer); $buffer = ereg_replace("\[b\](.*)\[/b\]", '<span class="bold">\\1</span>', $buffer);
$buffer=ereg_replace("\[green\](.*)\[/green\]","<span class=\"green\">\\1</span>",$buffer); $buffer = ereg_replace("\[i\](.*)\[/i\]", '<span class="italic">\\1</span>', $buffer);
$buffer=ereg_replace("\[blue\](.*)\[/blue\]","<span class=\"blue\">\\1</span>",$buffer); $buffer = ereg_replace("\[red\](.*)\[/red\]", '<span class="red">\\1</span>', $buffer);
$buffer=ereg_replace("\[purple\](.*)\[/purple\]","<span class=\"purple\">\\1</span>",$buffer); $buffer = ereg_replace("\[green\](.*)\[/green\]", '<span class="green">\\1</span>', $buffer);
$buffer=ereg_replace("\[yellow\](.*)\[/yellow\]","<span class=\"yellow\">\\1</span>",$buffer); $buffer = ereg_replace("\[blue\](.*)\[/blue\]", '<span class="blue">\\1</span>', $buffer);
$buffer=ereg_replace("%(.*)%","&#37;\\1&#37;",$buffer); $buffer = ereg_replace("\[purple\](.*)\[/purple\]", '<span class="purple">\\1</span>', $buffer);
$buffer=ereg_replace("\n","<br>\n",$buffer); $buffer = ereg_replace("\[yellow\](.*)\[/yellow\]", '<span class="yellow">\\1</span>', $buffer);
$buffer=ereg_replace("\r\n","<br>\n",$buffer); $buffer = ereg_replace('%(.*)%', '&#37;\\1&#37;', $buffer);
$buffer=ereg_replace("\r","<br>\n",$buffer); $buffer = ereg_replace("\n", "<br>\n", $buffer);
return htmlspecialchars($buffer); $buffer = ereg_replace("\r\n", "<br>\n", $buffer);
$buffer = ereg_replace("\r", "<br>\n", $buffer);
return htmlspecialchars($buffer);
} }
/** control e-mail address /** control e-mail address
* @param string $email e-mail address * @param string $email e-mail address
* @return bool is right address syntax *
* @copyright Jakub Vrána, http://php.vrana.cz * @return bool is right address syntax
*/ *
function check_email($email){ * @copyright Jakub Vrána, http://php.vrana.cz
$atom='[-a-z0-9!#$%&\'*+/=?^_`{|}~]'; */
$domain='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; function check_email($email) {
return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$",$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 /** control www address
* @param string $url www address * @param string $url www address
* @return bool is right address syntax *
* @copyright Jan Tojnar, http://jtojnar.php5.cz * @return bool is right address syntax
*/ *
function check_url($url){ * @copyright Jan Tojnar, http://jtojnar.php5.cz
return eregi("^http[s]?://[-a-z0-9]*\.[-a-z0-9]+\.[a-z]+$",$url); */
function check_url($url) {
return eregi("^http[s]?://[-a-z0-9]*\.[-a-z0-9]+\.[a-z]+$", $url);
} }
/** returns text of shoutboard /** returns text of shoutboard
* @param string $file page filename * @param string $file page filename
* @return string shoutboard html *
* @copyright Jan Tojnar, http://jtojnar.php5.cz/ * @return string shoutboard html
*/ *
function sboard_generate($file){ * @copyright Jan Tojnar, http://jtojnar.php5.cz/
$sbnum++; */
$name=htmlspecialchars($_POST["name"]); function sboard_generate($file) {
$www=htmlspecialchars($_POST["www"]); ++$sbnum;
$post=htmlspecialchars($_POST["post"]); $name = htmlspecialchars($_POST['name']);
$ip=$_SERVER["REMOTE_ADDR"]; $www = htmlspecialchars($_POST['www']);
$timestamp=date(rplc("%dateFormat%")); $post = htmlspecialchars($_POST['post']);
$formCaptchaSum=sha1($_POST["captcha"]); $ip = $_SERVER['REMOTE_ADDR'];
$showmail=$_POST["showmail"]; $timestamp = date(rplc('%dateFormat%'));
$checkedshowmailfalse=$showmail=="false"?" checked=\"checked\"":""; $formCaptchaSum = sha1($_POST['captcha']);
$checkedshowmailtrue=empty($showmail)?" checked=\"checked\"":($showmail=="true"?" checked=\"checked\"":""); $showmail = $_POST['showmail'];
if($showmail=="true"){ $checkedshowmailfalse = $showmail == 'false' ? ' checked="checked"' : '';
$email=htmlspecialchars($_POST["email"]); $checkedshowmailtrue = empty($showmail) ? ' checked="checked"' : ($showmail == 'true' ? ' checked="checked"' : '');
}else{ if ($showmail == 'true') {
$hemail=htmlspecialchars($_POST["email"]); $email = htmlspecialchars($_POST['email']);
} } else {
$formCaptchaSumPre=$_POST["captchasum"]; $hemail = htmlspecialchars($_POST['email']);
$captcha=mt_rand(0,9).mt_rand(0,9).mt_rand(0,9).mt_rand(0,9); }
$_SESSION["captcha"]=$captcha; $formCaptchaSumPre = $_POST['captchasum'];
$captchasum=sha1($captcha); $captcha = mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9);
#echo($timestamp); $_SESSION['captcha'] = $captcha;
#echo($post); $captchasum = sha1($captcha);
if(isset($_POST["post"])){ //echo($timestamp);
if(empty($post)){ //echo($post);
$sbError.="<p>"."%misspost%"."</p>\n"; if (isset($_POST['post'])) {
} if (empty($post)) {
if(empty($name)){ $sbError .= '<p>' . '%misspost%' . "</p>\n";
$sbError.="<p>"."%missname%"."</p>\n"; }
} if (empty($name)) {
if($formCaptchaSumPre!=$formCaptchaSum){ $sbError .= '<p>' . '%missname%' . "</p>\n";
$sbError.="<p>"."%wrongcode%"."</p>\n"; }
} if ($formCaptchaSumPre != $formCaptchaSum) {
if(!empty($email) && !check_email($email)){ $sbError .= '<p>' . '%wrongcode%' . "</p>\n";
$sbError.="<p>"."%wrongmail%"."</p>\n"; }
} if (!empty($email) && !check_email($email)) {
if(!empty($www) && !check_url($www)){ $sbError .= '<p>' . '%wrongmail%' . "</p>\n";
$sbError.="<p>"."%wrongwww%"."</p>\n"; }
} if (!empty($www) && !check_url($www)) {
if(empty($sbError)){ $sbError .= '<p>' . '%wrongwww%' . "</p>\n";
$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":""; if (empty($sbError)) {
$post=bb2html($post); $sbmail = !empty($email) ? "<span class=\"sbmail\"><span>{$email}</span></span>\n" : (!empty($hemail) ? "<hemail>{$hemail}</hemail>" : '');
$write=<<<EOT $sbwww = !empty($www) ? "<span class=\"sbwww\"><span>{$www}</span></span>\n" : '';
$post = bb2html($post);
$write = <<<EOT
<div class="sbcomment"> <div class="sbcomment">
<div class="sbheader"> <div class="sbheader">
<span class="sbname">{$name}</span> <span class="sbname">{$name}</span>
@@ -101,23 +112,23 @@ $write=<<<EOT
EOT; EOT;
$shoutfile=fopen($file."c".$sbnum,"a+"); $shoutfile = fopen($file . 'c' . $sbnum, 'a+');
chmod($file."c".$sbnum,0777); chmod($file . 'c' . $sbnum, 0777);
if(fwrite($shoutfile,$write)){ if (fwrite($shoutfile, $write)) {
$sbError.="<p>"."%saved%"."</p>\n"; $sbError .= '<p>' . '%saved%' . "</p>\n";
unset($name,$email,$www,$captcha,$post,$ip,$timestamp,$formCaptchaSum,$formCaptchaSumPre,$captchasum,$sbname,$sbdate,$sbwww,$sbmail); unset($name,$email,$www,$captcha,$post,$ip,$timestamp,$formCaptchaSum,$formCaptchaSumPre,$captchasum,$sbname,$sbdate,$sbwww,$sbmail);
fclose($shoutfile); fclose($shoutfile);
}else{ } else {
$sbError.="<p>"."%notsaved%"."</p>\n"; $sbError .= '<p>' . '%notsaved%' . "</p>\n";
} }
} }
} }
if(file_exists($file."c".$sbnum)){ if (file_exists($file . 'c' . $sbnum)) {
$comments=ereg_replace("<ip>([^<]+)</ip>","",ereg_replace("<hemail>([^<]+)</hemail>","",file_get_contents($file."c".$sbnum))); $comments = ereg_replace('<ip>([^<]+)</ip>', '', ereg_replace('<hemail>([^<]+)</hemail>', '', file_get_contents($file . 'c' . $sbnum)));
}else{ } else {
$comments=""; $comments = '';
} }
$form=$comments."<hr class=\"sboard\" id=\"sboard{$sbnum}\">".(empty($sbError)?"":"<div class=\"sberrors\">".rplc($sbError)."</div>").<<<EOT $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"> <form method="post" action="#sboard{$sbnum}" class="sbform">
<div> <div>
<dl> <dl>
@@ -135,6 +146,6 @@ $form=$comments."<hr class=\"sboard\" id=\"sboard{$sbnum}\">".(empty($sbError)?"
%sbhelp% %sbhelp%
</div> </div>
EOT; EOT;
return $form;
return $form;
} }
?>

View File

@@ -1,30 +1,31 @@
<?php <?php
header("Content-Type: text/plain; charset=utf-8");
function directoryToArray($directory,$recursive){ header('Content-Type: text/plain; charset=utf-8');
$array_items=array(); function directoryToArray($directory, $recursive) {
if($handle=opendir($directory)){ $array_items = [];
while(false!==($file=readdir($handle))){ if ($handle = opendir($directory)) {
if($file!="."&&$file!=".."){ while (false !== ($file = readdir($handle))) {
if(is_dir($directory."/".$file)){ if ($file != '.' && $file != '..') {
if($recursive){ if (is_dir($directory . '/' . $file)) {
$array_items=array_merge($array_items,directoryToArray($directory. "/".$file,$recursive)); if ($recursive) {
$array_items = array_merge($array_items, directoryToArray($directory . '/' . $file, $recursive));
}
$file = $directory . '/' . $file;
} else {
$file = $directory . '/' . $file;
$array_items[] = preg_replace("/\/\//si", '/', $file);
}
}
}
closedir($handle);
}
return $array_items;
} }
$file=$directory."/".$file; $files = directoryToArray('./pages', true);
}else{ foreach ($files as $file) {
$file=$directory."/".$file; if (substr($file, -3) == '.pg' and (substr($file, 0, 17) != './pages/cs/error/' and substr($file, 0, 17) != './pages/en/error/' and substr($file, 0, 17) != './pages/de/error/')) {
$array_items[]=preg_replace("/\/\//si","/",$file); $list .= substr($file, 0, -3) . "\n";
}
} }
} echo str_replace('./pages', 'http://' . $_SERVER['HTTP_HOST'], $list);
}
closedir($handle);
}
return $array_items;
}
$files=directoryToArray("./pages",true);
foreach($files as $file){
if(substr($file,-3)==".pg" AND (substr($file,0,17)!="./pages/cs/error/" AND substr($file,0,17)!="./pages/en/error/" AND substr($file,0,17)!="./pages/de/error/")){
$list.=substr($file,0,-3)."\n";
}
}
echo(str_replace("./pages","http://".$_SERVER["HTTP_HOST"],$list));
?>