Modernize code from krk-litvinov.cz
This commit is contained in:
@@ -8,12 +8,12 @@ function stringEndsWith($string, $end) {
|
|||||||
}
|
}
|
||||||
session_start();
|
session_start();
|
||||||
$included = true;
|
$included = true;
|
||||||
$locale = 'cs';
|
$lang = 'cs';
|
||||||
$url = $_SERVER['REQUEST_URI'];
|
$url = $_SERVER['REQUEST_URI'] ?? '';
|
||||||
$root = '/2012-prosinec/';
|
$root = '/2012-prosinec/';
|
||||||
$uri = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $root) + strlen($root));
|
$uri = substr($url, strpos($url, $root) + strlen($root));
|
||||||
if ($uri == '') {
|
if ($uri == '') {
|
||||||
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $locale . '/');
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $lang . '/');
|
||||||
exit;
|
exit;
|
||||||
} elseif (preg_match('/^([a-z]{2})\\/(.+)(\\?.*)?$/', $uri, $matches)) {
|
} elseif (preg_match('/^([a-z]{2})\\/(.+)(\\?.*)?$/', $uri, $matches)) {
|
||||||
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
||||||
@@ -26,19 +26,23 @@ if ($uri == '') {
|
|||||||
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
||||||
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
||||||
} else {
|
} else {
|
||||||
$_GET['error'] = 404;
|
$_GET['page'] = 'error/404';
|
||||||
|
}
|
||||||
|
if (!in_array($lang, ['cs', 'de'], true)) {
|
||||||
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/cs/' . ($_GET['page'] ?? ''));
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$page = htmlspecialchars($_GET['page']);
|
$page = htmlspecialchars($_GET['page']);
|
||||||
$pretitle = '3. Česko-německý skirogaining';
|
$pretitle = '3. Česko-německý skirogaining';
|
||||||
$mainMail = 'tojnar@gmail.com';
|
$mainMail = 'tojnar@gmail.com';
|
||||||
include $lang . '.php';
|
require $lang . '.php';
|
||||||
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
||||||
$CMS['%root%'] = rtrim($root, '/');
|
$CMS['%root%'] = rtrim($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'] ?? 'n/a';
|
||||||
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
||||||
function rplc($string) {
|
function rplc($string) {
|
||||||
global $CMS;
|
global $CMS;
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ function stringEndsWith($string, $end) {
|
|||||||
}
|
}
|
||||||
session_start();
|
session_start();
|
||||||
$included = true;
|
$included = true;
|
||||||
$locale = 'cs';
|
$lang = 'cs';
|
||||||
$url = $_SERVER['REQUEST_URI'];
|
$url = $_SERVER['REQUEST_URI'] ?? '';
|
||||||
$root = '/2014/';
|
$root = '/2014/';
|
||||||
$uri = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $root) + strlen($root));
|
$uri = substr($url, strpos($url, $root) + strlen($root));
|
||||||
if ($uri == '') {
|
if ($uri == '') {
|
||||||
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $locale . '/');
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $lang . '/');
|
||||||
exit;
|
exit;
|
||||||
} elseif (preg_match('/^([a-z]{2})(?:\\/(.+)(\\?.*)?)?$/', $uri, $matches)) {
|
} elseif (preg_match('/^([a-z]{2})(?:\\/(.+)(\\?.*)?)?$/', $uri, $matches)) {
|
||||||
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
||||||
@@ -26,19 +26,23 @@ if ($uri == '') {
|
|||||||
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
||||||
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
||||||
} else {
|
} else {
|
||||||
$_GET['error'] = 404;
|
$_GET['page'] = 'error/404';
|
||||||
|
}
|
||||||
|
if (!in_array($lang, ['cs', 'en'], true)) {
|
||||||
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/en/' . ($_GET['page'] ?? ''));
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$page = htmlspecialchars($_GET['page']);
|
$page = htmlspecialchars($_GET['page']);
|
||||||
$pretitle = '4. přeshraniční skirogaining';
|
$pretitle = '4. přeshraniční skirogaining';
|
||||||
$mainMail = 'tojnar@gmail.com';
|
$mainMail = 'tojnar@gmail.com';
|
||||||
include $lang . '.php';
|
require $lang . '.php';
|
||||||
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
||||||
$CMS['%root%'] = rtrim($root, '/');
|
$CMS['%root%'] = rtrim($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'] ?? 'n/a';
|
||||||
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
||||||
function rplc($string) {
|
function rplc($string) {
|
||||||
global $CMS;
|
global $CMS;
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ function stringEndsWith($string, $end) {
|
|||||||
}
|
}
|
||||||
session_start();
|
session_start();
|
||||||
$included = true;
|
$included = true;
|
||||||
$locale = 'cs';
|
$lang = 'cs';
|
||||||
$url = $_SERVER['REQUEST_URI'];
|
$url = $_SERVER['REQUEST_URI'] ?? '';
|
||||||
$root = '/2015-prosinec/';
|
$root = '/2015-prosinec/';
|
||||||
$uri = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $root) + strlen($root));
|
$uri = substr($url, strpos($url, $root) + strlen($root));
|
||||||
if ($uri == '') {
|
if ($uri == '') {
|
||||||
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $locale . '/');
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $lang . '/');
|
||||||
exit;
|
exit;
|
||||||
} elseif (preg_match('/^([a-z]{2})(?:\\/(.+)(\\?.*)?)?$/', $uri, $matches)) {
|
} elseif (preg_match('/^([a-z]{2})(?:\\/(.+)(\\?.*)?)?$/', $uri, $matches)) {
|
||||||
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
||||||
@@ -26,19 +26,23 @@ if ($uri == '') {
|
|||||||
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
||||||
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
||||||
} else {
|
} else {
|
||||||
$_GET['error'] = 404;
|
$_GET['page'] = 'error/404';
|
||||||
|
}
|
||||||
|
if (!in_array($lang, ['cs', 'en'], true)) {
|
||||||
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/en/' . ($_GET['page'] ?? ''));
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$page = htmlspecialchars($_GET['page']);
|
$page = htmlspecialchars($_GET['page']);
|
||||||
$pretitle = '6. přeshraniční skirogaining';
|
$pretitle = '6. přeshraniční skirogaining';
|
||||||
$mainMail = 'tojnar@gmail.com';
|
$mainMail = 'tojnar@gmail.com';
|
||||||
include $lang . '.php';
|
require $lang . '.php';
|
||||||
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
||||||
$CMS['%root%'] = rtrim($root, '/');
|
$CMS['%root%'] = rtrim($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'] ?? 'n/a';
|
||||||
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
||||||
function rplc($string) {
|
function rplc($string) {
|
||||||
global $CMS;
|
global $CMS;
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ function stringEndsWith($string, $end) {
|
|||||||
}
|
}
|
||||||
session_start();
|
session_start();
|
||||||
$included = true;
|
$included = true;
|
||||||
$locale = 'cs';
|
$lang = 'cs';
|
||||||
$url = $_SERVER['REQUEST_URI'];
|
$url = $_SERVER['REQUEST_URI'] ?? '';
|
||||||
$root = '/2015/';
|
$root = '/2015/';
|
||||||
$uri = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $root) + strlen($root));
|
$uri = substr($url, strpos($url, $root) + strlen($root));
|
||||||
if ($uri == '') {
|
if ($uri == '') {
|
||||||
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $locale . '/');
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . $root . $lang . '/');
|
||||||
exit;
|
exit;
|
||||||
} elseif (preg_match('/^([a-z]{2})(?:\\/(.+)(\\?.*)?)?$/', $uri, $matches)) {
|
} elseif (preg_match('/^([a-z]{2})(?:\\/(.+)(\\?.*)?)?$/', $uri, $matches)) {
|
||||||
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
||||||
@@ -26,19 +26,23 @@ if ($uri == '') {
|
|||||||
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
$lang = htmlspecialchars(substr($matches[1], 0, 2));
|
||||||
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
$_GET['page'] = (isset($matches[2]) ? $matches[2] . '/' : '') . 'main';
|
||||||
} else {
|
} else {
|
||||||
$_GET['error'] = 404;
|
$_GET['page'] = 'error/404';
|
||||||
|
}
|
||||||
|
if (!in_array($lang, ['cs', 'de', 'en'], true)) {
|
||||||
|
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/en/' . ($_GET['page'] ?? ''));
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$page = htmlspecialchars($_GET['page']);
|
$page = htmlspecialchars($_GET['page']);
|
||||||
$pretitle = '5. přeshraniční skirogaining';
|
$pretitle = '5. přeshraniční skirogaining';
|
||||||
$mainMail = 'tojnar@gmail.com';
|
$mainMail = 'tojnar@gmail.com';
|
||||||
include $lang . '.php';
|
require $lang . '.php';
|
||||||
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
$CMS['%url%'] = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($url);
|
||||||
$CMS['%root%'] = rtrim($root, '/');
|
$CMS['%root%'] = rtrim($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'] ?? 'n/a';
|
||||||
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
$CMS['%dateFormat%'] = 'd.m.Y H:i';
|
||||||
function rplc($string) {
|
function rplc($string) {
|
||||||
global $CMS;
|
global $CMS;
|
||||||
|
|||||||
Reference in New Issue
Block a user