示例#1
0
文件: init.php 项目: efoft/hydra
<?php

defined('INSIDE') or exit('Direct access is not permitted');
/**
 * Init script for all used classes.
 * This version of the script is intended for online shop.
 *
 * @author  efoft
 */
/* Locator
  ------------------------------------------------------------------------ */
$loc = new Locator();
/* Config
  ------------------------------------------------------------------------ */
$cfg = new Cfg();
if ($cfg->val('SECFILE')) {
    if (!file_exists($loc->path($cfg->val('SECFILE')))) {
        throw new Exception('SECFILE defined but the file not found');
    }
    $cfg->loadSecrets($loc->path($cfg->val('SECFILE')));
}
/* Logging
  ------------------------------------------------------------------------ */
$log = new Logger($loc->path('log'), $cfg->val('DEBUG'));
/* Database
  ------------------------------------------------------------------------ */
if ($cfg->val('DBdriver')) {
    $dbdrv = $cfg->val('DBdriver');
    switch ($dbdrv) {
        case 'mysql':
            $dbhost = $cfg->val('DBhost', true);