Changeset 501 for trunk/Common/Global.php
- Timestamp:
- Mar 10, 2013, 8:15:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Global.php
r500 r501 21 21 include_once(dirname(__FILE__).'/User.php'); 22 22 include_once(dirname(__FILE__).'/Page.php'); 23 include_once(dirname(__FILE__).'/Forms.php'); 24 include_once(dirname(__FILE__).'/Types/Type.php'); 23 include_once(dirname(__FILE__).'/Form/Form.php'); 25 24 include_once(dirname(__FILE__).'/File.php'); 26 25 include_once(dirname(__FILE__).'/../aktuality/news.php'); 27 26 include_once(dirname(__FILE__).'/../finance/bills.php'); 28 27 include_once(dirname(__FILE__).'/../finance/finance.php'); 28 include_once(dirname(__FILE__).'/../form_classes.php'); 29 29 30 30 31 // Application modules … … 57 58 parent::__construct(); 58 59 $this->Modules = array(); 59 $this->Type = new Type($this);60 60 $this->Pages = array(); 61 61 $this->ModuleManager = new AppModuleManager(); 62 62 $this->FilesDir = ''; 63 $this->Database = new Database(); 64 $this->FormManager = new FormManager($this->Database); 63 65 } 64 66 … … 101 103 function AddModule($Module) 102 104 { 103 global $Database;104 105 105 //echo('Přidávám modul '.get_class($Module).'<br />'); 106 106 $Module->System = &$this; 107 $Module->Database = &$ Database;107 $Module->Database = &$this->Database; 108 108 $this->Modules[get_class($Module)] = $Module; 109 109 } … … 166 166 167 167 if(!isset($Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/install.php">zde</a>.'); 168 169 168 170 169 // SQL injection hack protection … … 174 173 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 175 174 176 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); 177 $Database->Prefix = $Config['Database']['Prefix']; 178 $Database->charset($Config['Database']['Charset']); 179 $Database->ShowSQLError = $Config['Web']['ShowSQLError']; 180 $Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery']; 175 $System = new System(); 176 $System->Config = $Config; 177 $System->FilesDir = dirname(__FILE__).'/../'.$Config['Web']['UploadFileFolder'].'/'; 178 $System->Database->Connect($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); 179 $System->Database->Prefix = $Config['Database']['Prefix']; 180 $System->Database->charset($Config['Database']['Charset']); 181 $System->Database->ShowSQLError = $Config['Web']['ShowSQLError']; 182 $System->Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery']; 181 183 182 184 // Check database persistence structure 183 185 $UpdateManager = new UpdateManager(); 184 $UpdateManager->Database = &$ Database;186 $UpdateManager->Database = &$System->Database; 185 187 $UpdateManager->Revision = $DatabaseRevision; 186 188 if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze.'); 187 189 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.'); 188 190 189 $System = new System(); 190 $System->Config = $Config; 191 $System->FilesDir = dirname(__FILE__).'/../'.$Config['Web']['UploadFileFolder'].'/'; 192 $System->Database = &$Database; 191 // Init old modules 193 192 $System->AddModule(new Log()); 194 193 $System->AddModule(new ErrorHandler()); 194 $System->Modules['ErrorHandler']->ShowErrors = $Config['Web']['ShowPHPError']; 195 195 $System->Modules['ErrorHandler']->Init(); 196 196 $System->AddModule(new User()); … … 200 200 $System->AddModule(new Finance()); 201 201 $System->Modules['Finance']->LoadMonthParameters(0); 202 RegisterFormClasses($System->FormManager); 202 203 203 204 // Register new modules
Note:
See TracChangeset
for help on using the changeset viewer.