diff options
Diffstat (limited to 'inc/init.php')
-rw-r--r-- | inc/init.php | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/inc/init.php b/inc/init.php index 4ff239787..24920a17d 100644 --- a/inc/init.php +++ b/inc/init.php @@ -259,17 +259,33 @@ function init_paths(){ $conf['media_changelog'] = $conf['metadir'].'/_media.changes'; } +/** + * Load the language strings + * + * @param string $langCode language code, as passed by event handler + */ function init_lang($langCode) { //prepare language array - global $lang; + global $lang, $config_cascade; $lang = array(); //load the language files require(DOKU_INC.'inc/lang/en/lang.php'); + foreach ($config_cascade['lang']['core'] as $config_file) { + if (@file_exists($config_file . 'en/lang.php')) { + include($config_file . 'en/lang.php'); + } + } + if ($langCode && $langCode != 'en') { if (file_exists(DOKU_INC."inc/lang/$langCode/lang.php")) { require(DOKU_INC."inc/lang/$langCode/lang.php"); } + foreach ($config_cascade['lang']['core'] as $config_file) { + if (@file_exists($config_file . "$langCode/lang.php")) { + include($config_file . "$langCode/lang.php"); + } + } } } @@ -456,10 +472,6 @@ function getBaseURL($abs=null){ $port = ''; } - if(!$port && isset($_SERVER['SERVER_PORT'])) { - $port = $_SERVER['SERVER_PORT']; - } - if(is_null($port)){ $port = ''; } @@ -490,6 +502,14 @@ function getBaseURL($abs=null){ * @returns bool true when SSL is active */ function is_ssl(){ + // check if we are behind a reverse proxy + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { + if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { + return true; + } else { + return false; + } + } if (!isset($_SERVER['HTTPS']) || preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){ return false; |