Index: branches/5.3.x/core/kernel/application.php =================================================================== diff -u -N -r15980 -r15999 --- branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15980) +++ branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15999) @@ -1,6 +1,6 @@ isAdmin ? $this->ConfigValue('AdminSSL_URL') : false; + $protocol = 'https://'; + $domain = $this->getSecureDomain(); + } + else { + // going from https:// to http:// + $protocol = 'http://'; + $domain = $this->siteDomainField('DomainName'); - if ( !$base_url ) { - $ssl_url = $this->siteDomainField('SSLUrl'); - $base_url = $ssl_url !== false ? $ssl_url : $this->ConfigValue('SSL_URL'); + if ( $domain === false ) { + $domain = DOMAIN; // not on site domain } - - return rtrim($base_url, '/') . $prefix . '/'; } - // going from https:// to http:// - $domain = $this->siteDomainField('DomainName'); + return $protocol . $domain . (defined('PORT') ? ':' . PORT : '') . BASE_PATH . '/'; + } - if ( $domain === false ) { - $domain = DOMAIN; + /** + * Returns secure domain. + * + * @return string + */ + public function getSecureDomain() + { + $ret = $this->isAdmin ? $this->ConfigValue('AdminSSLDomain') : false; + + if ( !$ret ) { + $ssl_domain = $this->siteDomainField('SSLDomainName'); + + return strlen($ssl_domain) ? $ssl_domain : $this->ConfigValue('SSLDomain'); } - return 'http://' . $domain . ($add_port && defined('PORT') ? ':' . PORT : '') . BASE_PATH . $prefix . '/'; + return $ret; } /** @@ -3044,4 +3057,4 @@ { return $this->HttpQuery->getClientIp(); } -} +} \ No newline at end of file