Skip to content

Commit f1726cf

Browse files
committed
修正安装时的端口判断
1 parent 1e69fdb commit f1726cf

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

install.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
}
6868

6969
$parts = parse_url($_SERVER['HTTP_REFERER']);
70-
if (!empty($parts['port']) && $parts['port'] != 80 && !Typecho_Common::isAppEngine()) {
70+
if (!empty($parts['port']) && !Typecho_Common::isAppEngine()) {
7171
$parts['host'] = "{$parts['host']}:{$parts['port']}";
7272
}
7373

var/Typecho/Request.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ public static function getUrlPrefix()
219219
{
220220
if (empty(self::$_urlPrefix)) {
221221
self::$_urlPrefix = (self::isSecure() ? 'https' : 'http')
222-
. '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'])
223-
. (in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? '' : ':' . $_SERVER['SERVER_PORT']);
222+
. '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] :
223+
($_SERVER['SERVER_NAME'] . (in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? '' : ':' . $_SERVER['SERVER_PORT']))
224+
);
224225
}
225226

226227
return self::$_urlPrefix;

0 commit comments

Comments
 (0)