<?php
if (!defined("ICE_DIR"))
{
define("ICE_DIR", str_replace("\\", "/", dirname(__FILE__)));
}
// ç¨åºå¼å§è¿è¡æ¶é´
$__timestart = microtime();
require_once ICE_DIR . "/Ice/Object/loader.class.php";
ice_include("Ice_Registry");
class Ice
{
var $_default_app_path;
/**
* æé 彿°
*
* @param unknown_type $path
* $path æå®åºç¨ç¨åºçæç´¢è·¯å¾
* è¿æ ·ç好夿¯åå°ååå°ç¨åºå¯ä»¥åå¼ä¿å
*/
function Ice($path = array())
{
$this->_default_app_path = $path;
}
function __init()
{
static $inited = false;
if (true === $inited)
{
return true;
}
// è½½å
¥ç¨åºé
置信æ¯
$config = (array)include(ICE_DIR . "/../config/config.app.php");
// è½½å
¥æ°æ®åºé
置信æ¯
$dbconfig = (array)include(ICE_DIR . "/../config/config.db.php");
if (count($this->_default_app_path))
{
$config['default_app_path'] = $this->_default_app_path;
}
$app_paths = array_merge($config['default_app_path'], $config['public_app_path']);
$registry = Ice_Registry::getInstance();
$registry->set("APP_PATH", $app_paths);
$registry->set("APP_DIR", ICE_DIR . $config['app_dir']);
$registry->set("DB_CONFIG", $dbconfig);
ob_start();
@header("Content-Type: text/html; charset=UTF-8");
if (get_magic_quotes_gpc())
{
ice_include("Ice_Http_Request");
Ice_Http_Request::magicQuotesFilter();
}
$inited = true;
}
function run()
{
$this->__init();
ice_include("Ice_Dispatcher");
$dispatcher = new Ice_Dispatcher();
$dispatcher->process();
}
}