Location: PHPKode > projects > Breeze CMS - A PHP Content Manage System > libs/Ice.class.php
<?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();
    }
}
Return current item: Breeze CMS - A PHP Content Manage System