first commit
This commit is contained in:
57
admin/launch.php
Normal file
57
admin/launch.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
$script = '';
|
||||
if (isset($_GET['s'])) {
|
||||
$script = $_GET['s'];
|
||||
|
||||
// odstraneni relativnich adres
|
||||
$script = preg_replace('@^(\\.{0,2}/)+@', '', $script);
|
||||
$script = preg_replace('@\\.{1,2}/@', '', $script);
|
||||
|
||||
// odstraneni HTTP ze zacatku
|
||||
$script = preg_replace('@^(http|ftp|https|mms)://@', '', $script);
|
||||
|
||||
// kdyz se nejedna o soubor php
|
||||
if (!preg_match('@.+\\.php$@', $script)) {
|
||||
$script = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($script == '') {
|
||||
$script = 'main.php';
|
||||
}
|
||||
|
||||
$classPath = $script;
|
||||
|
||||
function loadScript($file)
|
||||
{
|
||||
global $cfg, $dbcfg, $ctrl;
|
||||
|
||||
$fqcn = require_once $file;
|
||||
|
||||
if (is_string($fqcn)) {
|
||||
$instance = new $fqcn();
|
||||
$instance->run();
|
||||
} elseif (!empty($main_class)) {
|
||||
$instance = new $main_class();
|
||||
$instance->run();
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists($classPath)) {
|
||||
$classPath = loadBundlesAdmin($script);
|
||||
|
||||
if (!file_exists($classPath)) {
|
||||
$classPath = $cfg['Path']['shared_version'].'admin/'.$script;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($classPath)) {
|
||||
loadScript($classPath);
|
||||
} else {
|
||||
// zalogovat chybu
|
||||
logError(__FILE__, __LINE__, 'LAUNCH.PHP INCLUDE ERROR s='.$_GET['s']);
|
||||
|
||||
$classPath = $cfg['Path']['shared_version'].'admin/main.php';
|
||||
loadScript($classPath);
|
||||
}
|
||||
Reference in New Issue
Block a user