mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 12:11:19 +00:00
handle proxy settings and _baseUrl in settings in getBaseUrl()
This commit is contained in:
parent
1aca53f63a
commit
e87d7546a3
|
@ -795,7 +795,21 @@ function sendFile($filename) { /* {{{ */
|
|||
* @return string
|
||||
*/
|
||||
function getBaseUrl() { /* {{{ */
|
||||
return "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'];
|
||||
global $settings;
|
||||
|
||||
if(!empty($settings->_baseUrl))
|
||||
return $settings->_baseUrl;
|
||||
|
||||
if(isset($_SERVER['X-Forwarded-Host']))
|
||||
$host = $_SERVER['X-Forwarded-Host'];
|
||||
else
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
if(isset($_SERVER['X-Forwarded-Proto']))
|
||||
$ssl = $_SERVER['X-Forwarded-Proto'] == 'https';
|
||||
else
|
||||
$ssl = (isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0));
|
||||
|
||||
return "http".($ssl ? "s" : "")."://".$host;
|
||||
} /* }}} */
|
||||
|
||||
function getToken($length){ /* {{{ */
|
||||
|
|
Loading…
Reference in New Issue
Block a user