Changeset 521 for trunk/Common/Global.php
- Timestamp:
- Apr 14, 2013, 9:04:17 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Global.php
r518 r521 22 22 include_once(dirname(__FILE__).'/Page.php'); 23 23 include_once(dirname(__FILE__).'/Form/Form.php'); 24 include_once(dirname(__FILE__).'/../finance/bills.php');25 include_once(dirname(__FILE__).'/../finance/finance.php');26 24 include_once(dirname(__FILE__).'/../form_classes.php'); 27 25 … … 70 68 function RegisterPage($Path, $Handler) 71 69 { 72 $this->Pages[$Path] = $Handler; 70 if(is_array($Path)) 71 { 72 $Page = &$this->Pages; 73 $LastKey = array_pop($Path); 74 foreach($Path as $PathItem) 75 { 76 $Page = &$Page[$PathItem]; 77 } 78 if(!is_array($Page)) $Page = array('' => $Page); 79 $Page[$LastKey] = $Handler; 80 } else $this->Pages[$Path] = $Handler; 73 81 } 74 82 75 83 function SearchPage($PathItems, $Pages) 76 84 { 77 $PathItem = $PathItems[0]; 85 if(count($PathItems) > 0) $PathItem = $PathItems[0]; 86 else $PathItem = ''; 78 87 if(array_key_exists($PathItem, $Pages)) 79 88 { … … 86 95 } 87 96 97 function PageNotFound() 98 { 99 return('Page '.implode('/', $this->PathItems).' not found.'); 100 } 101 88 102 function ShowPage() 89 103 { … … 96 110 $Page->Database = &$this->Database; 97 111 $Page->GetOutput(); 98 } else echo( 'Page '.implode('/', $this->PathItems).' not found.');112 } else echo($this->PageNotFound()); 99 113 } 100 114
Note:
See TracChangeset
for help on using the changeset viewer.