Changeset 545 for trunk/includes/system.php
- Timestamp:
- Jun 18, 2013, 6:07:52 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 5 5 .project 6 6 .buildpath 7 Query.log
-
- Property svn:ignore
-
trunk/includes/system.php
r542 r545 21 21 var $Database; 22 22 var $Config; 23 var $ModuleManager; 24 var $PathItems; 23 25 24 26 function __construct() … … 40 42 $this->Database->ShowSQLError = $this->Config['Web']['ShowSQLError']; 41 43 $this->Database->LogSQLQuery = $this->Config['Web']['LogSQLQuery']; 44 $this->ModuleManager = new AppModuleManager(); 42 45 } 43 46 … … 50 53 function Link($Target) 51 54 { 52 global $Config; 53 54 return($Config['Web']['BaseURL'].$Target); 55 return($this->Config['Web']['BaseURL'].$Target); 55 56 } 57 58 function RegisterPage($Path, $Handler) 59 { 60 if(is_array($Path)) 61 { 62 $Page = &$this->Pages; 63 $LastKey = array_pop($Path); 64 foreach($Path as $PathItem) 65 { 66 $Page = &$Page[$PathItem]; 67 } 68 if(!is_array($Page)) $Page = array('' => $Page); 69 $Page[$LastKey] = $Handler; 70 } else $this->Pages[$Path] = $Handler; 71 } 72 73 function SearchPage($PathItems, $Pages) 74 { 75 if(count($PathItems) > 0) $PathItem = $PathItems[0]; 76 else $PathItem = ''; 77 if(array_key_exists($PathItem, $Pages)) 78 { 79 if(is_array($Pages[$PathItem])) 80 { 81 array_shift($PathItems); 82 return($this->SearchPage($PathItems, $Pages[$PathItem])); 83 } else return($Pages[$PathItem]); 84 } else return(''); 85 } 86 87 function PageNotFound() 88 { 89 return('Page '.implode('/', $this->PathItems).' not found.'); 90 } 91 92 function ShowPage() 93 { 94 /* @var $Page Page */ 95 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); 96 if($ClassName != '') 97 { 98 $Page = new $ClassName($this); 99 $Page->GetOutput(); 100 } else echo($this->PageNotFound()); 101 } 56 102 } 57 58 ?>
Note:
See TracChangeset
for help on using the changeset viewer.