Commit 9e2f971e3400f83766d7322d04c294620e5901c9
1 parent
abe99b62
The download manager now uses the external ip address.
Jira: KTS-4379 Committed by: Megan Watson
Showing
2 changed files
with
5 additions
and
3 deletions
ktwebservice/KTDownloadManager.inc.php
| @@ -60,8 +60,10 @@ class KTDownloadManager | @@ -60,8 +60,10 @@ class KTDownloadManager | ||
| 60 | $this->age = $config->get('webservice/downloadExpiry',5); | 60 | $this->age = $config->get('webservice/downloadExpiry',5); |
| 61 | 61 | ||
| 62 | $protocol = $config->get('KnowledgeTree/sslEnabled')?'https':'http'; | 62 | $protocol = $config->get('KnowledgeTree/sslEnabled')?'https':'http'; |
| 63 | + $server = KTUtil::getServerName(TRUE); | ||
| 64 | + $url = $config->get('webservice/downloadUrl'); | ||
| 63 | 65 | ||
| 64 | - $this->download_url = $protocol . '://' . $_SERVER['HTTP_HOST'] . $config->get('webservice/downloadUrl'); | 66 | + $this->download_url = $protocol . '://' . $server . $url; |
| 65 | $this->random=$config->get('webservice/randomKeyText','jhsdf8q1jkjpoiudfs7sd3ds1'); | 67 | $this->random=$config->get('webservice/randomKeyText','jhsdf8q1jkjpoiudfs7sd3ds1'); |
| 66 | } | 68 | } |
| 67 | 69 |
lib/util/ktutil.inc
| @@ -106,7 +106,7 @@ class KTUtil { | @@ -106,7 +106,7 @@ class KTUtil { | ||
| 106 | return true; | 106 | return true; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | - static function getServerName() | 109 | + static function getServerName($disallow_localhost = FALSE) |
| 110 | { | 110 | { |
| 111 | static $host = null; | 111 | static $host = null; |
| 112 | 112 | ||
| @@ -116,7 +116,7 @@ class KTUtil { | @@ -116,7 +116,7 @@ class KTUtil { | ||
| 116 | 116 | ||
| 117 | $host = $_SERVER['HTTP_HOST']; | 117 | $host = $_SERVER['HTTP_HOST']; |
| 118 | 118 | ||
| 119 | - if(empty($host)){ | 119 | + if(empty($host) || ($disallow_localhost && $host == 'localhost')){ |
| 120 | global $default; | 120 | global $default; |
| 121 | $host = (!empty($default->server_name)) ? $default->server_name : '127.0.0.1'; | 121 | $host = (!empty($default->server_name)) ? $default->server_name : '127.0.0.1'; |
| 122 | $host .= !empty($default->server_port) ? ':'.$default->server_port : ''; | 122 | $host .= !empty($default->server_port) ? ':'.$default->server_port : ''; |