mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-02-09 01:51:55 +00:00
new methods getBaseUrl() and getBaseUrlWithRoot()
This commit is contained in:
parent
c32fe1be80
commit
d15c65f137
|
|
@ -1839,5 +1839,37 @@ class Settings { /* {{{ */
|
|||
return min($mus);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get base url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseUrl() { /* {{{ */
|
||||
global $_SERVER;
|
||||
|
||||
if(!empty($this->_baseUrl))
|
||||
return $this->_baseUrl;
|
||||
|
||||
if(isset($_SERVER['HTTP_X_FORWARDED_HOST']))
|
||||
$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
|
||||
else
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']))
|
||||
$ssl = $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
|
||||
else
|
||||
$ssl = (isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0));
|
||||
|
||||
return "http".($ssl ? "s" : "")."://".$host;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get base url with http root folder
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseUrlWithRoot() { /* {{{ */
|
||||
return $this->getBaseUrl().$this->_httpRoot;
|
||||
} /* }}} */
|
||||
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user