Ignore:
Timestamp:
Apr 7, 2020, 11:53:58 AM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Core.php

    r84 r92  
    22
    33$ConfigFileName = dirname(__FILE__).'/../Config/Config.php';
    4 if(file_exists($ConfigFileName)) include_once($ConfigFileName);
     4if (file_exists($ConfigFileName)) include_once($ConfigFileName);
    55
    66include_once(dirname(__FILE__).'/../Global.php');
     
    2424    $this->ShowPage = true;
    2525    $this->BaseURL = $_SERVER['SCRIPT_NAME'];
    26     if(substr($this->BaseURL, -10, 10) == '/index.php')
     26    if (substr($this->BaseURL, -10, 10) == '/index.php')
    2727      $this->BaseURL = substr($this->BaseURL, 0, -10);
    2828  }
     
    3232    global $Config, $DatabaseRevision, $WithoutSessionStart;
    3333
    34     if($this->UseSession) session_start();
     34    if ($this->UseSession) session_start();
    3535
    3636    $ErrorHandler = new ErrorHandler();
     
    5050
    5151    // SQL injection hack protection
    52     foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
    53     foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
     52    foreach ($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
     53    foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    5454
    5555    $this->Config = &$Config;
     
    5858    $this->Setup = new Setup($this);
    5959    $this->Setup->Start();
    60     if($this->Setup->CheckState())
     60    if ($this->Setup->CheckState())
    6161    {
    6262      $this->ModuleManager->Start();
     
    6767  {
    6868    $this->RunCommon();
    69     if($this->ShowPage)
     69    if ($this->ShowPage)
    7070    {
    7171      $this->PathItems = ProcessURL();
     
    8080    /* @var $Page Page */
    8181    $ClassName = $this->SearchPage($this->PathItems, $this->Pages);
    82     if($ClassName != '')
     82    if ($ClassName != '')
    8383    {
    8484      $Page = new $ClassName($this);
     
    9191  function RegisterPage($Path, $Handler)
    9292  {
    93     if(is_array($Path))
     93    if (is_array($Path))
    9494    {
    9595      $Page = &$this->Pages;
    9696      $LastKey = array_pop($Path);
    97       foreach($Path as $PathItem)
     97      foreach ($Path as $PathItem)
    9898      {
    9999        $Page = &$Page[$PathItem];
    100100      }
    101       if(!is_array($Page)) $Page = array('' => $Page);
     101      if (!is_array($Page)) $Page = array('' => $Page);
    102102      $Page[$LastKey] = $Handler;
    103103    } else $this->Pages[$Path] = $Handler;
     
    111111  function SearchPage($PathItems, $Pages)
    112112  {
    113     if(count($PathItems) > 0) $PathItem = $PathItems[0];
     113    if (count($PathItems) > 0) $PathItem = $PathItems[0];
    114114      else $PathItem = '';
    115     if(array_key_exists($PathItem, $Pages))
     115    if (array_key_exists($PathItem, $Pages))
    116116    {
    117       if(is_array($Pages[$PathItem]))
     117      if (is_array($Pages[$PathItem]))
    118118      {
    119119        array_shift($PathItems);
    120         return($this->SearchPage($PathItems, $Pages[$PathItem]));
    121       } else return($Pages[$PathItem]);
    122     } else return('');
     120        return $this->SearchPage($PathItems, $Pages[$PathItem]);
     121      } else return $Pages[$PathItem];
     122    } else return '';
    123123  }
    124124
    125125  function Link($Target)
    126126  {
    127     return($this->BaseURL.$Target);
     127    return $this->BaseURL.$Target;
    128128  }
    129129}
     
    141141  {
    142142    Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
    143     return('<h3 align="center">'.T('Required page not found'));
     143    return '<h3 align="center">'.T('Required page not found');
    144144  }
    145145}
Note: See TracChangeset for help on using the changeset viewer.