diff --git a/install.php b/install.php
index a666b176..7dfb3b1d 100644
--- a/install.php
+++ b/install.php
@@ -62,11 +62,11 @@ if (!isset($_GET['finish']) && file_exists(__TYPECHO_ROOT_DIR__ . '/config.inc.p
// 挡掉可能的跨站请求
if (!empty($_GET) || !empty($_POST)) {
- if (empty($_SERVER['HTTP_REFERER')) {
+ if (empty($_SERVER['HTTP_REFERER'])) {
exit;
}
- $parts = parse_url($_SERVER);
+ $parts = parse_url($_SERVER['HTTP_REFERER']);
if (empty($parts['host']) || $_SERVER['HTTP_HOST'] != $parts['host']) {
exit;
}
@@ -86,18 +86,18 @@ function _r($name, $default = NULL) {
/**
* 获取多个传递参数
- *
+ *
* @return array
*/
function _rFrom() {
$result = array();
$params = func_get_args();
-
+
foreach ($params as $param) {
$result[$param] = isset($_REQUEST[$param]) ?
(is_array($_REQUEST[$param]) ? NULL : $_REQUEST[$param]) : NULL;
}
-
+
return $result;
}
@@ -215,7 +215,7 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
getTokenUrl($loginUrl);
} else {
@@ -344,13 +344,13 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
/** 初始用户 */
$password = empty($config['userPassword']) ? substr(uniqid(), 7) : $config['userPassword'];
-
+
$installDb->query($installDb->insert('table.users')->rows(array('name' => $config['userName'], 'password' => Typecho_Common::hash($password), 'mail' => $config['userMail'],
'url' => 'http://www.typecho.org', 'screenName' => $config['userName'], 'group' => 'administrator', 'created' => Typecho_Date::gmtTime())));
unset($_SESSION['typecho']);
Typecho_Cookie::delete('__typecho_config');
- header('Location: ./install.php?finish&user=' . urlencode($config['userName'])
+ header('Location: ./install.php?finish&user=' . urlencode($config['userName'])
. '&password=' . urlencode($password));
} catch (Typecho_Db_Exception $e) {
$success = false;
@@ -387,7 +387,7 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
header('Location: ./install.php?finish&use_old');
exit;
} else {
- echo '' . _t('安装程序检查到原有数据表已经存在.')
+ echo '
' . _t('安装程序检查到原有数据表已经存在.')
. '
' . ' '
. _t('或者') . '
';
}
@@ -420,7 +420,7 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
' . _t('没有检测到您手动创建的配置文件, 请检查后再次创建') . '';
$success = false;
@@ -456,7 +456,7 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
$replace = array_keys($dbConfig);
foreach ($replace as &$key) {
$key = '{' . $key . '}';
- }
+ }
$config = str_replace($replace, array_values($dbConfig), _r('config'));
}
@@ -471,11 +471,11 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion);
$installDb->query('SELECT 1=1');
} catch (Typecho_Db_Adapter_Exception $e) {
$success = false;
- echo ''
+ echo '
'
. _t('对不起,无法连接数据库,请先检查数据库配置再继续进行安装') . '
';
} catch (Typecho_Db_Exception $e) {
$success = false;
- echo ''
+ echo '
'
. _t('安装程序捕捉到以下错误: " %s ". 程序被终止, 请检查您的配置信息.',$e->getMessage()) . '
';
}
}
@@ -510,7 +510,7 @@ Typecho_Db::set(\$db);
// 创建一个用于标识的临时文件
$_SESSION['typecho'] = 1;
-
+
if (!file_exists('./config.inc.php')) {
?>
config.inc.php 文件'); ?>
@@ -518,7 +518,7 @@ Typecho_Db::set(\$db);