Skip to content

Commit

Permalink
修正安装时的端口判断
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed Oct 12, 2014
1 parent 1e69fdb commit f1726cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}

$parts = parse_url($_SERVER['HTTP_REFERER']);
if (!empty($parts['port']) && $parts['port'] != 80 && !Typecho_Common::isAppEngine()) {
if (!empty($parts['port']) && !Typecho_Common::isAppEngine()) {
$parts['host'] = "{$parts['host']}:{$parts['port']}";
}

Expand Down
5 changes: 3 additions & 2 deletions var/Typecho/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ public static function getUrlPrefix()
{
if (empty(self::$_urlPrefix)) {
self::$_urlPrefix = (self::isSecure() ? 'https' : 'http')
. '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'])
. (in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? '' : ':' . $_SERVER['SERVER_PORT']);
. '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] :
($_SERVER['SERVER_NAME'] . (in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? '' : ':' . $_SERVER['SERVER_PORT']))
);
}

return self::$_urlPrefix;
Expand Down

0 comments on commit f1726cf

Please sign in to comment.