2022-01-14 03:26:59 +01:00
|
|
|
<?php
|
|
|
|
|
function stringEndsWith($string, $end) {
|
2022-01-14 03:30:26 +01:00
|
|
|
if (strlen($end) == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return substr($string, -strlen($end)) == $end;
|
2022-01-14 03:26:59 +01:00
|
|
|
}
|
|
|
|
|
session_start();
|
2022-01-14 03:30:26 +01:00
|
|
|
$included = true;
|
2022-01-14 03:59:38 +01:00
|
|
|
$lang = 'cs';
|
|
|
|
|
$url = $_SERVER['REQUEST_URI'] ?? '';
|
2022-01-14 03:30:26 +01:00
|
|
|
$root = '/2015/';
|
2022-01-14 03:59:38 +01:00
|
|
|
$uri = substr($url, strpos($url, $root) + strlen($root));
|
2022-01-14 03:30:26 +01:00
|
|
|
if ($uri == '') {
|
2022-01-14 03:59:38 +01:00
|
|
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $lang . '/');
|
2022-01-14 03:30:26 +01:00
|
|
|
exit;
|
|
|
|
|
} elseif (preg_match('/^([a-z]{2})(?:\\/(.+)(\\?.*)?)?$/', $uri, $matches)) {
|
|
|
|
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
|
|
|
|
if (stringEndsWith($matches[2], 'main')) {
|
|
|
|
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $lang . '/' . substr($matches[2], 0, -4));
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$_GET['page'] = $matches[2];
|
|
|
|
|
} elseif (preg_match('/^([a-z]{2})\\/(?:(.*)\\/)?$/', $uri, $matches)) {
|
|
|
|
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
|
|
|
|
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
|
|
|
|
} else {
|
2022-01-14 03:59:38 +01:00
|
|
|
$_GET['page'] = 'error/404';
|
|
|
|
|
}
|
|
|
|
|
if (!in_array($lang, ['cs', 'de', 'en'], true)) {
|
|
|
|
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/en/' . ($_GET['page'] ?? ''));
|
|
|
|
|
exit;
|
2022-01-14 03:26:59 +01:00
|
|
|
}
|
2022-01-14 03:30:26 +01:00
|
|
|
$page = htmlspecialchars($_GET['page']);
|
|
|
|
|
$pretitle = '5. přeshraniční skirogaining';
|
|
|
|
|
$mainMail = 'tojnar@gmail.com';
|
2022-01-14 03:59:38 +01:00
|
|
|
require $lang . '.php';
|
2022-01-14 03:30:26 +01:00
|
|
|
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
|
|
|
|
$CMS['%root%'] = rtrim($root, '/');
|
|
|
|
|
$CMS['%lang%'] = $lang;
|
|
|
|
|
$CMS['%unknownAuthor%'] = 'Jan Tojnar';
|
|
|
|
|
$CMS['%headerLinkHref%'] = rplc('%root%/') . $lang;
|
|
|
|
|
$CMS['%pretitle%'] = $pretitle;
|
2022-01-14 03:59:38 +01:00
|
|
|
$CMS['%comefrom%'] = $_SERVER['HTTP_REFERER'] ?? 'n/a';
|
2022-01-14 03:30:26 +01:00
|
|
|
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
|
|
|
|
function rplc($string) {
|
|
|
|
|
global $CMS;
|
|
|
|
|
|
|
|
|
|
return str_replace(array_keys($CMS), $CMS, $string);
|
2022-01-14 03:26:59 +01:00
|
|
|
}
|
|
|
|
|
require __DIR__ . '/../sboard.php';
|
|
|
|
|
require __DIR__ . '/../load.lib.php';
|
|
|
|
|
readPage($page);
|
2022-01-14 03:30:26 +01:00
|
|
|
$CMS['%releasedate%'] = toDate($date);
|
|
|
|
|
$CMS['%releasetime%'] = toTime($date);
|
|
|
|
|
if (isReleased($date) == false) {
|
|
|
|
|
$notreleased = true;
|
|
|
|
|
} else {
|
|
|
|
|
$notreleased = false;
|
2022-01-14 03:26:59 +01:00
|
|
|
}
|
2022-01-14 03:30:26 +01:00
|
|
|
if ($notreleased == true) {
|
|
|
|
|
readPage('error/notreleased');
|
2022-01-14 03:26:59 +01:00
|
|
|
}
|
2022-01-14 03:30:26 +01:00
|
|
|
$CMS['%title%'] = $title;
|
|
|
|
|
$CMS['%titleTag%'] = str_replace(['%pretitle%', '%title%'], [$pretitle, $title], rplc('%longTitle%'));
|
|
|
|
|
$CMS['%langPanel%'] = $langPanel;
|
|
|
|
|
$CMS['%article%'] = $article;
|
|
|
|
|
$CMS['%menu%'] = $menu;
|
|
|
|
|
if (!empty($author) and !empty($date)) {
|
|
|
|
|
$aInfo = str_replace(['%author%', '%date%', '%time%'], [author($author), toDate($date), toTime($date)], rplc('%by%'));
|
|
|
|
|
} elseif (!empty($author)) {
|
|
|
|
|
$aInfo = str_replace('%author%', author($author), rplc('%byAuthor%'));
|
|
|
|
|
} elseif (!empty($date)) {
|
|
|
|
|
$aInfo = str_replace(['%date%', '%time%'], [toDate($date), toTime($date)], rplc('%byDate%'));
|
|
|
|
|
} else {
|
|
|
|
|
$aInfo = '';
|
2022-01-14 03:26:59 +01:00
|
|
|
}
|
|
|
|
|
//var_dump(date(rplc("%dateFormat%"),filemtime($realPage)));
|
2022-01-14 03:30:26 +01:00
|
|
|
$CMS['%author%'] = $author;
|
|
|
|
|
$CMS['%ainfo%'] = $aInfo;
|
2022-01-14 03:26:59 +01:00
|
|
|
?>
|
|
|
|
|
<?php
|
|
|
|
|
ob_start(/*"ob_gzhandler"*/);
|
2022-01-14 03:30:26 +01:00
|
|
|
include 'template.html';
|
|
|
|
|
$buffer = ob_get_clean();
|
|
|
|
|
echo rplc(rplc($buffer));
|
2022-01-14 03:26:59 +01:00
|
|
|
?>
|