Changeset 55 for trunk/index.php
- Timestamp:
- Apr 7, 2020, 12:55:39 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r54 r55 16 16 require_once('Modules/Event/EventPage.php'); 17 17 18 if (isset($_SERVER['REMOTE_ADDR'])) session_start();18 if (isset($_SERVER['REMOTE_ADDR'])) session_start(); 19 19 20 20 class ApplicationTanec extends Application … … 40 40 function IsAdmin() 41 41 { 42 return (array_key_exists('IsAdmin', $_SESSION) and ($_SESSION['IsAdmin'] == 1));42 return array_key_exists('IsAdmin', $_SESSION) and ($_SESSION['IsAdmin'] == 1); 43 43 } 44 44 45 45 function Link($URL) 46 46 { 47 return ($this->Config['BaseURL'].$URL);47 return $this->Config['BaseURL'].$URL; 48 48 } 49 49 50 50 function AbsoluteLink($URL) 51 51 { 52 return ($this->Config['HostName'].$this->Config['BaseURL'].$URL);52 return $this->Config['HostName'].$this->Config['BaseURL'].$URL; 53 53 } 54 54 … … 56 56 { 57 57 $Output = '<div>'; 58 foreach ($this->MainMenu as $MenuItem)58 foreach ($this->MainMenu as $MenuItem) 59 59 { 60 60 $Output .= '<a href="'.$this->Link($MenuItem['Link']).'">'.$MenuItem['Title'].'</a> '; 61 61 } 62 62 $Output .= '</div>'; 63 return ($Output);63 return $Output; 64 64 } 65 65 66 66 function ProcessURL() 67 67 { 68 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))68 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 69 69 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 70 70 else $PathString = ''; 71 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);71 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 72 72 $PathItems = explode('/', $PathString); 73 if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))73 if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false)) 74 74 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 75 75 else $_SERVER['QUERY_STRING'] = ''; 76 76 parse_str($_SERVER['QUERY_STRING'], $_GET); 77 return ($PathItems);77 return $PathItems; 78 78 } 79 79 80 80 function RegisterPage($Path, $Handler) 81 81 { 82 if (is_array($Path))82 if (is_array($Path)) 83 83 { 84 84 $Page = &$this->Pages; 85 85 $LastKey = array_pop($Path); 86 foreach ($Path as $PathItem)86 foreach ($Path as $PathItem) 87 87 { 88 88 $Page = &$Page[$PathItem]; 89 89 } 90 if (!is_array($Page)) $Page = array('' => $Page);90 if (!is_array($Page)) $Page = array('' => $Page); 91 91 $Page[$LastKey] = $Handler; 92 92 } else $this->Pages[$Path] = $Handler; … … 115 115 function SearchPage($PathItems, $Pages) 116 116 { 117 if (count($PathItems) > 0) $PathItem = $PathItems[0];117 if (count($PathItems) > 0) $PathItem = $PathItems[0]; 118 118 else $PathItem = ''; 119 if (array_key_exists($PathItem, $Pages))120 { 121 if (is_array($Pages[$PathItem]))119 if (array_key_exists($PathItem, $Pages)) 120 { 121 if (is_array($Pages[$PathItem])) 122 122 { 123 123 array_shift($PathItems); 124 return ($this->SearchPage($PathItems, $Pages[$PathItem]));125 } else return ($Pages[$PathItem]);126 } else return ('');124 return $this->SearchPage($PathItems, $Pages[$PathItem]); 125 } else return $Pages[$PathItem]; 126 } else return ''; 127 127 } 128 128 129 129 function PageNotFound() 130 130 { 131 return ('Page '.implode('/', $this->PathItems).' not found.');131 return 'Page '.implode('/', $this->PathItems).' not found.'; 132 132 } 133 133 … … 138 138 /* @var $Page Page */ 139 139 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); 140 if ($ClassName != '')140 if ($ClassName != '') 141 141 { 142 142 $Page = new $ClassName($this); … … 150 150 { 151 151 $this->RunCommon(); 152 if ($this->ShowPage)152 if ($this->ShowPage) 153 153 { 154 154 $this->PathItems = ProcessURL(); … … 191 191 { 192 192 Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); 193 return ('<h3 align="center">Požadovaná stránka neexistuje.</h3>');193 return '<h3 align="center">Požadovaná stránka neexistuje.</h3>'; 194 194 } 195 195 } … … 208 208 'Disallow: /*?'."\n". 209 209 'Sitemap: '.$this->System->AbsoluteLink('/sitemap.xml'); 210 return ($Result);210 return $Result; 211 211 } 212 212 } … … 259 259 260 260 $Result .= '</urlset>'; 261 return ($Result);261 return $Result; 262 262 } 263 263 }
Note:
See TracChangeset
for help on using the changeset viewer.