Make the old code compatible with modern PHP
This commit is contained in:
@@ -13,7 +13,7 @@ declare(strict_types=1);
|
||||
* by Jed Smith <?php $u = "jed"; $d = "bz"; printf("<%s@%s.%s>", $u, $u, $d) ?>
|
||||
*/
|
||||
function imagelightnessat($img, $x, $y) {
|
||||
if (!is_resource($img)) {
|
||||
if (!$img instanceof \GdImage && !is_resource($img)) {
|
||||
trigger_error('imagelightnessat(): supplied argument is not a valid '
|
||||
. 'Image resource', \E_USER_WARNING);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
session_start();
|
||||
$included = true;
|
||||
$lang = empty($_GET['lang']) ? 'cs' : $_GET['lang'];
|
||||
$page = htmlspecialchars($_GET['page']);
|
||||
$page = htmlspecialchars($_GET['page'] ?? 'main');
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
$root = '/krk/lob2011';
|
||||
$pretitle = 'LOB 2011';
|
||||
@@ -16,7 +16,7 @@ $CMS['%headerLinkHref%'] = rplc('%root%/') . $lang;
|
||||
$CMS['%pretitle%'] = $pretitle;
|
||||
$CMS['%comefrom%'] = $_SERVER['HTTP_REFERER'];
|
||||
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
||||
function rplc($string) {
|
||||
function rplc(string $string): string {
|
||||
global $CMS;
|
||||
|
||||
return str_replace(array_keys($CMS), $CMS, $string);
|
||||
|
||||
@@ -2,195 +2,228 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
if ($included == true) {
|
||||
// boolean readPage(string $page)
|
||||
function readPage($page) {//main function
|
||||
global $lang,$realPageType,$menuUrl,$article,$title,$author,$date,$time,$menu,$mainMail,$langPanel,$notreleased, $eu;
|
||||
if (empty($page)) {//page specification
|
||||
$realPage = 'pages/' . $lang . '/main.pg';
|
||||
function isHttps(): bool {
|
||||
// https://www.designcise.com/web/tutorial/how-to-check-for-https-request-in-php
|
||||
$isHttps = $_SERVER['HTTPS'] ?? $_SERVER['REQUEST_SCHEME'] ?? $_SERVER['HTTP_X_FORWARDED_PROTO'] ?? null;
|
||||
|
||||
return $isHttps && (strcasecmp('on', $isHttps) === 0 || strcasecmp('https', $isHttps) === 0);
|
||||
}
|
||||
|
||||
function readPage(string $page): bool {
|
||||
//main function
|
||||
$aliases = [];
|
||||
global $lang,$realPageType,$menuUrl,$article,$title,$author,$date,$time,$menu,$mainMail,$langPanel,$notreleased, $eu;
|
||||
if (empty($page)) {//page specification
|
||||
$realPage = 'pages/' . $lang . '/main.pg';
|
||||
} else {
|
||||
if (file_exists('pages/' . $lang . '/' . $page . '.pg')) {
|
||||
$realPage = 'pages/' . $lang . '/' . $page . '.pg';
|
||||
} else {
|
||||
if (file_exists('pages/' . $lang . '/' . $page . '.pg')) {
|
||||
$realPage = 'pages/' . $lang . '/' . $page . '.pg';
|
||||
} else {
|
||||
$realPage = 'pages/' . $lang . '/error/404.pg';
|
||||
$log404 = fopen('404.log', 'a+');
|
||||
if (!ereg($page . "\n", file_get_contents('404.log'))) {
|
||||
fwrite($log404, $page . "\n");
|
||||
mail($mainMail, "Stranka nenalezena http://tojnar.cz/krk/lob2011/$page", rplc('Prichozi z: %comefrom%'));
|
||||
}
|
||||
fclose($log404);
|
||||
$realPage = 'pages/' . $lang . '/error/404.pg';
|
||||
$log404 = fopen('404.log', 'a+');
|
||||
if (!preg_match('(' . preg_quote($page) . '\n)', file_get_contents('404.log'))) {
|
||||
fwrite($log404, $page . "\n");
|
||||
mail($mainMail, "Stranka nenalezena http://www.tojnar.cz/krk/lob2011/$page", rplc('Prichozi z: %comefrom%'));
|
||||
}
|
||||
fclose($log404);
|
||||
}
|
||||
//end of page specification
|
||||
$errPageStart = 'pages/' . $lang . '/error/';
|
||||
if (substr($realPage, 0, strlen($errPageStart)) == $errPageStart) {//page type setting
|
||||
$realPageType = 2;
|
||||
} elseif ($realPage == 'pages/' . $lang . '/main.pg') {
|
||||
$realPageType = 1;
|
||||
} else {
|
||||
$realPageType = 0;
|
||||
}
|
||||
//end of page type setting
|
||||
}
|
||||
//end of page specification
|
||||
$errPageStart = 'pages/' . $lang . '/error/';
|
||||
if (substr($realPage, 0, strlen($errPageStart)) == $errPageStart) {//page type setting
|
||||
$realPageType = 2;
|
||||
} elseif ($realPage == 'pages/' . $lang . '/main.pg') {
|
||||
$realPageType = 1;
|
||||
} else {
|
||||
$realPageType = 0;
|
||||
}
|
||||
//end of page type setting
|
||||
|
||||
$fileContent = rplc(file_get_contents($realPage));
|
||||
//echo($fileContent);
|
||||
$fileContent = preg_replace('/<a([^>]*)hs="([1-9][0-9]?)"([^>]*)>/D', '<a\\1onclick="return hs.expand(this,{slideshowGroup:\\2})"\\3>', $fileContent);
|
||||
$sbContent = rplc(sboard_generate($realPage));
|
||||
$fileContent = str_replace('<board>', $sbContent, $fileContent);
|
||||
$fileContent = rplc(file_get_contents($realPage));
|
||||
//echo($fileContent);
|
||||
$fileContent = preg_replace('(<a([^>]*)hs="([1-9][0-9]?)"([^>]*)>)', '<a\\1onclick="return hs.expand(this,{slideshowGroup:\\2})"\\3>', $fileContent);
|
||||
$sbContent = rplc(sboard_generate($realPage));
|
||||
$fileContent = str_replace('<board>', $sbContent, $fileContent);
|
||||
|
||||
preg_match("#<article>(.*)<\/article>#D", $fileContent, $article); //article body
|
||||
if (preg_match('(<article>(.*)</article>)s', $fileContent, $article)) {
|
||||
//article body
|
||||
$article = trim($article[1]);
|
||||
} else {
|
||||
$article = '';
|
||||
}
|
||||
|
||||
preg_match("#<title>(.*)<\/title>#D", $fileContent, $title); //article title
|
||||
if (preg_match('(<title>(.*)</title>)s', $fileContent, $title)) {
|
||||
//article title
|
||||
$title = trim($title[1]);
|
||||
} else {
|
||||
$title = '';
|
||||
}
|
||||
|
||||
preg_match("#<date>(.*)<\/date>#D", $fileContent, $date); //article title
|
||||
if (preg_match('(<date>(.*)</date>)s', $fileContent, $date)) {
|
||||
//article release time
|
||||
$date = trim($date[1]);
|
||||
} else {
|
||||
$date = null;
|
||||
}
|
||||
|
||||
preg_match("#<author>(.*)<\/author>#D", $fileContent, $author); //article title
|
||||
if (preg_match('(<author>(.*)</author>)s', $fileContent, $author)) {
|
||||
//article author
|
||||
$author = trim($author[1]);
|
||||
} else {
|
||||
$author = null;
|
||||
}
|
||||
|
||||
$languages = ['cs', 'en', 'de'];
|
||||
$languages = ['cs', 'en', 'de'];
|
||||
|
||||
preg_match('/<alias([^>]*)cs(e?)="([^"]*)"([^>]*)>/D', $fileContent, $cs); //article czech version link
|
||||
if (preg_match('(<alias([^>]*)cs(e?)="([^"]*)"([^>]*)>)', $fileContent, $cs)) {
|
||||
//article czech version link
|
||||
$aliases['cs'] = ($cs[2] == 'e' ? '*' : '') . trim($cs[3]);
|
||||
}
|
||||
|
||||
preg_match('/<alias([^>]*)en(e?)="([^"]*)"([^>]*)>/D', $fileContent, $en); //article english version link
|
||||
if (preg_match('(<alias([^>]*)en(e?)="([^"]*)"([^>]*)>)', $fileContent, $en)) {
|
||||
//article english version link
|
||||
$aliases['en'] = ($en[2] == 'e' ? '*' : '') . trim($en[3]);
|
||||
}
|
||||
|
||||
preg_match('/<alias([^>]*)de(e?)="([^"]*)"([^>]*)>/D', $fileContent, $de); //article german version link
|
||||
if (preg_match('(<alias([^>]*)de(e?)="([^"]*)"([^>]*)>)', $fileContent, $de)) {
|
||||
//article german version link
|
||||
$aliases['de'] = ($de[2] == 'e' ? '*' : '') . trim($de[3]);
|
||||
}
|
||||
|
||||
preg_match('/<menu url="([^"]*)">/D', $fileContent, $menuUrl); //article menu url
|
||||
if (preg_match('(<menu url="([^"]*)">)', $fileContent, $menuUrl)) {
|
||||
//article menu url
|
||||
$menuUrl = trim($menuUrl[1]);
|
||||
foreach ($languages as $language) {//language box generator
|
||||
if (mb_substr($aliases[$language], 0, 1) == '*') {
|
||||
//language box generator
|
||||
foreach ($languages as $language) {
|
||||
if (isset($aliases[$language]) && str_starts_with($aliases[$language], '*')) {
|
||||
$langPanel .= rplc('<a href="' . mb_substr($aliases[$language], 1) . '"><img src="%root%/gpx/' . $language . 'flag.png" alt="' . $language . '"></a>');
|
||||
} else {
|
||||
if (!empty($aliases[$language]) && file_exists('pages/' . $language . '/' . $aliases[$language] . '.pg')) {
|
||||
if (isset($aliases[$language]) && file_exists('pages/' . $language . '/' . $aliases[$language] . '.pg')) {
|
||||
$langPanel .= rplc('<a href="%root%/' . $language . '/' . ($aliases[$language] == 'main' ? '' : $aliases[$language]) . '"><img src="%root%/gpx/' . $language . 'flag.png" alt="' . $language . '"></a>');
|
||||
}
|
||||
}
|
||||
}
|
||||
//end of language box generator
|
||||
} else {
|
||||
$menuUrl = null;
|
||||
}
|
||||
|
||||
//$author=$realPageType==1?"":rplc($author);
|
||||
/*if($realPageType==0){
|
||||
if(empty($date)){
|
||||
$date=date(rplc("%dateFormat%"),filemtime($realPage));
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (empty($menuUrl) || !file_exists($menuUrl)) {
|
||||
$menuUrl = 'main';
|
||||
}
|
||||
$menu = rplc(file_get_contents('pages/' . $lang . '/' . $menuUrl . '.mn'));
|
||||
$article = rplc($article);
|
||||
if (preg_match('/<goto url="([^"]+)">/D', $fileContent, $gotoUrl)) {
|
||||
if ($page == $gotoUrl[1]) {
|
||||
$logrecursive = fopen('syntax.log', 'a+');
|
||||
if (!ereg($realPage . "\n", file_get_contents('recursive.log'))) {
|
||||
fwrite($logrecursive, $realPage . "\n");
|
||||
mail($mainMail, "Presmerovaci smycka http://tojnar.cz/krk/lob2011/$realPage", 'Stranka se presmerovava sama na sebe');
|
||||
}
|
||||
fclose($logrecursive);
|
||||
readPage('error/recursive');
|
||||
} else {
|
||||
readPage($gotoUrl[1]);
|
||||
$author = $realPageType == 1 || $author === null ? '' : rplc($author);
|
||||
/*if($realPageType==0){
|
||||
if(empty($date)){
|
||||
$date=date(rplc("%dateFormat%"),filemtime($realPage));
|
||||
}
|
||||
}
|
||||
*/
|
||||
if ($menuUrl === null || !file_exists($menuUrl)) {
|
||||
$menuUrl = 'main';
|
||||
}
|
||||
$menu = rplc(file_get_contents('pages/' . $lang . '/' . $menuUrl . '.mn'));
|
||||
$article = rplc($article);
|
||||
if (preg_match('(<goto url="([^"]+)">)', $fileContent, $gotoUrl)) {
|
||||
if ($page == $gotoUrl[1]) {
|
||||
$logrecursive = fopen('syntax.log', 'a+');
|
||||
if (!preg_match('(' . preg_quote($realPage) . '\n)', file_get_contents('recursive.log'))) {
|
||||
fwrite($logrecursive, $realPage . "\n");
|
||||
mail($mainMail, "Presmerovaci smycka https://www.tojnar.cz/krk/lob2011/$realPage", 'Stranka se presmerovava sama na sebe');
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($fileContent, '<eu>') != false) {
|
||||
$eu = true;
|
||||
fclose($logrecursive);
|
||||
readPage('error/recursive');
|
||||
} else {
|
||||
$eu = false;
|
||||
}
|
||||
|
||||
if (empty($title) && 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://tojnar.cz/krk/lob2011/$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://tojnar.cz/krk/lob2011/$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://tojnar.cz/krk/lob2011/$realPage", 'Nerozpoznan clanek');
|
||||
}
|
||||
fclose($logsyntax);
|
||||
readPage('error/syntax');
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
readPage($gotoUrl[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
if (strpos($fileContent, '<eu>') != false) {
|
||||
$eu = true;
|
||||
} else {
|
||||
$eu = false;
|
||||
}
|
||||
|
||||
// string|null toDate(string $date)
|
||||
function toDate($dateStr) {
|
||||
if (!empty($dateStr)) {
|
||||
$dateStr = explode(' ', $dateStr);
|
||||
$dateStr = $dateStr[0];
|
||||
$dateStr = explode('-', $dateStr);
|
||||
$year = $dateStr[0];
|
||||
$month = ltrim($dateStr[1], '0');
|
||||
$day = ltrim($dateStr[2], '0');
|
||||
|
||||
return str_replace(['%y%', '%m%', '%d%'], [$year, $month, $day], rplc('%date%'));
|
||||
} else {
|
||||
return null;
|
||||
if (empty($title) && empty($article)) {
|
||||
$logsyntax = fopen('syntax.log', 'a+');
|
||||
if (!preg_match('(' . preg_quote($realPage) . '\n)', file_get_contents('syntax.log'))) {
|
||||
fwrite($logsyntax, $realPage . "\n");
|
||||
mail($mainMail, "Chyba syntaxe https://www.tojnar.cz/krk/lob2011/$realPage", 'Nerozpoznan titulek a clanek');
|
||||
}
|
||||
}
|
||||
fclose($logsyntax);
|
||||
readPage('error/syntax');
|
||||
|
||||
function isReleased($dateStr) {
|
||||
return false;
|
||||
} elseif (empty($title)) {
|
||||
$logsyntax = fopen('syntax.log', 'a+');
|
||||
if (!preg_match('(' . preg_quote($realPage) . '\n)', file_get_contents('syntax.log'))) {
|
||||
fwrite($logsyntax, $realPage . "\n");
|
||||
mail($mainMail, "Chyba syntaxe https://www.tojnar.cz/krk/lob2011/$realPage", 'Nerozpoznan titulek');
|
||||
}
|
||||
fclose($logsyntax);
|
||||
readPage('error/syntax');
|
||||
|
||||
return false;
|
||||
} elseif (empty($article)) {
|
||||
$logsyntax = fopen('syntax.log', 'a+');
|
||||
if (!preg_match('(' . preg_quote($realPage) . '\n)', file_get_contents('syntax.log'))) {
|
||||
fwrite($logsyntax, $realPage . "\n");
|
||||
mail($mainMail, "Chyba syntaxe https://www.tojnar.cz/krk/lob2011/$realPage", 'Nerozpoznan clanek');
|
||||
}
|
||||
fclose($logsyntax);
|
||||
readPage('error/syntax');
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function author(string $author): ?string {
|
||||
global $realPageType;
|
||||
if ($realPageType == 0) {
|
||||
if (empty($author)) {
|
||||
return rplc('%unknownAuthor%');
|
||||
} else {
|
||||
return $author;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function toDate(?string $dateStr): ?string {
|
||||
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');
|
||||
$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;
|
||||
}
|
||||
|
||||
return str_replace(['%y%', '%m%', '%d%'], [$year, $month, $day], rplc('%date%'));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function isReleased(?string $datetimeStr): bool {
|
||||
if ($datetimeStr === null || $datetimeStr === '') {
|
||||
// Empty date = release immediately
|
||||
return true;
|
||||
}
|
||||
|
||||
$datetime = explode(' ', $datetimeStr);
|
||||
if (!isset($datetime[1])) {
|
||||
$datetime[1] = '00:00';
|
||||
}
|
||||
|
||||
[$year, $month, $day] = explode('-', $datetime[0]);
|
||||
$month = ltrim($month, '0');
|
||||
$day = ltrim($day, '0');
|
||||
[$hour, $minute] = explode(':', $datetime[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;
|
||||
}
|
||||
@@ -203,20 +236,17 @@ if ($included == true) {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function toTime(?string $dateStr): ?string {
|
||||
if (!empty($dateStr)) {
|
||||
$time = explode(' ', $dateStr);
|
||||
|
||||
return $time[1] ?? null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 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');
|
||||
}
|
||||
|
||||
@@ -14,17 +14,17 @@ if (0 == 9) {
|
||||
* @copyright Jan Tojnar, http://jtojnar.php5.cz/
|
||||
*/
|
||||
function bb2html($buffer) {
|
||||
$buffer = preg_replace("#\[b\](.*)\[/b\]#D", '<span class="bold">\\1</span>', $buffer);
|
||||
$buffer = preg_replace("#\[i\](.*)\[/i\]#D", '<span class="italic">\\1</span>', $buffer);
|
||||
$buffer = preg_replace("#\[red\](.*)\[/red\]#D", '<span class="red">\\1</span>', $buffer);
|
||||
$buffer = preg_replace("#\[green\](.*)\[/green\]#D", '<span class="green">\\1</span>', $buffer);
|
||||
$buffer = preg_replace("#\[blue\](.*)\[/blue\]#D", '<span class="blue">\\1</span>', $buffer);
|
||||
$buffer = preg_replace("#\[purple\](.*)\[/purple\]#D", '<span class="purple">\\1</span>', $buffer);
|
||||
$buffer = preg_replace("#\[yellow\](.*)\[/yellow\]#D", '<span class="yellow">\\1</span>', $buffer);
|
||||
$buffer = preg_replace('/%(.*)%/D', '%\\1%', $buffer);
|
||||
$buffer = preg_replace("/\n/D", "<br>\n", $buffer);
|
||||
$buffer = preg_replace("/\r\n/D", "<br>\n", $buffer);
|
||||
$buffer = preg_replace("/\r/D", "<br>\n", $buffer);
|
||||
$buffer = preg_replace('(\[b\](.*)\[/b\])s', '<span class="bold">\\1</span>', $buffer);
|
||||
$buffer = preg_replace('(\[i\](.*)\[/i\])s', '<span class="italic">\\1</span>', $buffer);
|
||||
$buffer = preg_replace('(\[red\](.*)\[/red\])s', '<span class="red">\\1</span>', $buffer);
|
||||
$buffer = preg_replace('(\[green\](.*)\[/green\])s', '<span class="green">\\1</span>', $buffer);
|
||||
$buffer = preg_replace('(\[blue\](.*)\[/blue\])s', '<span class="blue">\\1</span>', $buffer);
|
||||
$buffer = preg_replace('(\[purple\](.*)\[/purple\])s', '<span class="purple">\\1</span>', $buffer);
|
||||
$buffer = preg_replace('(\[yellow\](.*)\[/yellow\])s', '<span class="yellow">\\1</span>', $buffer);
|
||||
$buffer = preg_replace('(%(.*)%)s', '&(37;\\1&)37;', $buffer);
|
||||
$buffer = preg_replace('(\n)', "<br>\n", $buffer);
|
||||
$buffer = preg_replace('(\r\n)', "<br>\n", $buffer);
|
||||
$buffer = preg_replace('(\r)', "<br>\n", $buffer);
|
||||
|
||||
return htmlspecialchars($buffer);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ function check_email($email) {
|
||||
$atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]';
|
||||
$domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';
|
||||
|
||||
return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$", $email);
|
||||
return preg_match("(^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$)i", $email);
|
||||
}
|
||||
|
||||
/** control www address.
|
||||
@@ -50,7 +50,7 @@ function check_email($email) {
|
||||
* @copyright Jan Tojnar, http://jtojnar.php5.cz
|
||||
*/
|
||||
function check_url($url) {
|
||||
return preg_match("#^http[s]?://[-a-z0-9]*\.[-a-z0-9]+\.[a-z]+$#Di", $url);
|
||||
return preg_match('(^http[s]?://[-a-z0-9]*\.[-a-z0-9]+\.[a-z]+$)i', $url);
|
||||
}
|
||||
|
||||
/** returns text of shoutboard.
|
||||
@@ -61,22 +61,26 @@ function check_url($url) {
|
||||
* @copyright Jan Tojnar, http://jtojnar.php5.cz/
|
||||
*/
|
||||
function sboard_generate($file) {
|
||||
$sbnum = 0;
|
||||
$sbError = '';
|
||||
$email = null;
|
||||
$hemail = null;
|
||||
++$sbnum;
|
||||
$name = htmlspecialchars($_POST['name']);
|
||||
$www = htmlspecialchars($_POST['www']);
|
||||
$post = htmlspecialchars($_POST['post']);
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$name = htmlspecialchars($_POST['name'] ?? '');
|
||||
$www = htmlspecialchars($_POST['www'] ?? '');
|
||||
$post = htmlspecialchars($_POST['post'] ?? '');
|
||||
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
|
||||
$timestamp = date(rplc('%dateFormat%'));
|
||||
$formCaptchaSum = sha1($_POST['captcha']);
|
||||
$showmail = $_POST['showmail'];
|
||||
$formCaptchaSum = sha1($_POST['captcha'] ?? '');
|
||||
$showmail = $_POST['showmail'] ?? '';
|
||||
$checkedshowmailfalse = $showmail == 'false' ? ' checked="checked"' : '';
|
||||
$checkedshowmailtrue = empty($showmail) ? ' checked="checked"' : ($showmail == 'true' ? ' checked="checked"' : '');
|
||||
if ($showmail == 'true') {
|
||||
$email = htmlspecialchars($_POST['email']);
|
||||
$email = htmlspecialchars($_POST['email'] ?? '');
|
||||
} else {
|
||||
$hemail = htmlspecialchars($_POST['email']);
|
||||
$hemail = htmlspecialchars($_POST['email'] ?? '');
|
||||
}
|
||||
$formCaptchaSumPre = $_POST['captchasum'];
|
||||
$formCaptchaSumPre = $_POST['captchasum'] ?? '';
|
||||
$captcha = random_int(0, 9) . random_int(0, 9) . random_int(0, 9) . random_int(0, 9);
|
||||
$_SESSION['captcha'] = $captcha;
|
||||
$captchasum = sha1($captcha);
|
||||
@@ -126,7 +130,7 @@ EOT;
|
||||
}
|
||||
}
|
||||
if (file_exists($file . 'c' . $sbnum)) {
|
||||
$comments = preg_replace('#<ip>([^<]+)</ip>#D', '', preg_replace('#<hemail>([^<]+)</hemail>#D', '', file_get_contents($file . 'c' . $sbnum)));
|
||||
$comments = preg_replace('(<ip>([^<]+)</ip>)', '', preg_replace('(<hemail>([^<]+)</hemail>)', '', file_get_contents($file . 'c' . $sbnum)));
|
||||
} else {
|
||||
$comments = '';
|
||||
}
|
||||
|
||||
84
mainkrk.php
84
mainkrk.php
@@ -1,3 +1,7 @@
|
||||
<?php
|
||||
$lang = empty($_GET['lang']) ? 'cs' : $_GET['lang'];
|
||||
$page = $_GET['page'] ?? '';
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
@@ -41,9 +45,9 @@ pageTracker._trackPageview();
|
||||
});
|
||||
|
||||
</script>
|
||||
<script type=\"text/javascript\">
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
if ($_REQUEST['lang'] == 'en') {
|
||||
if ($lang == 'en') {
|
||||
?>
|
||||
hs.lang = {
|
||||
cssDirection: 'ltr',
|
||||
@@ -71,7 +75,7 @@ hs.lang = {
|
||||
restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.'
|
||||
};
|
||||
<?php
|
||||
} elseif ($_REQUEST['lang'] == 'de') {
|
||||
} elseif ($lang == 'de') {
|
||||
?>
|
||||
hs.lang = {
|
||||
loadingText : 'Lade...',
|
||||
@@ -133,59 +137,59 @@ hs.lang = {
|
||||
<div class="header"><span class="title"><?php include './pages/title_krk.php'; ?></span><br><span class="slogan"><?php include './pages/slogan.php'; ?></span>
|
||||
<?php
|
||||
echo '<span class="floatright">';
|
||||
if (file_exists("pages/$_REQUEST[page]-de.php") || file_exists("pages/$_REQUEST[page]/$_REQUEST[page]-de.php")) {
|
||||
if (file_exists("pages/$_REQUEST[page]/$_REQUEST[page]-de.php")) {
|
||||
if (file_exists("pages/$page-de.php") || file_exists("pages/$page/$page-de.php")) {
|
||||
if (file_exists("pages/$page/$page-de.php")) {
|
||||
$lngc = 'de';
|
||||
$icona = "<a href=\"mainkrk.php?page=$_REQUEST[page]/$_REQUEST[page]&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
$icona = "<a href=\"mainkrk.php?page=$page/$page&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
} else {
|
||||
$lngc = 'de';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($_REQUEST['page']) . "&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($page) . "&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
}
|
||||
|
||||
if ($_REQUEST[lang] == 'de') {
|
||||
if ($lang == 'de') {
|
||||
echo '';
|
||||
} else {
|
||||
echo $icona;
|
||||
}
|
||||
}
|
||||
if (file_exists('pages/' . htmlspecialchars($_REQUEST['page']) . '-en.php') || file_exists('pages/' . htmlspecialchars($_REQUEST['page']) . '/' . htmlspecialchars($_REQUEST['page']) . '-en.php')) {
|
||||
if (file_exists('pages/' . htmlspecialchars($_REQUEST['page']) . '/' . htmlspecialchars($_REQUEST['page']) . '-en.php')) {
|
||||
if (file_exists('pages/' . htmlspecialchars($page) . '-en.php') || file_exists('pages/' . htmlspecialchars($page) . '/' . htmlspecialchars($page) . '-en.php')) {
|
||||
if (file_exists('pages/' . htmlspecialchars($page) . '/' . htmlspecialchars($page) . '-en.php')) {
|
||||
$lngc = 'en';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($_REQUEST['page']) . '/' . htmlspecialchars($_REQUEST['page']) . "&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($page) . '/' . htmlspecialchars($page) . "&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
} else {
|
||||
$lngc = 'en';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($_REQUEST['page']) . "&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($page) . "&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
}
|
||||
if ($_REQUEST[lang] == 'en') {
|
||||
if ($lang == 'en') {
|
||||
echo '';
|
||||
} else {
|
||||
echo $icona;
|
||||
}
|
||||
} elseif (!isset($_REQUEST['page']) && file_exists('pages/krk_default-en.php')) {
|
||||
} elseif ($page === '' && file_exists('pages/krk_default-en.php')) {
|
||||
$lngc = 'en';
|
||||
$icona = "<a href=\"mainkrk.php?page=krk_default&lang=$lngc\"><img src=\"/images/" . $lngc . 'f.png" alt=""></a>';
|
||||
if ($_REQUEST[lang] == 'en') {
|
||||
if ($lang == 'en') {
|
||||
echo '';
|
||||
} else {
|
||||
echo $icona;
|
||||
}
|
||||
}
|
||||
if (file_exists('pages/' . htmlspecialchars($_REQUEST['page']) . '.php') || file_exists('pages/' . htmlspecialchars($_REQUEST['page']) . '/' . htmlspecialchars($_REQUEST['page']) . '.php')) {
|
||||
if (file_exists('pages/' . htmlspecialchars($_REQUEST['page']) . '/' . htmlspecialchars($_REQUEST['page']) . '.php')) {
|
||||
if (file_exists('pages/' . htmlspecialchars($page) . '.php') || file_exists('pages/' . htmlspecialchars($page) . '/' . htmlspecialchars($page) . '.php')) {
|
||||
if (file_exists('pages/' . htmlspecialchars($page) . '/' . htmlspecialchars($page) . '.php')) {
|
||||
$lngc = '';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($_REQUEST['page']) . '/' . htmlspecialchars($_REQUEST['page']) . $lngc . '"><img src="/images/' . $lngc . 'f.png" alt=""></a>';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($page) . '/' . htmlspecialchars($page) . $lngc . '"><img src="/images/' . $lngc . 'f.png" alt=""></a>';
|
||||
} else {
|
||||
$lngc = '';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($_REQUEST['page']) . $lngc . '"><img src="/images/' . $lngc . 'f.png" alt=""></a>';
|
||||
$icona = '<a href="mainkrk.php?page=' . htmlspecialchars($page) . $lngc . '"><img src="/images/' . $lngc . 'f.png" alt=""></a>';
|
||||
}
|
||||
|
||||
if ($_REQUEST[lang] == 'cs' || empty($_REQUEST[lang])) {
|
||||
if ($lang == 'cs') {
|
||||
echo '';
|
||||
} else {
|
||||
echo $icona;
|
||||
}
|
||||
}
|
||||
if ($_REQUEST[lang] == 'en' && empty($_REQUEST['page'])) {
|
||||
if ($lang == 'en' && empty($page)) {
|
||||
$lngc = '';
|
||||
$icona = '<a href="mainkrk.php?page=krk_default"><img src="/images/' . $lngc . 'f.png" alt=""></a>';
|
||||
echo $icona;
|
||||
@@ -195,9 +199,9 @@ echo '</span>';
|
||||
</div>
|
||||
<div class="top-menu">
|
||||
<?php
|
||||
if (empty($_REQUEST[lang]) || $_REQUEST[lang] == 'cs') {
|
||||
if ($lang === 'cs') {
|
||||
include './pages/krk_topmenu.php';
|
||||
} elseif ($_REQUEST[lang] == 'en' && file_exists('./pages/krk_topmenu-en.php')) {
|
||||
} elseif ($lang === 'en' && file_exists('./pages/krk_topmenu-en.php')) {
|
||||
include './pages/krk_topmenu-en.php';
|
||||
}
|
||||
?>
|
||||
@@ -205,14 +209,14 @@ if (empty($_REQUEST[lang]) || $_REQUEST[lang] == 'cs') {
|
||||
<div class="sidebar"><div class="sidebar-content">
|
||||
<ul>
|
||||
<?php
|
||||
if (preg_match('/mcr_2009/D', htmlspecialchars($_REQUEST['page'])) && $_REQUEST[lang] == 'en') {
|
||||
if (str_contains($page, 'mcr_2009') && $lang === 'en') {
|
||||
include './pages/mcr_2009/menumcr_2009-en.php';
|
||||
} elseif (preg_match('/mcr_2009/D', htmlspecialchars($_REQUEST['page'])) && $_REQUEST[lang] == 'de') {
|
||||
} elseif (str_contains($page, 'mcr_2009') && $lang === 'de') {
|
||||
include './pages/mcr_2009/menumcr_2009-de.php';
|
||||
} elseif (preg_match('/mcr_2009/D', htmlspecialchars($_REQUEST['page']))) {
|
||||
} elseif (str_contains($page, 'mcr_2009')) {
|
||||
include './pages/mcr_2009/menumcr_2009.php';
|
||||
} else {
|
||||
if (empty($_REQUEST[lang]) || $_REQUEST[lang] == 'cs') {
|
||||
if ($lang === 'cs') {
|
||||
include './pages/menukrk.php';
|
||||
} else {
|
||||
include './pages/menukrk-en.php';
|
||||
@@ -222,32 +226,32 @@ if (preg_match('/mcr_2009/D', htmlspecialchars($_REQUEST['page'])) && $_REQUEST[
|
||||
</ul><br><br><br>
|
||||
</div></div><div class="main"><div class="main-content">
|
||||
<?php
|
||||
$escaped_page = str_replace([')', '(', '\\', '"', "\'", ';', '{', '}', '$', '[', ']', '<', '>'], '', htmlspecialchars($_REQUEST['page']));
|
||||
if (htmlspecialchars($_REQUEST['page'])) {
|
||||
if ($_GET[lang]) {
|
||||
$jazycek = '-' . $_GET[lang];
|
||||
$escaped_page = str_replace([')', '(', '\\', '"', "\'", ';', '{', '}', '$', '[', ']', '<', '>'], '', htmlspecialchars($page));
|
||||
if ($page !== '') {
|
||||
if ($lang !== 'cs') {
|
||||
$jazycek = '-' . $lang;
|
||||
} else {
|
||||
$jazycek = '';
|
||||
}
|
||||
if (htmlspecialchars($_REQUEST['page']) == 'mcr_2009') {
|
||||
if ($page == 'mcr_2009') {
|
||||
include "./pages/mcr_2009/mcr_2009$jazycek.php";
|
||||
} elseif (htmlspecialchars($_REQUEST['page']) == 'clanky') {
|
||||
} elseif ($page == 'clanky') {
|
||||
include "./pages/clanky/clanky$jazycek.php";
|
||||
} elseif (htmlspecialchars($_REQUEST['page']) == 'akce_ob') {
|
||||
} elseif ($page == 'akce_ob') {
|
||||
include "./pages/akce_ob/akce_ob$jazycek.php";
|
||||
} elseif (htmlspecialchars($_REQUEST['page']) == 'akce_litvinov') {
|
||||
} elseif ($page == 'akce_litvinov') {
|
||||
include "./pages/akce_litvinov/akce_litvinov$jazycek.php";
|
||||
} elseif (htmlspecialchars($_REQUEST['page']) == 'ski_krusnohori') {
|
||||
} elseif ($page == 'ski_krusnohori') {
|
||||
include './pages/ski_krusnohori/ski_krusnohori' . $jazycek . '.php';
|
||||
} elseif (empty($_REQUEST[lang]) && file_exists("pages/$escaped_page.php")) {
|
||||
} elseif ($lang === 'cs' && file_exists("pages/$escaped_page.php")) {
|
||||
include "./pages/$escaped_page.php";
|
||||
} elseif (file_exists("pages/$escaped_page-$_REQUEST[lang].php")) {
|
||||
include "./pages/$escaped_page-$_REQUEST[lang].php";
|
||||
} elseif (file_exists("pages/$escaped_page-$lang.php")) {
|
||||
include "./pages/$escaped_page-$lang.php";
|
||||
} else {
|
||||
include __DIR__ . '/pages/404.php';
|
||||
}
|
||||
} else {
|
||||
if (empty($_GET['lang']) || $_GET['lang'] == 'cs') {
|
||||
if ($lang === 'cs') {
|
||||
include './pages/krk_default.php';
|
||||
} else {
|
||||
include './pages/krk_default-en.php';
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
¦<a href="http://www.caes.cz" target="_blank">Web ČAES</a>
|
||||
¦<a href="/krk/?page=krk_vnitro" target="_blank">Info pro členy KRK</a>
|
||||
¦<a href="pages/stanovy_krk.pdf" target="_blank">Stanovy KRK</a>
|
||||
¦<a href="/krk/print.php?page=<?php echo htmlspecialchars($_REQUEST['page']); ?>" target="_blank">Verze pro tisk</a>
|
||||
¦<a href="/krk/print.php?page=<?php echo htmlspecialchars($page); ?>" target="_blank">Verze pro tisk</a>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<table border="1" cellspacing="1" cellpadding="1" style="width:100%;" class="c9" bordercolor="#C0C0C0">
|
||||
<table border="1" cellspacing="1" cellpadding="1" style="width:100%;" class="c9" bordercolor="#C0C0C0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:21%;">
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
<table class="table-no-border" id="ziel3">
|
||||
<tr><td colspan="2"><h6>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.</h6></td></tr>
|
||||
<tr><td><img src="pages/mcr_2009/EU-Logo_rgb.jpg" height="45" width="361"></td><td><img src="pages/mcr_2009/ziel-small.jpg" class="margin-05"></td></tr>
|
||||
|
||||
30
print.php
30
print.php
@@ -1,3 +1,7 @@
|
||||
<?php
|
||||
$lang = empty($_GET['lang']) ? 'cs' : $_GET['lang'];
|
||||
$page = $_GET['page'] ?? '';
|
||||
?>
|
||||
<!doctype html public "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
@@ -18,29 +22,29 @@ pageTracker._trackPageview();
|
||||
<body><!-- onload="window.print()"-->
|
||||
<div class="main">
|
||||
<?php
|
||||
$escaped_page = str_replace([')', '(', '\\', '"', "\'", ';', '{', '}', '$', '[', ']', '<', '>'], '', $_REQUEST[page]);
|
||||
if ($_REQUEST[page]) {
|
||||
if ($_REQUEST[page] == 'cestopisy') {
|
||||
$escaped_page = str_replace([')', '(', '\\', '"', "\'", ';', '{', '}', '$', '[', ']', '<', '>'], '', $page);
|
||||
if ($page) {
|
||||
if ($page == 'cestopisy') {
|
||||
include './pages/cestopisy/cestopisy.php';
|
||||
} elseif ($_REQUEST[page] == 'clanky') {
|
||||
} elseif ($page == 'clanky') {
|
||||
include './pages/clanky/clanky.php';
|
||||
} elseif ($_REQUEST[page] == 'akce_ob') {
|
||||
} elseif ($page == 'akce_ob') {
|
||||
include './pages/akce_ob/akce_ob.php';
|
||||
} elseif ($_REQUEST[page] == 'akce_litvinov') {
|
||||
} elseif ($page == 'akce_litvinov') {
|
||||
include './pages/akce_litvinov/akce_litvinov.php';
|
||||
} elseif ($_REQUEST[page] == 'ski_krusnohori') {
|
||||
} elseif ($page == 'ski_krusnohori') {
|
||||
include './pages/ski_krusnohori/ski_krusnohori.php';
|
||||
} elseif ($_REQUEST[page] == 'zakonceni_2008') {
|
||||
} elseif ($page == 'zakonceni_2008') {
|
||||
include './pages/zakonceni_2008/zakonceni_2008.php';
|
||||
} elseif (empty($_REQUEST[lang]) && file_exists("pages/$escaped_page.php")) {
|
||||
} elseif ($LANG === 'cs' && file_exists("pages/$escaped_page.php")) {
|
||||
include "./pages/$escaped_page.php";
|
||||
} elseif (file_exists("pages/$escaped_page-$_REQUEST[lang].php")) {
|
||||
include "./pages/$escaped_page-$_REQUEST[lang].php";
|
||||
} elseif (file_exists("pages/$escaped_page-$lang.php")) {
|
||||
include "./pages/$escaped_page-$lang.php";
|
||||
} else {
|
||||
include '../pages/404.php';
|
||||
}
|
||||
} else {
|
||||
if (empty($_GET['lang']) || $_GET['lang'] == 'cs') {
|
||||
if ($lang === 'cs') {
|
||||
include './pages/krk_default.php';
|
||||
} else {
|
||||
include './pages/krk_default-en.php';
|
||||
@@ -49,4 +53,4 @@ if ($_REQUEST[page]) {
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user