From a4e0e797f6bce4aaabf4e115a277db8c9a1fa285 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 19 Nov 2011 14:40:11 +0100 Subject: enabled remote as plugintype --- inc/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index b3acf2e33..ba62fe079 100644 --- a/inc/init.php +++ b/inc/init.php @@ -200,7 +200,7 @@ init_paths(); init_files(); // setup plugin controller class (can be overwritten in preload.php) -$plugin_types = array('admin','syntax','action','renderer', 'helper'); +$plugin_types = array('admin','syntax','action','renderer', 'helper','remote'); global $plugin_controller_class, $plugin_controller; if (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Controller'; -- cgit v1.2.3 From 6d06b26afab712379b6d070a816f0c71cc76753b Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Tue, 24 Jan 2012 14:30:34 +0100 Subject: added INIT_LANG_LOAD event --- inc/init.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 14660b8d0..130746f20 100644 --- a/inc/init.php +++ b/inc/init.php @@ -69,16 +69,6 @@ foreach (array('default','local','protected') as $config_group) { } } -//prepare language array -global $lang; -$lang = array(); - -//load the language files -require_once(DOKU_INC.'inc/lang/en/lang.php'); -if ( $conf['lang'] && $conf['lang'] != 'en' ) { - require_once(DOKU_INC.'inc/lang/'.$conf['lang'].'/lang.php'); -} - //prepare license array() global $license; $license = array(); @@ -214,6 +204,10 @@ $plugin_controller = new $plugin_controller_class(); global $EVENT_HANDLER; $EVENT_HANDLER = new Doku_Event_Handler(); +$local = $conf['lang']; +trigger_event('INIT_LANG_LOAD', $local, 'init_lang', true); + + // setup authentication system if (!defined('NOSESSION')) { auth_setup(); @@ -256,6 +250,20 @@ function init_paths(){ $conf['media_changelog'] = $conf['metadir'].'/_media.changes'; } +function init_lang($langCode) { + //prepare language array + global $lang; + $lang = array(); + + //load the language files + require_once(DOKU_INC.'inc/lang/en/lang.php'); + if ($langCode && $langCode != 'en') { + if (file_exists(DOKU_INC."inc/lang/$langCode/lang.php")) { + require_once(DOKU_INC."inc/lang/$langCode/lang.php"); + } + } +} + /** * Checks the existance of certain files and creates them if missing. */ -- cgit v1.2.3 From c4766956646b53ab644ec6ddbd17d9cba07cf872 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 30 Jan 2012 20:38:41 +0100 Subject: DOKU_TPL* considered harmful Some plugins want to dynamically switch the template based on users, namspaces or the phase of the moon. Having fixed paths in a unchangable constant prevents this. This changes deprecates the DOKU_TPL* constants in favor of two new tpl_* functions that return the correct paths based on the $conf variables which can be changed from the DOKUWIKI_STARTED event. --- inc/init.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 14660b8d0..3aab0587b 100644 --- a/inc/init.php +++ b/inc/init.php @@ -118,11 +118,11 @@ if (!defined('DOKU_COOKIE')) define('DOKU_COOKIE', 'DW'.md5(DOKU_REL.(($conf['se // define main script if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','doku.php'); -// define Template baseURL +// DEPRECATED, use tpl_basedir() instead if(!defined('DOKU_TPL')) define('DOKU_TPL', DOKU_BASE.'lib/tpl/'.$conf['template'].'/'); -// define real Template directory +// DEPRECATED, use tpl_incdir() instead if(!defined('DOKU_TPLINC')) define('DOKU_TPLINC', DOKU_INC.'lib/tpl/'.$conf['template'].'/'); -- cgit v1.2.3 From 6b9c156c2d804458adf7d057c5c021d4c4658a9d Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 27 May 2012 11:51:32 +0100 Subject: improved error message for savedir paths (FS#2502) --- inc/init.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index d57e12d7b..923bda352 100644 --- a/inc/init.php +++ b/inc/init.php @@ -234,9 +234,12 @@ function init_paths(){ 'tmpdir' => 'tmp'); foreach($paths as $c => $p){ - if(empty($conf[$c])) $conf[$c] = $conf['savedir'].'/'.$p; - $conf[$c] = init_path($conf[$c]); - if(empty($conf[$c])) nice_die("The $c ('$p') does not exist, isn't accessible or writable. + $path = $conf[$c]; + if(empty($path)) + $path = $conf['savedir'].'/'.$p; + $conf[$c] = init_path($path); + if(empty($conf[$c])) + nice_die("The $c ('$p') at $path is not found, isn't accessible or writable. You should check your config and permission settings. Or maybe you want to run the installer?"); @@ -265,7 +268,7 @@ function init_lang($langCode) { } /** - * Checks the existance of certain files and creates them if missing. + * Checks the existence of certain files and creates them if missing. */ function init_files(){ global $conf; @@ -312,7 +315,7 @@ function init_files(){ * @author Andreas Gohr */ function init_path($path){ - // check existance + // check existence $p = fullpath($path); if(!@file_exists($p)){ $p = fullpath(DOKU_INC.$path); @@ -560,7 +563,7 @@ function fullpath($path,$exists=false){ } $finalpath = $root.implode('/', $newpath); - // check for existance when needed (except when unit testing) + // check for existence when needed (except when unit testing) if($exists && !defined('DOKU_UNITTEST') && !@file_exists($finalpath)) { return false; } -- cgit v1.2.3 From 7f086b678f95509d080486e46f683595be591727 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 27 May 2012 12:33:51 +0100 Subject: improved earlier change for paths error messages to not produce any notices --- inc/init.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 923bda352..403fbe4ab 100644 --- a/inc/init.php +++ b/inc/init.php @@ -233,10 +233,8 @@ function init_paths(){ 'lockdir' => 'locks', 'tmpdir' => 'tmp'); - foreach($paths as $c => $p){ - $path = $conf[$c]; - if(empty($path)) - $path = $conf['savedir'].'/'.$p; + foreach($paths as $c => $p) { + $path = empty($conf[$c]) ? $conf['savedir'].'/'.$p : $conf[$c]; $conf[$c] = init_path($path); if(empty($conf[$c])) nice_die("The $c ('$p') at $path is not found, isn't accessible or writable. @@ -310,7 +308,7 @@ function init_files(){ * Returns absolute path * * This tries the given path first, then checks in DOKU_INC. - * Check for accessability on directories as well. + * Check for accessibility on directories as well. * * @author Andreas Gohr */ -- cgit v1.2.3 From 89177306a2278255d6a2203b5fff4a839183d3cd Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 24 Jun 2012 14:00:49 +0200 Subject: Introducing a $_REQUEST/POST/GET wrapper This new wrapper ensures types are correct and accessed parameters are actually set (with custom default fallbacks). The wrapper is available in the global $INPUT variable. It accesses $_REQUEST by default. If POST or GET is required, the post and get members can be used: $INPUT->int('foo',false); // access $_REQUEST['foo'], default false $INPUT->post->int('foo'); // access $_POST['foo'], default 0 $INPUT->get->int('foo'); // access $_GET['foo'], default 0 The codebase still needs to be updated to make use of this. --- inc/init.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 403fbe4ab..1907aea09 100644 --- a/inc/init.php +++ b/inc/init.php @@ -197,6 +197,10 @@ if (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Con // load libraries require_once(DOKU_INC.'inc/load.php'); +// input handle class +global $INPUT; +$INPUT = new Input(); + // initialize plugin controller $plugin_controller = new $plugin_controller_class(); -- cgit v1.2.3 From 3272d797334d9d13a4e4ca43351b1607bb520445 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 25 Jun 2012 19:03:02 +0200 Subject: some code cleanup and php docs --- inc/init.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 1907aea09..a28050736 100644 --- a/inc/init.php +++ b/inc/init.php @@ -3,7 +3,9 @@ * Initialize some defaults needed for DokuWiki */ -// start timing Dokuwiki execution +/** + * timing Dokuwiki execution + */ function delta_time($start=0) { return microtime(true)-((float)$start); } -- cgit v1.2.3 From c8839c220c49633ea45ce5d0e4be1f411f66ad6c Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sat, 14 Jul 2012 12:10:08 +0100 Subject: changed all doctypes to html5 doctype --- inc/init.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index a28050736..00ab2afe9 100644 --- a/inc/init.php +++ b/inc/init.php @@ -497,8 +497,7 @@ function is_ssl(){ */ function nice_die($msg){ echo<< + DokuWiki Setup Error -- cgit v1.2.3 From 65f6e7d681429606c80d257b157e2af13f11e67a Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Fri, 24 Aug 2012 14:16:30 +0200 Subject: Disable compression when a compressed sitemap might be delivered FS#2576 Compressing a gzip file again for transport is standards compliant, but some clients assume that the file is only compressed once then and don't remove the outer compression layer. This could disable compression in too many cases theses cases should be rare and shouldn't cause any problems. --- inc/init.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 00ab2afe9..4105225ea 100644 --- a/inc/init.php +++ b/inc/init.php @@ -129,9 +129,13 @@ if(!defined('DOKU_TPLINC')) define('DOKU_TPLINC', // enable gzip compression if supported $conf['gzip_output'] &= (strpos($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !== false); +global $ACT; if ($conf['gzip_output'] && !defined('DOKU_DISABLE_GZIP_OUTPUT') && - function_exists('ob_gzhandler')) { + function_exists('ob_gzhandler') && + // Disable compression when a compressed sitemap might be delivered + // See https://bugs.dokuwiki.org/index.php?do=details&task_id=2576 + !($ACT == 'sitemap' && Sitemapper::sitemapIsCompressed())) { ob_start('ob_gzhandler'); } -- cgit v1.2.3 From 99e10b7f23d5d909db42434325a51a9c626fd8fb Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Fri, 24 Aug 2012 17:24:07 +0200 Subject: Always disable compression when sitemaps are delivered The class loader isn't available at that place in inc/init.php so the check if the sitemap is compressed didn't work. --- inc/init.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 4105225ea..3cafab986 100644 --- a/inc/init.php +++ b/inc/init.php @@ -133,9 +133,9 @@ global $ACT; if ($conf['gzip_output'] && !defined('DOKU_DISABLE_GZIP_OUTPUT') && function_exists('ob_gzhandler') && - // Disable compression when a compressed sitemap might be delivered + // Disable compression when a (compressed) sitemap might be delivered // See https://bugs.dokuwiki.org/index.php?do=details&task_id=2576 - !($ACT == 'sitemap' && Sitemapper::sitemapIsCompressed())) { + $ACT != 'sitemap') { ob_start('ob_gzhandler'); } -- cgit v1.2.3 From c114d4c4a0ef8fa3f244e09219868b02f6c01c67 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 26 Aug 2012 13:25:29 +0200 Subject: don't call set_magic_quotes_runtime if it doesn't exists FS#2583 this function was removed in PHP 5.4.0 --- inc/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 3cafab986..9568d9b93 100644 --- a/inc/init.php +++ b/inc/init.php @@ -166,7 +166,7 @@ if (get_magic_quotes_gpc() && !defined('MAGIC_QUOTES_STRIPPED')) { @ini_set('magic_quotes_gpc', 0); define('MAGIC_QUOTES_STRIPPED',1); } -@set_magic_quotes_runtime(0); +if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0); @ini_set('magic_quotes_sybase',0); // don't let cookies ever interfere with request vars -- cgit v1.2.3