<?php

require_once(dirname(__FILE__) . '/protected/components/CArray.php');
global $_TMP;
$_TMP = new CArray();

require_once(dirname(__FILE__) . '/protected/components/CryptoEngine.php');
require_once 'install.php';
require_once(dirname(__FILE__) . '/protected/extensions/yii-environment/Environment.php');
$env = new Environment();

defined('YII_DEBUG') or define('YII_DEBUG', $env->yiiDebug);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', $env->yiiTraceLevel);

require_once(dirname(__FILE__).'/protected/globals.php');
require_once($env->yiiPath);
require_once(dirname(__FILE__) . '/protected/components/KriaWebApplication.php');

$env->runYiiStatics();
$app = Yii::createApplication('KriaWebApplication', $env->configWeb);

spl_autoload_unregister(array('YiiBase','autoload'));
require_once('log4php/Logger.php'); // require registers Logger autoload
spl_autoload_register(array('YiiBase','autoload'));

$app->params['environment'] = $env->determineMode();

Logger::configure($app->params['log4php']);

$app->run();
