From 0e80bb5e347ff00c6f81627d8e39dafaaa923bc5 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 5 Mar 2014 21:58:46 +0000 Subject: use empty() where array values might not be set --- lib/exe/mediamanager.php | 4 ++-- lib/plugins/acl/admin.php | 2 +- lib/plugins/usermanager/admin.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php index d94a24c74..7044232ce 100644 --- a/lib/exe/mediamanager.php +++ b/lib/exe/mediamanager.php @@ -57,7 +57,7 @@ } // give info on PHP caught upload errors - if($_FILES['upload']['error']){ + if(!empty($_FILES['upload']['error'])){ switch($_FILES['upload']['error']){ case 1: case 2: @@ -71,7 +71,7 @@ } // handle upload - if($_FILES['upload']['tmp_name']){ + if(!empty($_FILES['upload']['tmp_name'])){ $JUMPTO = media_upload($NS,$AUTH); if($JUMPTO) $NS = getNS($JUMPTO); } diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php index 6c7c28ff6..00bf9969f 100644 --- a/lib/plugins/acl/admin.php +++ b/lib/plugins/acl/admin.php @@ -488,7 +488,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { function _html_list_acl($item){ $ret = ''; // what to display - if($item['label']){ + if(!empty($item['label'])){ $base = $item['label']; }else{ $base = ':'.$item['id']; diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php index eadfb76ad..b67d91b36 100644 --- a/lib/plugins/usermanager/admin.php +++ b/lib/plugins/usermanager/admin.php @@ -53,7 +53,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { } // attempt to retrieve any import failures from the session - if ($_SESSION['import_failures']){ + if (!empty($_SESSION['import_failures'])){ $this->_import_failures = $_SESSION['import_failures']; } } -- cgit v1.2.3 From d072820d2d17a702aaa47a0dccb89cd50f982b98 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 5 Mar 2014 22:11:19 +0000 Subject: improvements in acl plugin to avoid missing var errors --- lib/plugins/acl/admin.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php index 00bf9969f..de38aedd5 100644 --- a/lib/plugins/acl/admin.php +++ b/lib/plugins/acl/admin.php @@ -268,7 +268,10 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { usort($data,array($this,'_tree_sort')); $count = count($data); if($count>0) for($i=1; $i<$count; $i++){ - if($data[$i-1]['id'] == $data[$i]['id'] && $data[$i-1]['type'] == $data[$i]['type']) unset($data[$i]); + if($data[$i-1]['id'] == $data[$i]['id'] && $data[$i-1]['type'] == $data[$i]['type']) { + unset($data[$i]); + $i++; // duplicate found, next $i can't be a duplicate, so skip forward one + } } return $data; } @@ -496,8 +499,11 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { } // highlight? - if( ($item['type']== $this->current_item['type'] && $item['id'] == $this->current_item['id'])) + if( ($item['type']== $this->current_item['type'] && $item['id'] == $this->current_item['id'])) { $cl = ' cur'; + } else { + $cl = ''; + } // namespace or page? if($item['type']=='d'){ -- cgit v1.2.3 From 3cd4fc17379f0f917d5e1ed4d20decfb662aaf32 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 5 Mar 2014 22:18:08 +0000 Subject: remove '&' from object parameters, PHP5 style not E_ALL --- lib/plugins/info/syntax.php | 4 ++-- lib/plugins/syntax.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php index f8c6eb484..9265f44d5 100644 --- a/lib/plugins/info/syntax.php +++ b/lib/plugins/info/syntax.php @@ -48,7 +48,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * Handle the match */ - function handle($match, $state, $pos, Doku_Handler &$handler){ + function handle($match, $state, $pos, Doku_Handler $handler){ $match = substr($match,7,-2); //strip ~~INFO: from start and ~~ from end return array(strtolower($match)); } @@ -56,7 +56,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * Create output */ - function render($format, Doku_Renderer &$renderer, $data) { + function render($format, Doku_Renderer $renderer, $data) { if($format == 'xhtml'){ /** @var Doku_Renderer_xhtml $renderer */ //handle various info stuff diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php index 7ab9c30e1..ec90993cf 100644 --- a/lib/plugins/syntax.php +++ b/lib/plugins/syntax.php @@ -66,7 +66,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin { * @param Doku_Handler $handler Reference to the Doku_Handler object * @return array Return an array with all data you want to use in render */ - function handle($match, $state, $pos, Doku_Handler &$handler){ + function handle($match, $state, $pos, Doku_Handler $handler){ trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING); } @@ -93,7 +93,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin { * @param $data array data created by handler() * @return boolean rendered correctly? */ - function render($format, Doku_Renderer &$renderer, $data) { + function render($format, Doku_Renderer $renderer, $data) { trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING); } -- cgit v1.2.3 From a96178004fc8b519df17f6cb907e1c067b964bb2 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Thu, 6 Mar 2014 20:03:30 +0000 Subject: remove reference to reference from comments --- lib/plugins/syntax.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php index ec90993cf..42a4903ec 100644 --- a/lib/plugins/syntax.php +++ b/lib/plugins/syntax.php @@ -63,7 +63,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin { * @param string $match The text matched by the patterns * @param int $state The lexer state for the match * @param int $pos The character position of the matched text - * @param Doku_Handler $handler Reference to the Doku_Handler object + * @param Doku_Handler $handler The Doku_Handler object * @return array Return an array with all data you want to use in render */ function handle($match, $state, $pos, Doku_Handler $handler){ @@ -89,7 +89,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode_Plugin { * created * * @param $format string output format being rendered - * @param $renderer Doku_Renderer reference to the current renderer object + * @param $renderer Doku_Renderer the current renderer object * @param $data array data created by handler() * @return boolean rendered correctly? */ -- cgit v1.2.3