diff --git a/admin/css/style.css b/admin/css/style.css
index 867bf6bc..344c25ea 100644
--- a/admin/css/style.css
+++ b/admin/css/style.css
@@ -242,6 +242,7 @@ select {
button {
height: 28px;
+ margin: 0;
vertical-align: middle;
zoom: 1;
display: inline-block;
@@ -344,7 +345,7 @@ button.primary:active, button.primary.active {
list-style: none;
position: absolute;
z-index: 2;
- left: 2px;
+ left: 0;
margin: 0;
padding: 0;
background: #f9f9f7;
@@ -358,7 +359,7 @@ button.primary:active, button.primary.active {
}
.dropdown-menu li p {
- padding: 5px 13px;
+ padding: 5px 15px;
}
.dropdown-menu li a {
diff --git a/install.php b/install.php
index 117b7d15..fbfa0da5 100644
--- a/install.php
+++ b/install.php
@@ -54,7 +54,7 @@ Typecho_Common::init();
ob_start();
//判断是否已经安装
-if (!isset($_GET['finish']) && file_exists(__TYPECHO_ROOT_DIR__ . '/config.inc.php')) {
+if (!isset($_GET['finish']) && file_exists(__TYPECHO_ROOT_DIR__ . '/config.inc.php') && !file_exists(sys_get_temp_dir() . '/install-typecho')) {
exit;
}
@@ -163,6 +163,7 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
+
+
+
' . _t('没有检测到您手动创建的配置文件, 请检查后再次创建') . '';
- $success = false;
- }
+ if (_r('created') && !file_exists('./config.inc.php')) {
+ echo '' . _t('没有检测到您手动创建的配置文件, 请检查后再次创建') . '
';
+ $success = false;
} else {
if (NULL == _r('userUrl')) {
$success = false;
@@ -258,20 +420,17 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
}
}
+ $_dbConfig = _rFrom('dbHost', 'dbUser', 'dbPassword', 'dbCharset', 'dbPort', 'dbDatabase', 'dbFile', 'dbDsn');
- if ($success) {
- if (!isset($installDb)) {
- $installDb = new Typecho_Db ($adapter, _r('dbPrefix'));
- $_dbConfig = _rFrom('dbHost', 'dbUser', 'dbPassword', 'dbCharset', 'dbPort', 'dbDatabase', 'dbFile', 'dbDsn');
+ $_dbConfig = array_filter($_dbConfig);
+ $dbConfig = array();
+ foreach ($_dbConfig as $key => $val) {
+ $dbConfig[strtolower (substr($key, 2))] = $val;
+ }
- $_dbConfig = array_filter($_dbConfig);
- $dbConfig = array();
- foreach ($_dbConfig as $key => $val) {
- $dbConfig[strtolower (substr($key, 2))] = $val;
- }
-
- $installDb->addServer($dbConfig, Typecho_Db::READ | Typecho_Db::WRITE);
- }
+ if ($success && !_r('created')) {
+ $installDb = new Typecho_Db ($adapter, _r('dbPrefix'));
+ $installDb->addServer($dbConfig, Typecho_Db::READ | Typecho_Db::WRITE);
/** 检测数据库配置 */
@@ -286,12 +445,19 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
echo ''
. _t('安装程序捕捉到以下错误: "%s". 程序被终止, 请检查您的配置信息.',$e->getMessage()) . '
';
}
-
}
if($success) {
+ Typecho_Cookie::set('__typecho_config', base64_encode(serialize(array_merge(array(
+ 'prefix' => _r('dbPrefix'),
+ 'userName' => _r('userName'),
+ 'userMail' => _r('userMail'),
+ 'adapter' => $adapter,
+ 'siteUrl' => _r('userUrl')
+ ), $dbConfig))));
+
if (_r('created')) {
- header('Location: ./install.php?finish');
+ header('Location: ./install.php?start');
exit;
}
@@ -304,13 +470,20 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
Typecho_Db::set(\$db);
";
$contents = implode('', $lines);
+ file_put_contents('./config.inc.php', $contents);
- if (true !== @file_put_contents('./config.inc.php', $contents)) {
+ // 创建一个用于标识的临时文件
+ file_put_contents(sys_get_temp_dir() . '/install-typecho', '');
+
+ if (!file_exists('./config.inc.php')) {
?>
- ' . _t('安装目录不可写, 请设置你的目录权限为可写。
或者在安装过程中手动上传config.inc.php文件.') . '';
- } else {
- fclose($handle);
- unlink('./config.inc.php');
- }
- ?>
@@ -397,11 +561,7 @@ Typecho_Db::set(\$db);
-