From 95e86e369ed4ccd9474fbd5ee782cce4641d1a34 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Thu, 31 Dec 2009 09:57:41 +0000 Subject: [PATCH] + add the feature of just installed or not. --- www/index.php | 7 ++++++- www/install.php | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/www/index.php b/www/index.php index 03725b4e99..9e20d310c6 100644 --- a/www/index.php +++ b/www/index.php @@ -36,7 +36,12 @@ include './myrouter.class.php'; /* 实例化路由对象,加载配置,连接到数据库。*/ $app = router::createApp('pms', '', 'myRouter'); $config = $app->loadConfig('common'); -$dbh = $app->connectDB(); + +/* 检查是否已经安装。*/ +if(!isset($config->installed) or !$config->installed) die(header('location: install.php')); + +/* 连接到数据库。*/ +$dbh = $app->connectDB(); /* 根据debug选项设置错误信息。*/ $config->debug ? error_reporting(E_ALL) : error_reporting(0); diff --git a/www/install.php b/www/install.php index 09c5ddb3fa..285d5ab3b9 100644 --- a/www/install.php +++ b/www/install.php @@ -23,6 +23,8 @@ * @version $Id$ * @link http://www.zentao.cn */ +error_reporting(E_ALL); + /* 包含必须的类文件。*/ include '../../../framework/router.class.php'; include '../../../framework/control.class.php'; @@ -33,7 +35,13 @@ include './myrouter.class.php'; /* 实例化路由对象,加载配置,连接到数据库。*/ $app = router::createApp('pms', '', 'myRouter'); $config = $app->loadConfig('common'); + +/* 检查是否已经安装过。*/ +if(isset($config->installed) and $config->installed) die(header('location: index.php')); + +/* 重新设置config参数,进行安装。*/ $config->set('requestType', 'GET'); +$config->set('debug', true); $config->set('default.module', 'install'); /* 设置客户端所使用的语言、风格。*/