diff options
author | Michael Hamann <michael@content-space.de> | 2011-01-23 20:33:32 +0100 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2011-01-23 20:33:32 +0100 |
commit | fc756e0d4d88b37c01a9155e675a549430b00593 (patch) | |
tree | 7adc185d2c349788961ff7cb8f9bcb25afbce485 /inc/init.php | |
parent | 8605afb1b4e2a6a9e11e21a7bf0775bbb0d5af03 (diff) | |
parent | 820923f1328bcfe6002831570eb65238411c5b70 (diff) | |
download | rpg-fc756e0d4d88b37c01a9155e675a549430b00593.tar.gz rpg-fc756e0d4d88b37c01a9155e675a549430b00593.tar.bz2 |
Merge branch 'master' into indexer_improvements
Conflicts:
inc/fulltext.php
inc/indexer.php
lib/exe/indexer.php
Diffstat (limited to 'inc/init.php')
-rw-r--r-- | inc/init.php | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/inc/init.php b/inc/init.php index 1dc31a31f..f4c867935 100644 --- a/inc/init.php +++ b/inc/init.php @@ -421,14 +421,27 @@ function getBaseURL($abs=null){ if($conf['baseurl']) return rtrim($conf['baseurl'],'/').$dir; //split hostheader into host and port - $addr = explode(':',$_SERVER['HTTP_HOST']); - $host = $addr[0]; - $port = ''; - if (isset($addr[1])) { - $port = $addr[1]; - } elseif (isset($_SERVER['SERVER_PORT'])) { + if(isset($_SERVER['HTTP_HOST'])){ + $parsed_host = parse_url('http://'.$_SERVER['HTTP_HOST']); + $host = $parsed_host['host']; + $port = $parsed_host['port']; + }elseif(isset($_SERVER['SERVER_NAME'])){ + $parsed_host = parse_url('http://'.$_SERVER['SERVER_NAME']); + $host = $parsed_host['host']; + $port = $parsed_host['port']; + }else{ + $host = php_uname('n'); + $port = ''; + } + + if(!$port && isset($_SERVER['SERVER_PORT'])) { $port = $_SERVER['SERVER_PORT']; } + + if(is_null($port)){ + $port = ''; + } + if(!is_ssl()){ $proto = 'http://'; if ($port == '80') { |