tcher璋冨害鍣?
import('Think.Core.Dispatcher');
Dispatcher::dispatch();
}else{
// 鍔犺浇绗笁鏂硅皟搴﹀櫒
apply_filter('app_dispatch');
}
}
if(!defined('PHP_FILE')) {
//
PHP_FILE 鐢卞唴缃殑Dispacher瀹氫箟
// 濡傛灉涓嶄娇鐢ㄨ鎻掍欢锛岄渶瑕侀噸鏂板畾涔?
define('PHP_FILE',_PHP_FILE_);
}
// 鍙栧緱妯″潡鍜屾搷浣滃悕绉?濡傛灉鏈変吉瑁?鍒欒繑鍥炵湡瀹炵殑鍚嶇О
// 鍙互鍦―ispatcher涓畾涔夎幏鍙栬鍒?
if(!defined('MODULE_NAME')) define('MODULE_NAME', $this->getModule()); // Module鍚嶇О
if(!defined('ACTION_NAME')) define('ACTION_NAME', $this->getAction()); // Action鎿嶄綔
// 鍔犺浇妯″潡閰嶇疆鏂囦欢 骞惰嚜鍔ㄧ敓鎴愰厤缃紦瀛樻枃浠?
if(file_exists(CONFIG_PATH.MODULE_NAME.'_config.php')) {
C(array_change_key_case(include CONFIG_PATH.MODULE_NAME.'_config.php'));
}
// 鍚敤椤甸潰闃插埛鏂版満鍒?
if(C('LIMIT_RESFLESH_ON')) {
// 鍚敤椤甸潰闃插埛鏂版満鍒?
$guid = md5($_SERVER['PHP_SELF']);
// 妫鏌ラ〉闈㈠埛鏂伴棿闅?
if(Cookie::is_set('_last_visit_time_'.$guid) && Cookie::get('_last_visit_time_'.$guid)>time()-C('LIMIT_REFLESH_TIMES')) {
// 椤甸潰鍒锋柊璇诲彇娴忚鍣ㄧ紦瀛?
header('HTTP/1.1 304 Not Modified');
exit;
}else{
// 缂撳瓨褰撳墠鍦板潃璁块棶鏃堕棿
Cookie::set('_last_visit_time_'.$guid,$_SERVER['REQUEST_TIME'],$_SERVER['REQUEST_TIME']+3600);
header('Last-Modified:'.(date('D,d M Y H:i:s',$_SERVER['REQUEST_TIME']-C('LIMIT_REFLESH_TIMES'))).' GMT');
}
}
// 绯荤粺妫鏌?
$this->checkLanguage(); //璇█妫鏌?
$this->checkTemplate(); //妯℃澘妫鏌?
if(C('USER_AUTH_ON')) {
// 鍚敤鏉冮檺璁よ瘉 璋冪敤RBAC缁勪欢
import('ORG.RBAC.RBAC');
RBAC::AccessDecision();
}
if(C('HTML_CACHE_ON')) {
import('Think.Util.HtmlCache');
HtmlCache::read
HTMLCache();
}
// 搴旂敤鍒濆鍖栬繃婊ゆ彃浠?
apply_filter('app_init');
// 璁板綍搴旂敤鍒濆鍖栨椂闂?
$GLOBALS['_initTime'] = microtime(TRUE);
return ;
}
/**
+----------------------------------------------------------
* 璇诲彇閰嶇疆淇℃伅 缂栬瘧椤圭洰
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
private function build()
{
// 鍔犺浇鎯緥閰嶇疆鏂囦欢
C(array_change_key_case(include THINK_PATH.'/Common/convention.php'));
// 鍔犺浇椤圭洰閰嶇疆鏂囦欢
if(file_exists(CONFIG_PATH.'config.php')) {
C(array_change_key_case(include CONFIG_PATH.'config.php'));
}
// 鍔犺浇椤圭洰鍏叡鏂囦欢
if(file_exists(APP_PATH.'/Common/common.php')) {
include APP_PATH.'/Common/common.php';
if(!C('DEBUG_MODE')) {
if(defined('STRIP_RUNTIME_SPACE') && STRIP_RUNTIME_SPACE == false ) {
$common = file_get_contents(APP_PATH.'/Common/common.php');
}else{
$common = php_strip_whitespace(APP_PATH.'/Common/common.php');
}
}
}
// 濡傛灉鏄皟璇曟ā寮忓姞杞借皟璇曟ā寮忛厤缃枃浠?
if(C('DEBUG_MODE')) {
// 鍔犺浇绯荤粺榛樿鐨勫紑鍙戞ā寮忛厤缃枃浠?
C(array_change_key_case(include THINK_PATH.'/Common/debug.php'));
if(file_exists(CONFIG_PATH.'debug.php')) {
// 鍏佽椤圭洰澧炲姞寮鍙戞ā寮忛厤缃畾涔?
C(array_change_key_case(include CONFIG_PATH.'debug.php'));
}
}else{
// 閮ㄧ讲妯″紡涓嬮潰鐢熸垚缂栬瘧鏂囦欢
// 涓嬫鐩存帴鍔犺浇椤圭洰缂栬瘧鏂囦欢
$content = $common."<?php\nreturn ".var_export(C(),true).";\n?>";
file_put_contents(RUNTIME_PATH.'~app.php',$content);
}
return ;
}
/**
+----------------------------------------------------------
* 鑾峰緱瀹為檯鐨勬ā鍧楀悕绉?
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
private function getModule()
{
$module = isset($_POST[C('VAR_MODULE')]) ?
$_POST[C('VAR_MODULE')] :
(isset($_GET[C('VAR_MODULE')])? $_GET[C('VAR_MODULE'