Changeset 545 for trunk/includes
- Timestamp:
- Jun 18, 2013, 6:07:52 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 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/Page.php
r542 r545 1 1 <?php 2 3 function ShowShoutbox()4 {5 global $System, $Config, $User, $System;6 7 $Output = '<strong><a href="'.$System->Link('/action.php?action=ShoutBoxView').'">Kecátko:</a></strong>';8 if($User->Licence(LICENCE_USER))9 $Output .= ' <a href="'.$System->Link('/action.php?action=shoutbox').'">Vložit</a>';10 $Output .= '<div class="box"><table>';11 $DbResult = $System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30');12 while($Line = $DbResult->fetch_assoc())13 $Output .= '<tr><td><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</td></tr>';14 $Output .= '</table></div>';15 return($Output);16 }17 2 18 3 function ShowTopBar() … … 340 325 } 341 326 327 class Page 328 { 329 var $System; 330 var $Database; 331 332 function __construct($System) 333 { 334 $this->System = &$System; 335 $this->Database = &$System->Database; 336 } 337 338 function Show() 339 { 340 return(''); 341 } 342 343 function GetOutput() 344 { 345 $Output = $this->Show(); 346 $Output = ShowPage($Output); 347 return($Output); 348 } 349 } 350 342 351 ?> -
trunk/includes/Version.php
r543 r545 1 1 <?php 2 2 3 $Revision = 54 3; // Subversion revision3 $Revision = 545; // Subversion revision 4 4 $DatabaseRevision = 543; // Database structure revision 5 $ReleaseTime = '2013-06-1 7';5 $ReleaseTime = '2013-06-18'; 6 6 7 7 ?> -
trunk/includes/global.php
r538 r545 11 11 include_once(dirname(__FILE__).'/config.php'); 12 12 include_once(dirname(__FILE__).'/Version.php'); 13 include_once(dirname(__FILE__).'/AppModule.php'); 14 15 // Include application modules 16 // TODO: Make modules configurable 17 include_once(dirname(__FILE__).'/../Modules/AoWoW/AoWoW.php'); 18 include_once(dirname(__FILE__).'/../Modules/Referrer/Referrer.php'); 19 include_once(dirname(__FILE__).'/../Modules/FrontPage/FrontPage.php'); 13 20 14 21 GlobalInit(); … … 52 59 // TODO: Global initialized variable should be removed 53 60 $TranslationTree = GetTranslationTree(); 54 55 LogReferrer(); 61 62 // Initialize application modules 63 $System->ModuleManager->RegisterModule(new AoWoW($System)); 64 $System->ModuleManager->RegisterModule(new Referrer($System)); 65 $System->ModuleManager->Modules['Referrer']->Excluded[] = $System->Config['Web']['Host']; 66 $System->ModuleManager->RegisterModule(new FrontPage($System)); 67 $System->ModuleManager->StartAll(); 56 68 } 57 69 … … 633 645 if($Session) $_SESSION[$Name] = $Result; 634 646 return($Result); 635 }636 637 function LogReferrer()638 {639 global $System;640 641 if(array_key_exists('HTTP_REFERER', $_SERVER))642 {643 $Referrer = addslashes($_SERVER['HTTP_REFERER']);644 $HostName = substr($Referrer, strpos($Referrer, '/') + 2);645 $HostName = substr($HostName, 0, strpos($HostName, '/'));646 if($HostName != $System->Config['Web']['Host'])647 {648 $DbResult = $System->Database->query('SELECT `Id` FROM `Referrer` WHERE `Web` = "'.$HostName.'"');649 if($DbResult->num_rows > 0)650 {651 $DbRow = $DbResult->fetch_assoc();652 $System->Database->query('UPDATE `Referrer` SET `Hits` = `Hits` + 1, `DateLast` = NOW(), `LastURL` = "'.addslashes($Referrer).'" WHERE `Id` = '.$DbRow['Id']);653 } else $System->Database->query('INSERT INTO `Referrer` (`Web`, `DateFirst`, `DateLast`, `LastURL`, `Hits`) VALUES ("'.$HostName.'", NOW(), NOW( ), "'.addslashes($Referrer).'", 1)');654 }655 }656 647 } 657 648 … … 744 735 } 745 736 737 function ProcessURL() 738 { 739 if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 740 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 741 else $PathString = ''; 742 if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 743 $PathItems = explode('/', $PathString); 744 if(strpos($_SERVER['REQUEST_URI'], '?') !== false) 745 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 746 else $_SERVER['QUERY_STRING'] = ''; 747 parse_str($_SERVER['QUERY_STRING'], $_GET); 748 return($PathItems); 749 } 750 746 751 ?> -
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.