<?php

/**
 * Power By Tmac PHP MVC framework
 * $Author: zhangwentao $  <zwttmac@qq.com>
 * $Id: TmacPHP.php 46 2011-12-02 10:55:06Z zhangwentao $
 * http://www.t-mac.org； 
 */
//加载配置文件
require(TMAC_BASE_PATH . 'Tmac.config.php');

ini_set('include_path',
        ini_get('include_path') . PATH_SEPARATOR
        . TMAC_PATH . PATH_SEPARATOR
        . TMAC_PATH . 'Database' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . TMAC_PATH . 'Cache' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . TMAC_PATH . 'Plugin' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . APPLICATION_ROOT . 'Model' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . APPLICATION_ROOT . 'Plugin' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . APPLICATION_ROOT . 'Controller' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
);

/**
 * 自动加载类
 *
 * @param string $class
 */
function __autoload($class)
{
    require_once($class . '.class.php');
}

//Tmac虚拟根目录
define('ROOT', str_replace('index.php', '', $_SERVER['SCRIPT_NAME']));
//Tmac URL 根目录
define('URL', ROOT . ($TmacConfig['Common']['urlrewrite'] ? '' : 'index.php'));
//Tmac URL 根目录
define('PHP_SELF', basename($_SERVER['PHP_SELF']));