Exemplo n.º 1
0
Arquivo: init.php Projeto: efoft/hydra
 * 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);
            $dbname = $cfg->val('DBname', true);
            $dbchar = $cfg->val('DBchar', true);
            $dbuser = $cfg->val('DBuser', true);
            $dbpass = $cfg->val('DBpass', true);