From 38fb1fc7a9bbb1e70f0f24352891601b2e0856d6 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Tue, 13 May 2014 21:57:50 +0200 Subject: extend lang file cascade, so users can override some lang strings Fixes #692 --- inc/init.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 4ff239787..c7f9a406d 100644 --- a/inc/init.php +++ b/inc/init.php @@ -259,6 +259,11 @@ 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; @@ -271,6 +276,9 @@ function init_lang($langCode) { require(DOKU_INC."inc/lang/$langCode/lang.php"); } } + if (file_exists(DOKU_CONF."lang/$langCode/lang.php")) { + require(DOKU_CONF."lang/$langCode/lang.php"); + } } /** -- cgit v1.2.3 From 19738e65138f2c83e73e0e8eedf259cd12fdf1c7 Mon Sep 17 00:00:00 2001 From: Enrico Tagliavini Date: Sat, 12 Jul 2014 23:26:45 +0200 Subject: adding X-Forwarded-Proto support in is_ssl() This commit adds support for X-Forwarded-Proto in case dokuwiki runs behind a reverse (SSL) proxy, but the connection between the proxy and the web server running dokuwki is plain HTTP. If an authenticated user is accidentaly dropped to HTTP from HTTPS the securecookie setting should be honored and the redirection when saving or canceling a page edit should point to the correct protocol. This happens every time a user hits cancel after editing a page, and likely even after saving. If the webserver doesn't enforce HTTPS the coockie might be sent in clear. --- inc/init.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 4ff239787..d825b5250 100644 --- a/inc/init.php +++ b/inc/init.php @@ -456,10 +456,6 @@ function getBaseURL($abs=null){ $port = ''; } - if(!$port && isset($_SERVER['SERVER_PORT'])) { - $port = $_SERVER['SERVER_PORT']; - } - if(is_null($port)){ $port = ''; } @@ -490,6 +486,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; -- cgit v1.2.3 From dd7a6159c4224a6a3dda22a1f35f5fb13b06ec2e Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Sun, 28 Sep 2014 13:27:05 +0200 Subject: use config cascade for loading of localizations --- inc/init.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index c7f9a406d..be81ec844 100644 --- a/inc/init.php +++ b/inc/init.php @@ -266,18 +266,26 @@ function init_paths(){ */ 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"); } - } - if (file_exists(DOKU_CONF."lang/$langCode/lang.php")) { - require(DOKU_CONF."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"); + } + } } } -- cgit v1.2.3 From 0f8f7aaa42dc1e95a0d7a1cac126263bdb17686b Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Fri, 31 Oct 2014 18:40:52 +0800 Subject: Move check after libraries are loaded, so that $conf['compression'] is not turned off in the case that gzopen doesn't exist while gzopen64 does exist, as inc/compatibility.php ought to have fixed. --- inc/init.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 24920a17d..d0d9101e6 100644 --- a/inc/init.php +++ b/inc/init.php @@ -178,14 +178,6 @@ $_REQUEST = array_merge($_GET,$_POST); // we don't want a purge URL to be digged if(isset($_REQUEST['purge']) && !empty($_SERVER['HTTP_REFERER'])) unset($_REQUEST['purge']); -// disable gzip if not available -if($conf['compression'] == 'bz2' && !function_exists('bzopen')){ - $conf['compression'] = 'gz'; -} -if($conf['compression'] == 'gz' && !function_exists('gzopen')){ - $conf['compression'] = 0; -} - // precalculate file creation modes init_creationmodes(); @@ -201,6 +193,14 @@ if (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Con // load libraries require_once(DOKU_INC.'inc/load.php'); +// disable gzip if not available +if($conf['compression'] == 'bz2' && !function_exists('bzopen')){ + $conf['compression'] = 'gz'; +} +if($conf['compression'] == 'gz' && !function_exists('gzopen')){ + $conf['compression'] = 0; +} + // input handle class global $INPUT; $INPUT = new Input(); -- cgit v1.2.3