Changeset 92 for trunk/Application/Core.php
- Timestamp:
- Apr 7, 2020, 11:53:58 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Core.php
r84 r92 2 2 3 3 $ConfigFileName = dirname(__FILE__).'/../Config/Config.php'; 4 if (file_exists($ConfigFileName)) include_once($ConfigFileName);4 if (file_exists($ConfigFileName)) include_once($ConfigFileName); 5 5 6 6 include_once(dirname(__FILE__).'/../Global.php'); … … 24 24 $this->ShowPage = true; 25 25 $this->BaseURL = $_SERVER['SCRIPT_NAME']; 26 if (substr($this->BaseURL, -10, 10) == '/index.php')26 if (substr($this->BaseURL, -10, 10) == '/index.php') 27 27 $this->BaseURL = substr($this->BaseURL, 0, -10); 28 28 } … … 32 32 global $Config, $DatabaseRevision, $WithoutSessionStart; 33 33 34 if ($this->UseSession) session_start();34 if ($this->UseSession) session_start(); 35 35 36 36 $ErrorHandler = new ErrorHandler(); … … 50 50 51 51 // SQL injection hack protection 52 foreach ($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);53 foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);52 foreach ($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item); 53 foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item); 54 54 55 55 $this->Config = &$Config; … … 58 58 $this->Setup = new Setup($this); 59 59 $this->Setup->Start(); 60 if ($this->Setup->CheckState())60 if ($this->Setup->CheckState()) 61 61 { 62 62 $this->ModuleManager->Start(); … … 67 67 { 68 68 $this->RunCommon(); 69 if ($this->ShowPage)69 if ($this->ShowPage) 70 70 { 71 71 $this->PathItems = ProcessURL(); … … 80 80 /* @var $Page Page */ 81 81 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); 82 if ($ClassName != '')82 if ($ClassName != '') 83 83 { 84 84 $Page = new $ClassName($this); … … 91 91 function RegisterPage($Path, $Handler) 92 92 { 93 if (is_array($Path))93 if (is_array($Path)) 94 94 { 95 95 $Page = &$this->Pages; 96 96 $LastKey = array_pop($Path); 97 foreach ($Path as $PathItem)97 foreach ($Path as $PathItem) 98 98 { 99 99 $Page = &$Page[$PathItem]; 100 100 } 101 if (!is_array($Page)) $Page = array('' => $Page);101 if (!is_array($Page)) $Page = array('' => $Page); 102 102 $Page[$LastKey] = $Handler; 103 103 } else $this->Pages[$Path] = $Handler; … … 111 111 function SearchPage($PathItems, $Pages) 112 112 { 113 if (count($PathItems) > 0) $PathItem = $PathItems[0];113 if (count($PathItems) > 0) $PathItem = $PathItems[0]; 114 114 else $PathItem = ''; 115 if (array_key_exists($PathItem, $Pages))115 if (array_key_exists($PathItem, $Pages)) 116 116 { 117 if (is_array($Pages[$PathItem]))117 if (is_array($Pages[$PathItem])) 118 118 { 119 119 array_shift($PathItems); 120 return ($this->SearchPage($PathItems, $Pages[$PathItem]));121 } else return ($Pages[$PathItem]);122 } else return ('');120 return $this->SearchPage($PathItems, $Pages[$PathItem]); 121 } else return $Pages[$PathItem]; 122 } else return ''; 123 123 } 124 124 125 125 function Link($Target) 126 126 { 127 return ($this->BaseURL.$Target);127 return $this->BaseURL.$Target; 128 128 } 129 129 } … … 141 141 { 142 142 Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); 143 return ('<h3 align="center">'.T('Required page not found'));143 return '<h3 align="center">'.T('Required page not found'); 144 144 } 145 145 }
Note:
See TracChangeset
for help on using the changeset viewer.