1 | <?php
|
---|
2 |
|
---|
3 | include('Include.php');
|
---|
4 | if(array_key_exists('argv', $_SERVER))
|
---|
5 | $_GET = array_merge($_GET, ParseCommandLineArgs($_SERVER['argv']));
|
---|
6 |
|
---|
7 | // SQL injection hack protection
|
---|
8 | foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
|
---|
9 | foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
|
---|
10 |
|
---|
11 | if(isset($_SERVER['REMOTE_ADDR'])) session_start();
|
---|
12 |
|
---|
13 | $System = new System();
|
---|
14 | $ScriptTimeStart = $System->GetMicrotime();
|
---|
15 | $System->Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);
|
---|
16 | $System->Database->Prefix = $Config['Database']['Prefix'];
|
---|
17 | $System->Database->charset($Config['Database']['Charset']);
|
---|
18 | $System->Config = $Config;
|
---|
19 | $System->AddModule(new Log($System));
|
---|
20 | $System->AddModule(new User($System));
|
---|
21 | if(isset($_SERVER['REMOTE_ADDR'])) $System->Modules['User']->Check();
|
---|
22 | else $System->Modules['User']->User['Id'] = $Config['Web']['UserConsoleId'];
|
---|
23 |
|
---|
24 | if(array_key_exists('Module', $_GET)) $Module = $_GET['Module'];
|
---|
25 | else $Module = 'HomePage';
|
---|
26 | if(array_key_exists('Action', $_GET)) $Action = $_GET['Action'];
|
---|
27 | else $Action = 'Show';
|
---|
28 |
|
---|
29 | $ControllerName = $Module.'Controller';
|
---|
30 | if(class_exists($ControllerName))
|
---|
31 | {
|
---|
32 | $Controller = new $ControllerName($System);
|
---|
33 | if(method_exists($Controller, $Action)) $Output = $Controller->$Action();
|
---|
34 | else $Output = 'Metoda '.$Action.' modulu '.$Module.' neexistuje.';
|
---|
35 | } else $Output = 'Třída '.$ControllerName.' neexistuje.';
|
---|
36 |
|
---|
37 | echo($Output);
|
---|
38 |
|
---|
39 | ?>
|
---|