diff --git a/install.php b/install.php index 44820643..c464e39e 100644 --- a/install.php +++ b/install.php @@ -20,13 +20,8 @@ define('__TYPECHO_THEME_DIR__', '/usr/themes'); /** 后台路径(相对路径) */ define('__TYPECHO_ADMIN_DIR__', '/admin/'); -/** 设置包含路径 */ -@set_include_path(get_include_path() . PATH_SEPARATOR . -__TYPECHO_ROOT_DIR__ . '/var' . PATH_SEPARATOR . -__TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__); - /** 载入API支持 */ -require_once 'Typecho/Common.php'; +require_once __TYPECHO_ROOT_DIR__ . '/var/Typecho/Common.php'; /** 程序初始化 */ Typecho_Common::init(); @@ -537,7 +532,7 @@ Typecho_Cookie::set('__typecho_lang', $lang); } /** 初始化配置文件 */ - $lines = array_slice(file(__FILE__), 1, 31); + $lines = array_slice(file(__FILE__), 1, 26); $lines[] = " /** 定义数据库参数 */ \$db = new Typecho_Db('{$adapter}', '" . _r('dbPrefix') . "'); diff --git a/var/Typecho/AutoP.php b/var/AutoP.php similarity index 100% rename from var/Typecho/AutoP.php rename to var/AutoP.php diff --git a/var/Typecho/Common.php b/var/Typecho/Common.php index 57bc30d9..1c936692 100644 --- a/var/Typecho/Common.php +++ b/var/Typecho/Common.php @@ -229,7 +229,18 @@ class Typecho_Common */ public static function __autoLoad($className) { - @include_once str_replace(array('\\', '_'), '/', $className) . '.php'; + $classFile = str_replace(array('\\', '_'), '/', $className) . '.php'; + $systemPath = self::url($classFile, __TYPECHO_ROOT_DIR__ . '/var'); + + if (file_exists($systemPath)) { + @include_once $systemPath; + } else { + $pluginPath = self::url($classFile, __TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__); + + if (file_exists($pluginPath)) { + @include_once $pluginPath; + } + } } /**