Ignore:
Timestamp:
Jun 18, 2013, 6:07:52 PM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Prvotní podpora pro modulární systém.
  • Přidáno: Podpora pro používání pěkných URL.
  • Upraveno: Vstupní stránka se generuje z modulu FrontPage.
  • Upraveno: Stránka banners převedena na modul Referrer.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        55.project
        66.buildpath
         7Query.log
  • trunk/includes/global.php

    r538 r545  
    1111  include_once(dirname(__FILE__).'/config.php');
    1212include_once(dirname(__FILE__).'/Version.php');
     13include_once(dirname(__FILE__).'/AppModule.php');
     14
     15// Include application modules
     16// TODO: Make modules configurable
     17include_once(dirname(__FILE__).'/../Modules/AoWoW/AoWoW.php');
     18include_once(dirname(__FILE__).'/../Modules/Referrer/Referrer.php');
     19include_once(dirname(__FILE__).'/../Modules/FrontPage/FrontPage.php');
    1320
    1421GlobalInit();
     
    5259  // TODO: Global initialized variable should be removed
    5360  $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();
    5668}
    5769
     
    633645  if($Session) $_SESSION[$Name] = $Result;
    634646  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   }
    656647}
    657648
     
    744735}
    745736
     737function 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
    746751?>
Note: See TracChangeset for help on using the changeset viewer.