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