Exemple #1
0
 /**
  * Retrieve configuration setting from config.php
  * overrided with relative config mode file
  *
  * @return type
  */
 public static function config()
 {
     // base-config file not found create with setup.php
     $configBaseFile = __BASE__ . '/config.php';
     //
     if (!file_exists($configBaseFile)) {
         Runtime::error('file not found: ' . $configBaseFile, 101);
     }
     //
     $configBase = (include $configBaseFile);
     //
     if (!is_array($configBase)) {
         Runtime::error("empty or corrupted 'config.php' " . "run '<a href='setup.php'>setup.php</a>'", 110);
     }
     //
     $configModeFile = __BASE__ . '/config/' . __NAME__ . '.' . __MODE__ . '.php';
     //
     if (!file_exists($configModeFile)) {
         Runtime::error('file not found: ' . $configModeFile, 102);
     }
     //
     $configMode = (include $configModeFile);
     //
     $configDefault = array('default' => array('code' => 'Default', 'action' => 'index'));
     //
     $config = array_replace_recursive($configDefault, $configBase, $configMode);
     //
     return Functions::arrayToObject($config);
 }