Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(BaseURL): always prefer configured tine20URL
Browse files Browse the repository at this point in the history
Change-Id: I941de1b9de881ccf9a3881602725567a0c45a881
Reviewed-on: http://gerrit.tine20.com/customers/10795
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
  • Loading branch information
pschuele committed Nov 2, 2018
1 parent 8e0abe4 commit ce97cfc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tine20/Tinebase/Core.php
Expand Up @@ -1753,23 +1753,23 @@ public static function getHostname()
*/
public static function getUrl($part = 'full')
{
if (empty($_SERVER['SERVER_NAME']) && empty($_SERVER['HTTP_HOST'])) {
if (empty($url = Tinebase_Config::getInstance()->get(Tinebase_Config::TINE20_URL))) {
if (empty($url = Tinebase_Config::getInstance()->get(Tinebase_Config::TINE20_URL))) {
if (empty($_SERVER['SERVER_NAME']) && empty($_SERVER['HTTP_HOST'])) {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__
. ' neither SERVER_NAME nor HTTP_HOST are set and tine20URL config is not set too!');
$protocol = 'http://'; // backward compatibility. This is what used to happen if you ask zend
$hostname = '';
$pathname = '';
} else {
$protocol = parse_url($url, PHP_URL_SCHEME);
$hostname = parse_url($url, PHP_URL_HOST);
$pathname = rtrim(str_replace($protocol . '://' . $hostname, '', $url), '/');
$request = new Zend_Controller_Request_Http();
$pathname = $request->getBasePath();
$hostname = $request->getHttpHost();
$protocol = $request->getScheme();
}
} else {
$request = new Zend_Controller_Request_Http();
$pathname = $request->getBasePath();
$hostname = $request->getHttpHost();
$protocol = $request->getScheme();
$protocol = parse_url($url, PHP_URL_SCHEME);
$hostname = parse_url($url, PHP_URL_HOST);
$pathname = rtrim(str_replace($protocol . '://' . $hostname, '', $url), '/');
}

switch ($part) {
Expand Down

0 comments on commit ce97cfc

Please sign in to comment.