From 9e2f971e3400f83766d7322d04c294620e5901c9 Mon Sep 17 00:00:00 2001 From: Megan Watson Date: Tue, 11 Aug 2009 11:17:22 +0200 Subject: [PATCH] The download manager now uses the external ip address. Jira: KTS-4379 --- ktwebservice/KTDownloadManager.inc.php | 4 +++- lib/util/ktutil.inc | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ktwebservice/KTDownloadManager.inc.php b/ktwebservice/KTDownloadManager.inc.php index 1779615..c1032e7 100644 --- a/ktwebservice/KTDownloadManager.inc.php +++ b/ktwebservice/KTDownloadManager.inc.php @@ -60,8 +60,10 @@ class KTDownloadManager $this->age = $config->get('webservice/downloadExpiry',5); $protocol = $config->get('KnowledgeTree/sslEnabled')?'https':'http'; + $server = KTUtil::getServerName(TRUE); + $url = $config->get('webservice/downloadUrl'); - $this->download_url = $protocol . '://' . $_SERVER['HTTP_HOST'] . $config->get('webservice/downloadUrl'); + $this->download_url = $protocol . '://' . $server . $url; $this->random=$config->get('webservice/randomKeyText','jhsdf8q1jkjpoiudfs7sd3ds1'); } diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index 2aeeeec..bc28fff 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -106,7 +106,7 @@ class KTUtil { return true; } - static function getServerName() + static function getServerName($disallow_localhost = FALSE) { static $host = null; @@ -116,7 +116,7 @@ class KTUtil { $host = $_SERVER['HTTP_HOST']; - if(empty($host)){ + if(empty($host) || ($disallow_localhost && $host == 'localhost')){ global $default; $host = (!empty($default->server_name)) ? $default->server_name : '127.0.0.1'; $host .= !empty($default->server_port) ? ':'.$default->server_port : ''; -- libgit2 0.21.4