示例#1
0
    // Driver options
    if (@$dbOptions['options']) {
        $driverOptions = array();
        foreach ((array) @$dbOptions['options'] as $key => $value) {
            if (is_string($key) && defined("PDO::{$key}")) {
                $driverOptions[constant("PDO::{$key}")] = $value;
            }
        }
        unset($key, $value);
        if ($driverOptions) {
            $dbOptions['options'] = $driverOptions;
        }
        unset($driverOptions);
    }
    $dbOptions = new core\DatabaseOptions($dbOptions['driver'], @$dbOptions['host'], @$dbOptions['port'], @$dbOptions['schema'], $dbOptions['user'], @$dbOptions['password'], (array) @$dbOptions['options']);
    core\Database::setOptions($dbOptions);
}
unset($dbOptions);
//------------------------------------------------------------------------------
//
//  Logger initialization
//
//------------------------------------------------------------------------------
/*! Note @ 7 Aug, 2015
 *  Here we started to make use of the Psr\Log interface and Seldaek\Monolog,
 *  digging the original Log class empty as a wrapper to LoggerInterface, and
 *  moved the backtrace and session info into separate processors in monolog.
 *
 *  Specifically, backtrace context like file, subject and action are moved to
 *  the BacktraceProcessor class, while session info is moved to the
 *  SessionProcessor class.
<?php

session_start();
spl_autoload_register(function ($class) {
    $classPath = str_replace("\\", "/", $class);
    require_once $classPath . '.php';
});
require_once 'core/app.php';
core\Database::setInstance(config\DatabaseConfig::DB_INSTANCE, config\DatabaseConfig::DB_DRIVER, config\DatabaseConfig::DB_USER, config\DatabaseConfig::DB_PASS, config\DatabaseConfig::DB_NAME, config\DatabaseConfig::DB_HOST);
$app = new core\app(core\Database::getInstance(config\DatabaseConfig::DB_INSTANCE));
function loadTemplate($templateName, $data = null)
{
    require_once 'templates/' . $templateName . '.php';
}