1 | <?php
|
---|
2 |
|
---|
3 | include_once(dirname(__FILE__).'/Base/System.php');
|
---|
4 | include_once(dirname(__FILE__).'/Base/User.php');
|
---|
5 | include_once(dirname(__FILE__).'/Base/UserOnline.php');
|
---|
6 | include_once(dirname(__FILE__).'/Base/HTTP.php');
|
---|
7 | include_once(dirname(__FILE__).'/Base/PrefixMultiplier.php');
|
---|
8 | include_once(dirname(__FILE__).'/Base/URL.php');
|
---|
9 | include_once(dirname(__FILE__).'/Base/HTML/HTML.php');
|
---|
10 | include_once(dirname(__FILE__).'/Base/Types/Type.php');
|
---|
11 | $ConfigFile = dirname(__FILE__).'/Configuration/Config.php';
|
---|
12 | if(file_exists($ConfigFile)) include($ConfigFile);
|
---|
13 | else die('Missing configuration file "'.$ConfigFile.'"');
|
---|
14 | include_once(dirname(__FILE__).'/CustomOutput.php');
|
---|
15 |
|
---|
16 | include_once(dirname(__FILE__).'/Module/Main/Controller.php');
|
---|
17 | include_once(dirname(__FILE__).'/Module/Network/Controller.php');
|
---|
18 |
|
---|
19 | class MyApplication extends Application
|
---|
20 | {
|
---|
21 | var $User;
|
---|
22 | var $UserOnline;
|
---|
23 | var $HTTP;
|
---|
24 | var $HTML;
|
---|
25 | var $Output;
|
---|
26 | var $PrefixMultiplier;
|
---|
27 | var $BaseURL;
|
---|
28 | var $Type;
|
---|
29 |
|
---|
30 | function __construct()
|
---|
31 | {
|
---|
32 | parent::__construct();
|
---|
33 |
|
---|
34 | $this->HTTP = new HTTP($this);
|
---|
35 | $this->User = new User($this);
|
---|
36 | $this->UserOnline = new UserOnline($this);
|
---|
37 | $this->PrefixMultiplier = new PrefixMultiplier();
|
---|
38 | $this->Output = new CustomOutput($this);
|
---|
39 | $this->HTML = new HTML($this);
|
---|
40 | $this->BaseURL = new URL();
|
---|
41 |
|
---|
42 | $this->BaseURL->Scheme = 'http';
|
---|
43 | $this->BaseURL->Host = $_SERVER['SERVER_NAME'];
|
---|
44 | $this->BaseURL->Path = $_SERVER['REQUEST_URI'];
|
---|
45 | //echo($this->BaseURL->GetString());
|
---|
46 | $this->Type = new Type($this);
|
---|
47 | /*$this->Type->RegisterType('YesNo', 'Enumeration', array('Yes', 'No'));
|
---|
48 | $this->Type->RegisterType('NoYes', 'Enumeration', array('No', 'Yes'));
|
---|
49 | $this->Type->RegisterType('TaskState', 'Enumeration', array('Waiting', 'Running', 'Finished'));
|
---|
50 | $this->Type->RegisterType('OnlineState', 'Enumeration', array('Offline', 'Online'));
|
---|
51 | $this->Type->RegisterType('EventType', 'Enumeration', array('Information', 'Warning', 'Critical'));
|
---|
52 | $this->Type->RegisterType('PointerToCompany', 'PointerOneToOne', array('Table' => 'Company', 'Id' => 'Id', 'Name' => 'Name'));
|
---|
53 | $this->Type->RegisterType('PointerToAddress', 'PointerOneToOne', array('Table' => 'Address', 'Id' => 'Id', 'Name' => 'CONCAT(Street, ", ", City)'));
|
---|
54 | $this->Type->RegisterType('PointerToControlCard', 'PointerOneToOne', array('Table' => 'ControlCard', 'Id' => 'Id', 'Name' => 'Name'));
|
---|
55 | $this->Type->RegisterType('PointerToLiftEventCode', 'PointerOneToOne', array('Table' => 'LiftEventCode', 'Id' => 'Id', 'Name' => 'Name'));
|
---|
56 | $this->Type->RegisterType('PointerToLiftGroup', 'PointerOneToOne', array('Table' => 'LiftGroup', 'Id' => 'Id', 'Name' => 'Name'));
|
---|
57 | $this->Type->RegisterType('PointerToLift', 'PointerOneToOne', array('Table' => 'Lift', 'Id' => 'Id', 'Name' => 'Name'));
|
---|
58 | */
|
---|
59 | }
|
---|
60 |
|
---|
61 | function Run()
|
---|
62 | {
|
---|
63 | parent::Run();
|
---|
64 | $this->UserOnline->Update();
|
---|
65 | $this->User->Id = $this->UserOnline->User;
|
---|
66 | $this->User->LoadData();
|
---|
67 | if(!array_key_exists('M', $_GET)) $_GET['M'] = 'Main';
|
---|
68 | $ModuleName = $_GET['M'];
|
---|
69 | $ModuleName .= 'Controller';
|
---|
70 | if(class_exists($ModuleName))
|
---|
71 | {
|
---|
72 | $Module = new $ModuleName($this);
|
---|
73 | if(array_key_exists('Panel', $_GET)) echo($Module->Show());
|
---|
74 | else $this->Output->Show($Module->Show());
|
---|
75 | } else
|
---|
76 | throw new Exception('Module not found');
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | $Application = new MyApplication();
|
---|
81 | $Application->Database->HostName = $Config['Database']['HostName'];
|
---|
82 | $Application->Database->UserName = $Config['Database']['UserName'];
|
---|
83 | $Application->Database->Password = $Config['Database']['Password'];
|
---|
84 | $Application->Database->Schema = $Config['Database']['Schema'];
|
---|
85 | $Application->Database->ShowSQLError = $Config['Database']['ShowError'];
|
---|
86 | $Application->Database->ShowSQLQuery = $Config['Database']['ShowQuery'];
|
---|
87 | $Application->Output->Style = $Config['Web']['Style'];
|
---|
88 | $Application->Output->Charset = $Config['Web']['Charset'];
|
---|
89 | $Application->Output->FormatHTML = $Config['Web']['FormatHTML'];
|
---|
90 | $Application->Output->Admin = $Config['Web']['Admin'];
|
---|
91 | $Application->Output->AdminEmail = $Config['Web']['AdminEmail'];
|
---|
92 | $Application->Output->ShowRuntimeInfo = $Config['Web']['ShowRuntimeInfo'];
|
---|
93 | $Application->Output->GlobalTitle = $Config['Web']['Title'];
|
---|
94 | $Application->Localization->Locale = $Config['Web']['Locale'];
|
---|
95 | $Application->Run();
|
---|
96 |
|
---|
97 | ?>
|
---|