From 59bc3b48fdffb76ee65a4b630be3ffa1f6c20c80 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 29 Sep 2014 21:45:27 +0200 Subject: more scrutinizer issue improvements --- lib/exe/indexer.php | 2 +- lib/plugins/acl/admin.php | 6 +++--- lib/plugins/acl/remote.php | 2 ++ lib/plugins/auth.php | 5 ++++- lib/plugins/authad/adLDAP/adLDAP.php | 2 -- lib/plugins/authad/auth.php | 1 + lib/plugins/authldap/auth.php | 1 + lib/plugins/authmysql/auth.php | 2 +- lib/plugins/config/settings/config.class.php | 4 +++- lib/plugins/config/settings/extra.class.php | 7 ++++--- lib/plugins/info/syntax.php | 13 +++++++++---- lib/plugins/usermanager/admin.php | 6 ++++-- 12 files changed, 33 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index d0a5e0463..89c4b7cd0 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -84,7 +84,7 @@ function runTrimRecentChanges($media_changes = false) { io_saveFile($fn.'_tmp', ''); // presave tmp as 2nd lock $trim_time = time() - $conf['recent_days']*86400; $out_lines = array(); - + $old_lines = array(); for ($i=0; $iwho && !in_array($this->who,$this->usersgroups) && @@ -770,11 +772,9 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { if($this->who{0} == '@'){ $gsel = ' selected="selected"'; }else{ - $usel = ' selected="selected"'; + $usel = ' selected="selected"'; } }else{ - $usel = ''; - $gsel = ''; $inlist = true; } diff --git a/lib/plugins/acl/remote.php b/lib/plugins/acl/remote.php index 6d5201cf6..2fdc697db 100644 --- a/lib/plugins/acl/remote.php +++ b/lib/plugins/acl/remote.php @@ -18,11 +18,13 @@ class remote_plugin_acl extends DokuWiki_Remote_Plugin { } function addAcl($scope, $user, $level){ + /** @var admin_plugin_acl $apa */ $apa = plugin_load('admin', 'acl'); return $apa->_acl_add($scope, $user, $level); } function delAcl($scope, $user){ + /** @var admin_plugin_acl $apa */ $apa = plugin_load('admin', 'acl'); return $apa->_acl_del($scope, $user); } diff --git a/lib/plugins/auth.php b/lib/plugins/auth.php index b38b591a3..0d6ea2fa3 100644 --- a/lib/plugins/auth.php +++ b/lib/plugins/auth.php @@ -124,8 +124,11 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { 'modify' => 'modifyUser', 'delete' => 'deleteUsers' ); - if(empty($validTypes[$type])) + if(empty($validTypes[$type])) { return false; + } + + $result = false; $eventdata = array('type' => $type, 'params' => $params, 'modification_result' => null); $evt = new Doku_Event('AUTH_USER_CHANGE', $eventdata); if($evt->advise_before(true)) { diff --git a/lib/plugins/authad/adLDAP/adLDAP.php b/lib/plugins/authad/adLDAP/adLDAP.php index c1f92abe2..5563e4fe9 100644 --- a/lib/plugins/authad/adLDAP/adLDAP.php +++ b/lib/plugins/authad/adLDAP/adLDAP.php @@ -947,5 +947,3 @@ class adLDAP { * } */ class adLDAPException extends Exception {} - -?> \ No newline at end of file diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php index a3119dda6..65f0b1647 100644 --- a/lib/plugins/authad/auth.php +++ b/lib/plugins/authad/auth.php @@ -203,6 +203,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { } //general user info + $info = array(); $info['name'] = $result[0]['displayname'][0]; $info['mail'] = $result[0]['mail'][0]; $info['uid'] = $result[0]['samaccountname'][0]; diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php index a94c7a357..fd4729331 100644 --- a/lib/plugins/authldap/auth.php +++ b/lib/plugins/authldap/auth.php @@ -181,6 +181,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { } } + $info = array(); $info['user'] = $user; $info['server'] = $this->getConf('server'); diff --git a/lib/plugins/authmysql/auth.php b/lib/plugins/authmysql/auth.php index 176eac679..0605a3bf1 100644 --- a/lib/plugins/authmysql/auth.php +++ b/lib/plugins/authmysql/auth.php @@ -366,7 +366,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin { * * @param int $first index of first user to be returned * @param int $limit max number of users to be returned - * @param array|string $filter array of field/pattern pairs + * @param array $filter array of field/pattern pairs * @return array userinfo (refer getUserData for internal userinfo details) */ public function retrieveUsers($first = 0, $limit = 0, $filter = array()) { diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 8dae23110..30e7a2133 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -775,6 +775,7 @@ if (!class_exists('setting_email')) { * update setting with user provided value $input * if value fails error check, save it * + * @param mixed $input * @return boolean true if changed, false otherwise (incl. on error) */ function update($input) { @@ -925,6 +926,7 @@ if (!class_exists('setting_onoff')) { if (!class_exists('setting_multichoice')) { class setting_multichoice extends setting_string { var $_choices = array(); + var $lang; //some custom language strings are stored in setting function html(&$plugin, $echo = false) { $value = ''; @@ -1125,7 +1127,7 @@ if (!class_exists('setting_multicheckbox')) { // handle any remaining values $other = join(',',$value); - $class = (count($default == count($value)) && (count($value) == count(array_intersect($value,$default)))) ? + $class = ((count($default) == count($value)) && (count($value) == count(array_intersect($value,$default)))) ? " selectiondefault" : ""; $input .= '
'."\n"; diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 83de802a3..02171fb77 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -122,7 +122,7 @@ if (!class_exists('setting_disableactions')) { // make some language adjustments (there must be a better way) // transfer some DokuWiki language strings to the plugin - if (!$plugin->localised) $this->setupLocale(); + if (!$plugin->localised) $plugin->setupLocale(); $plugin->lang[$this->_key.'_revisions'] = $lang['btn_revs']; foreach ($this->_choices as $choice) @@ -159,7 +159,7 @@ if (!class_exists('setting_license')) { foreach($license as $key => $data){ $this->_choices[] = $key; - $this->lang[$this->_key.'_o_'.$key] = $data['name']; + $this->lang[$this->_key.'_o_'.$key] = $data['name']; // stored in setting } parent::initialize($default,$local,$protected); @@ -171,6 +171,7 @@ if (!class_exists('setting_license')) { if (!class_exists('setting_renderer')) { class setting_renderer extends setting_multichoice { var $_prompts = array(); + var $_format = null; function initialize($default,$local,$protected) { $format = $this->_format; @@ -192,7 +193,7 @@ if (!class_exists('setting_renderer')) { // make some language adjustments (there must be a better way) // transfer some plugin names to the config plugin - if (!$plugin->localised) $this->setupLocale(); + if (!$plugin->localised) $plugin->setupLocale(); foreach ($this->_choices as $choice) { if (!isset($plugin->lang[$this->_key.'_o_'.$choice])) { diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php index 3e3f6b733..fc0e1af9d 100644 --- a/lib/plugins/info/syntax.php +++ b/lib/plugins/info/syntax.php @@ -104,7 +104,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * * uses some of the original renderer methods */ - function _plugins_xhtml($type, Doku_Renderer &$renderer){ + function _plugins_xhtml($type, Doku_Renderer_xhtml $renderer){ global $lang; $renderer->doc .= '
    '; @@ -142,7 +142,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * * uses some of the original renderer methods */ - function _helpermethods_xhtml(Doku_Renderer &$renderer){ + function _helpermethods_xhtml(Doku_Renderer_xhtml $renderer){ $plugins = plugin_list('helper'); foreach($plugins as $p){ if (!$po = plugin_load('helper',$p)) continue; @@ -249,12 +249,17 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * Adds a TOC item + * + * @param string $text + * @param int $level + * @param Doku_Renderer_xhtml $renderer + * @return string */ - function _addToTOC($text, $level, Doku_Renderer &$renderer){ + protected function _addToTOC($text, $level, Doku_Renderer_xhtml $renderer){ global $conf; + $hid = ''; if (($level >= $conf['toptoclevel']) && ($level <= $conf['maxtoclevel'])){ - /** @var $renderer Doku_Renderer_xhtml */ $hid = $renderer->_headerToLink($text, true); $renderer->toc[] = array( 'hid' => $hid, diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php index b67d91b36..c568469a7 100644 --- a/lib/plugins/usermanager/admin.php +++ b/lib/plugins/usermanager/admin.php @@ -738,6 +738,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { global $auth; global $INPUT; + $user = array(); $user[0] = ($clean) ? $auth->cleanUser($INPUT->str('userid')) : $INPUT->str('userid'); $user[1] = $INPUT->str('userpass'); $user[2] = $INPUT->str('username'); @@ -764,7 +765,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { $this->_filter = array(); if ($op == 'new') { - list($user,$pass,$name,$mail,$grps) = $this->_retrieveUser(false); + list($user,/* $pass */,$name,$mail,$grps) = $this->_retrieveUser(false); if (!empty($user)) $this->_filter['user'] = $user; if (!empty($name)) $this->_filter['name'] = $name; @@ -816,6 +817,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { $disabled = 'disabled="disabled"'; + $buttons = array(); $buttons['start'] = $buttons['prev'] = ($this->_start == 0) ? $disabled : ''; if ($this->_user_total == -1) { @@ -951,7 +953,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { $INPUT->set('usergroups', $candidate[4]); $cleaned = $this->_retrieveUser(); - list($user,$pass,$name,$mail,$grps) = $cleaned; + list($user,/* $pass */,$name,$mail,/* $grps */) = $cleaned; if (empty($user)) { $error = $this->lang['import_error_baduserid']; return false; -- cgit v1.2.3