Changeset 507 for trunk/includes/global.php
- Timestamp:
- Feb 15, 2013, 10:12:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/global.php
r506 r507 1 1 <?php 2 2 3 $ScriptStartTime = GetMicrotime();4 5 if(isset($_SERVER['REMOTE_ADDR'])) session_start();6 7 // SQL injection hack protection8 foreach($_POST as $Index => $Item)9 {10 if(is_array($_POST[$Index]))11 foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2);12 else $_POST[$Index] = addslashes($_POST[$Index]);13 }14 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);15 16 if(file_exists(dirname(__FILE__).'/config.php')) include_once(dirname(__FILE__).'/config.php');17 else die('Nenalezen konfigurační soubor config.php ve složce includes. '.18 'Vytvořte jej zkopírováním vzoru config.sample.php.');19 date_default_timezone_set($Config['Web']['Timezone']);20 3 include_once(dirname(__FILE__).'/Database.php'); 4 include_once(dirname(__FILE__).'/system.php'); 5 include_once(dirname(__FILE__).'/Update.php'); 21 6 include_once(dirname(__FILE__).'/rss.php'); 22 include_once(dirname(__FILE__).'/system.php');23 7 include_once(dirname(__FILE__).'/user.php'); 24 8 include_once(dirname(__FILE__).'/Page.php'); 25 26 $System = new System();27 $System->Init();28 $User = new User($System);29 30 9 include_once(dirname(__FILE__).'/error.php'); 31 10 32 $TranslationTree = GetTranslationTree(); 33 34 LogReferrer(); 11 GlobalInit(); 12 13 function GlobalInit() 14 { 15 global $System, $ScriptStartTime, $TranslationTree, $User, $StopAfterUpdateManager, 16 $UpdateManager, $Config; 17 18 $ScriptStartTime = GetMicrotime(); 19 20 if(isset($_SERVER['REMOTE_ADDR'])) session_start(); 21 22 if(file_exists(dirname(__FILE__).'/config.php')) include_once(dirname(__FILE__).'/config.php'); 23 else die('Nenalezen konfigurační soubor config.php ve složce includes. '. 24 'Vytvořte jej zkopírováním vzoru config.sample.php.'); 25 date_default_timezone_set($Config['Web']['Timezone']); 26 27 $Revision = 506; // Subversion revision 28 $ReleaseTime = '2013-02-15'; 29 30 $System = new System(); 31 $System->Init(); 32 33 // Check database persistence structure 34 $UpdateManager = new UpdateManager(); 35 $UpdateManager->Database = $System->Database; 36 $UpdateManager->Revision = $Revision; 37 if(isset($StopAfterUpdateManager)) return; 38 if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze.'); 39 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze.'); 40 41 // SQL injection hack protection 42 foreach($_POST as $Index => $Item) 43 { 44 if(is_array($_POST[$Index])) 45 foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2); 46 else $_POST[$Index] = addslashes($_POST[$Index]); 47 } 48 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 49 50 $User = new User($System); 51 52 set_error_handler('CustomErrorHandler'); 53 54 // TODO: Global initialized variable should be removed 55 $TranslationTree = GetTranslationTree(); 56 57 LogReferrer(); 58 } 35 59 36 60 $RSSChannels = array( … … 298 322 } 299 323 300 function MysqlDateTimeToTime($Time)301 {302 $Parts = explode(' ', $Time);303 $DateParts = explode('-', $Parts[0]);304 $TimeParts = explode(':', $Parts[1]);305 $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]);306 return($Result);307 }308 309 324 function GetLanguageList() 310 325 { … … 429 444 430 445 if(array_key_exists('language', $_GET)) $LanguageId = $_GET['language'] * 1; 431 else $LanguageId = 1;446 else $LanguageId = 2; 432 447 433 448 if(isset($LanguageList[$LanguageId]) == false)
Note:
See TracChangeset
for help on using the changeset viewer.