From 60281f4e90e052c69a047da6a5485fd3100e8924 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 14 Nov 2011 16:08:45 -0500 Subject: [PATCH] CC-2972: Find better way to determine domain which pypo should download from. -fixed --- airtime_mvc/application/models/StoredFile.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 90cb2970e..8e6ecee57 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -448,14 +448,24 @@ class Application_Model_StoredFile { /** * Get the URL to access this file using the server name/address that - * is specified in the airtime.conf config file. + * is specified in the airtime.conf config file. If either of these is + * not specified, then use values provided by the $_SERVER global variable. */ public function getFileUrlUsingConfigAddress(){ global $CC_CONFIG; - $serverName = $CC_CONFIG['baseUrl']; - $serverPort = $CC_CONFIG['basePort']; - + if (isset($CC_CONFIG['baseUrl'])){ + $serverName = $CC_CONFIG['baseUrl']; + } else { + $serverName = $_SERVER['SERVER_NAME']; + } + + if (isset($CC_CONFIG['basePort'])){ + $serverPort = $CC_CONFIG['basePort']; + } else { + $serverPort = $_SERVER['SERVER_PORT']; + } + return $this->constructGetFileUrl($serverName, $serverPort); }