Ignore:
Timestamp:
Apr 14, 2020, 11:13:32 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Core.php

    r3 r7  
    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__).'/../Packages/Common/Common.php');
     
    3131    $this->BaseURL = $_SERVER['SCRIPT_NAME'];
    3232    $BaseScriptName = '/index.php';
    33     if(substr($this->BaseURL, -strlen($BaseScriptName), strlen($BaseScriptName)) == $BaseScriptName)
     33    if (substr($this->BaseURL, -strlen($BaseScriptName), strlen($BaseScriptName)) == $BaseScriptName)
    3434      $this->BaseURL = substr($this->BaseURL, 0, -strlen($BaseScriptName));
    3535    $this->FormManager = new FormManager($this->Database);
     
    4848    $this->Config = &$Config;
    4949
    50     if(isset($this->Config['Database']))
     50    if (isset($this->Config['Database']))
    5151    {
    5252      $this->Database->Connect($Config['Database']['Host'], $Config['Database']['User'],
     
    5959
    6060    // SQL injection hack protection
    61     foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
    62     foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
     61    foreach ($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
     62    foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    6363
    6464    $this->RegisterPageBar('Top');
     
    6868    $this->Setup = new Setup($this);
    6969    $this->Setup->Start();
    70     if($this->Setup->CheckState())
     70    if ($this->Setup->CheckState())
    7171    {
    7272      $this->ModuleManager->Start();
     
    7777  {
    7878    $this->RunCommon();
    79     if($this->ShowPage)
     79    if ($this->ShowPage)
    8080    {
    8181      $this->PathItems = ProcessURL();
     
    9090    /* @var $Page Page */
    9191    $ClassName = $this->SearchPage($this->PathItems, $this->Pages);
    92     if($ClassName != '')
     92    if ($ClassName != '')
    9393    {
    9494      $Page = new $ClassName($this);
     
    101101  function RegisterPage($Path, $Handler)
    102102  {
    103     if(is_array($Path))
     103    if (is_array($Path))
    104104    {
    105105      $Page = &$this->Pages;
    106106      $LastKey = array_pop($Path);
    107       foreach($Path as $PathItem)
     107      foreach ($Path as $PathItem)
    108108      {
    109109        $Page = &$Page[$PathItem];
    110110      }
    111       if(!is_array($Page)) $Page = array('' => $Page);
     111      if (!is_array($Page)) $Page = array('' => $Page);
    112112      $Page[$LastKey] = $Handler;
    113113    } else $this->Pages[$Path] = $Handler;
     
    136136  function SearchPage($PathItems, $Pages)
    137137  {
    138     if(count($PathItems) > 0) $PathItem = $PathItems[0];
     138    if (count($PathItems) > 0) $PathItem = $PathItems[0];
    139139      else $PathItem = '';
    140     if(array_key_exists($PathItem, $Pages))
     140    if (array_key_exists($PathItem, $Pages))
    141141    {
    142       if(is_array($Pages[$PathItem]))
     142      if (is_array($Pages[$PathItem]))
    143143      {
    144144        array_shift($PathItems);
    145         return($this->SearchPage($PathItems, $Pages[$PathItem]));
    146       } else return($Pages[$PathItem]);
    147     } else return('');
     145        return $this->SearchPage($PathItems, $Pages[$PathItem]);
     146      } else return $Pages[$PathItem];
     147    } else return '';
    148148  }
    149149
    150150  function Link($Target)
    151151  {
    152     return($this->BaseURL.$Target);
     152    return $this->BaseURL.$Target;
    153153  }
    154154}
     
    166166  {
    167167    Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
    168     return('<h3 align="center">'.T('Required page not found').'</h3>');
     168    return '<h3 align="center">'.T('Required page not found').'</h3>';
    169169  }
    170170}
Note: See TracChangeset for help on using the changeset viewer.