Ignore:
Timestamp:
Oct 18, 2013, 11:35:13 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Nová třída pro správu konfigurace bude prozatím pokusně řešena souběžně se starou konfigurací.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/System.php

    r581 r582  
    2626    $this->FormManager = new FormManager($this->Database);
    2727    $this->ShowPage = true;
     28    $this->ConfigManager = new Config();
    2829  } 
    2930 
     
    9697  function Run()
    9798  {
    98         global $Config, $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type,
    99       $DatabaseRevision;
     99        global $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type,
     100      $DatabaseRevision, $Config;
    100101 
    101102    date_default_timezone_set('Europe/Prague');
     
    103104    $ScriptTimeStart = GetMicrotime();
    104105 
    105     if(!isset($Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/">zde</a>.');
    106    
    107106    // SQL injection hack protection
    108107    foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
     
    111110    if(isset($_SERVER['REMOTE_ADDR'])) session_start();
    112111
    113     // TODO: unset general global variable $Config after setting is loaded to objects
     112    $ConfigFileName = dirname(__FILE__).'/../config.php';     
     113    if(file_exists($ConfigFileName))
     114      $this->ConfigManager->LoadFromFile($ConfigFileName);
     115    //$this->Config = $this->ConfigManager->GetAsArray();
    114116    $this->Config = &$Config;
    115     $this->Database->Connect($Config['Database']['Host'], $Config['Database']['User'],
    116       $Config['Database']['Password'], $Config['Database']['Database']);
    117     $this->Database->Prefix = $Config['Database']['Prefix'];
    118     $this->Database->charset($Config['Database']['Charset']);
    119     $this->Database->ShowSQLError = $Config['Web']['ShowSQLError'];
    120     $this->Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery'];
    121     $this->RootURLFolder = $Config['Web']['RootFolder'];
    122     $this->FormManager->Root = $Config['Web']['RootFolder'];
     117   
     118    $this->Database->Connect($this->Config['Database']['Host'], $this->Config['Database']['User'],
     119      $this->Config['Database']['Password'], $this->Config['Database']['Database']);
     120    $this->Database->Prefix = $this->Config['Database']['Prefix'];
     121    $this->Database->charset($this->Config['Database']['Charset']);
     122    $this->Database->ShowSQLError = $this->Config['Web']['ShowSQLError'];
     123    $this->Database->ShowSQLQuery = $this->Config['Web']['ShowSQLQuery'];
     124    $this->RootURLFolder = $this->Config['Web']['RootFolder'];
     125    $this->FormManager->Root = $this->Config['Web']['RootFolder'];
    123126 
    124127    // Check database persistence structure
     
    133136 
    134137    // Register and start existing modules
    135     //include_once(dirname(__FILE__).'/../Modules/Setup/Setup.php');
    136     //$this->ModuleManager->RegisterModule(new ModuleSetup($this));
    137     //$this->ModuleManager->Modules['Setup']->Start();
     138    include_once(dirname(__FILE__).'/../Modules/Setup/Setup.php');
     139    $this->ModuleManager->RegisterModule(new ModuleSetup($this));
     140    $this->ModuleManager->Modules['Setup']->Start();
    138141    $this->ModuleManager->LoadModules();
    139142    $this->ModuleManager->Modules['Setup']->Start();
Note: See TracChangeset for help on using the changeset viewer.