<?php
// Turn off all error reporting
//error_reporting(0);
// change the following paths if necessary
define('ROOT_PATH', dirname(dirname(__FILE__)) . '/');

$yii = ROOT_PATH .'libs/yii/framework/yii.php';
require_once dirname(__FILE__) . '/libs/Functions.php';

// remove the following line when in production mode
$file = '.DEPLOY';
if (is_file($file))
{
    $config = dirname(__FILE__) . '/protected/config/deploy.php';
}
else
{
    $config = dirname(__FILE__) . '/protected/config/debug.php';
    defined('YII_DEBUG') or define('YII_DEBUG',true);
}

// TODO 非常猥琐^_^
$_SYS = require_once ROOT_PATH . 'cache/Settings.inc.php';
extract($_SYS, EXTR_OVERWRITE);
require_once ROOT_PATH . 'include/Cache.class.php';
require_once ROOT_PATH . 'include/Db.class.php';
require_once ROOT_PATH . 'model/model.php';
require_once ROOT_PATH . 'model/book.php';

$cache_config = array(
    'core' => $cfg_cachecore,
    'expire' => $cfg_cachetime,
    'folder' => ROOT_PATH . 'cache/bookinfo',
    'depth' => 2
 );
$cache = Cache::getSingleton($cache_config);
$db = Db::getInstance();

require_once ROOT_PATH . 'include/Ubb.func.php';

require_once($yii);
Yii::createWebApplication($config)->run();
