diff options
author | Andreas Gohr <andi@splitbrain.org> | 2023-08-31 15:04:10 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2023-08-31 15:04:10 +0200 |
commit | 7d34963b3e75ea04c63ec066a6b7a692e123cb53 (patch) | |
tree | dbcc4e2398997a0c61fc0d528a3075c0d5f00d96 /lib/plugins | |
parent | cb7312c0f5cb7e9e97681814090f1eab6df43b58 (diff) | |
download | dokuwiki-7d34963b3e75ea04c63ec066a6b7a692e123cb53.tar.gz dokuwiki-7d34963b3e75ea04c63ec066a6b7a692e123cb53.zip |
coding style: control flow line breaks
Diffstat (limited to 'lib/plugins')
-rw-r--r-- | lib/plugins/acl/admin.php | 14 | ||||
-rw-r--r-- | lib/plugins/authad/auth.php | 18 | ||||
-rw-r--r-- | lib/plugins/authldap/auth.php | 25 | ||||
-rw-r--r-- | lib/plugins/config/core/Setting/SettingNumeric.php | 6 | ||||
-rw-r--r-- | lib/plugins/config/core/Setting/SettingUndefined.php | 12 | ||||
-rw-r--r-- | lib/plugins/extension/helper/extension.php | 3 | ||||
-rw-r--r-- | lib/plugins/extension/helper/list.php | 3 | ||||
-rw-r--r-- | lib/plugins/extension/helper/repository.php | 6 | ||||
-rw-r--r-- | lib/plugins/styling/action.php | 3 | ||||
-rw-r--r-- | lib/plugins/usermanager/admin.php | 5 |
10 files changed, 59 insertions, 36 deletions
diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php index 4213c4e53..285805f27 100644 --- a/lib/plugins/acl/admin.php +++ b/lib/plugins/acl/admin.php @@ -92,9 +92,11 @@ class admin_plugin_acl extends AdminPlugin if ($this->who != '%USER%' && $this->who != '%GROUP%') { #keep wildcard as is $this->who = $auth->cleanUser($this->who); } - } elseif ($INPUT->str('acl_t') && + } elseif ( + $INPUT->str('acl_t') && $INPUT->str('acl_t') != '__u__' && - $INPUT->str('acl_t') != '__g__') { + $INPUT->str('acl_t') != '__g__' + ) { $this->who = $INPUT->str('acl_t'); } elseif ($who) { $this->who = $who; @@ -809,9 +811,11 @@ class admin_plugin_acl extends AdminPlugin $usel = ''; $gsel = ''; - if ($this->who && - !in_array($this->who, $this->usersgroups) && - !in_array($this->who, $this->specials)) { + if ( + $this->who && + !in_array($this->who, $this->usersgroups) && + !in_array($this->who, $this->specials) + ) { if ($this->who[0] == '@') { $gsel = ' selected="selected"'; } else { diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php index 72f81cc2b..78fba3104 100644 --- a/lib/plugins/authad/auth.php +++ b/lib/plugins/authad/auth.php @@ -159,7 +159,8 @@ class auth_plugin_authad extends AuthPlugin public function checkPass($user, $pass) { global $INPUT; - if ($INPUT->server->str('REMOTE_USER') == $user && + if ( + $INPUT->server->str('REMOTE_USER') == $user && $this->conf['sso'] ) return true; @@ -270,7 +271,8 @@ class auth_plugin_authad extends AuthPlugin $info['expiresin'] = round(($info['expiresat'] - time())/(24*60*60)); // if this is the current user, warn him (once per request only) - if (($INPUT->server->str('REMOTE_USER') == $user) && + if ( + ($INPUT->server->str('REMOTE_USER') == $user) && ($info['expiresin'] <= $this->conf['expirywarn']) && !$this->msgshown ) { @@ -334,8 +336,10 @@ class auth_plugin_authad extends AuthPlugin $user = PhpString::strtolower(trim($user)); // is this a known, valid domain or do we work without account suffix? if not discard - if ((!isset($this->conf[$domain]) || !is_array($this->conf[$domain])) && - $this->conf['account_suffix'] !== '') { + if ( + (!isset($this->conf[$domain]) || !is_array($this->conf[$domain])) && + $this->conf['account_suffix'] !== '' + ) { $domain = ''; } @@ -409,7 +413,8 @@ class auth_plugin_authad extends AuthPlugin $usermanager->setLastdisabled(true); if (!isset($this->grpsusers[$this->filterToString($filter)])) { $this->fillGroupUserArray($filter, $usermanager->getStart() + 3*$usermanager->getPagesize()); - } elseif (count($this->grpsusers[$this->filterToString($filter)]) < + } elseif ( + count($this->grpsusers[$this->filterToString($filter)]) < $usermanager->getStart() + 3*$usermanager->getPagesize() ) { $this->fillGroupUserArray( @@ -539,7 +544,8 @@ class auth_plugin_authad extends AuthPlugin /** @var admin_plugin_usermanager $usermanager */ $usermanager = plugin_load("admin", "usermanager", false); $usermanager->setLastdisabled(true); - if (!isset($this->grpsusers[$this->filterToString($filter)]) || + if ( + !isset($this->grpsusers[$this->filterToString($filter)]) || count($this->grpsusers[$this->filterToString($filter)]) < ($start+$limit) ) { if (!isset($this->grpsusers[$this->filterToString($filter)])) { diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php index b69ab05a4..f2cd94613 100644 --- a/lib/plugins/authldap/auth.php +++ b/lib/plugins/authldap/auth.php @@ -69,7 +69,8 @@ class auth_plugin_authldap extends AuthPlugin return false; } $this->bound = 2; - } elseif ($this->getConf('binddn') && + } elseif ( + $this->getConf('binddn') && $this->getConf('usertree') && $this->getConf('userfilter') ) { @@ -564,11 +565,12 @@ class auth_plugin_authldap extends AuthPlugin //set protocol version and dependend options if ($this->getConf('version')) { - if (!@ldap_set_option( - $this->con, - LDAP_OPT_PROTOCOL_VERSION, - $this->getConf('version') - ) + if ( + !@ldap_set_option( + $this->con, + LDAP_OPT_PROTOCOL_VERSION, + $this->getConf('version') + ) ) { msg('Setting LDAP Protocol version ' . $this->getConf('version') . ' failed', -1); $this->debug('LDAP version set: ' . hsc(ldap_error($this->con)), 0, __LINE__, __FILE__); @@ -582,11 +584,12 @@ class auth_plugin_authldap extends AuthPlugin } // needs version 3 if ($this->getConf('referrals') > -1) { - if (!@ldap_set_option( - $this->con, - LDAP_OPT_REFERRALS, - $this->getConf('referrals') - ) + if ( + !@ldap_set_option( + $this->con, + LDAP_OPT_REFERRALS, + $this->getConf('referrals') + ) ) { msg('Setting LDAP referrals failed', -1); $this->debug('LDAP referal set: ' . hsc(ldap_error($this->con)), 0, __LINE__, __FILE__); diff --git a/lib/plugins/config/core/Setting/SettingNumeric.php b/lib/plugins/config/core/Setting/SettingNumeric.php index 33cc81d64..27ca1945c 100644 --- a/lib/plugins/config/core/Setting/SettingNumeric.php +++ b/lib/plugins/config/core/Setting/SettingNumeric.php @@ -21,8 +21,10 @@ class SettingNumeric extends SettingString $valid = parent::update($input); if ($valid && !(is_null($this->min) && is_null($this->max))) { $numeric_local = (int) eval('return ' . $this->local . ';'); - if ((!is_null($this->min) && $numeric_local < $this->min) || - (!is_null($this->max) && $numeric_local > $this->max)) { + if ( + (!is_null($this->min) && $numeric_local < $this->min) || + (!is_null($this->max) && $numeric_local > $this->max) + ) { $this->error = true; $this->input = $input; $this->local = $local; diff --git a/lib/plugins/config/core/Setting/SettingUndefined.php b/lib/plugins/config/core/Setting/SettingUndefined.php index e20b9c498..a53ab1c04 100644 --- a/lib/plugins/config/core/Setting/SettingUndefined.php +++ b/lib/plugins/config/core/Setting/SettingUndefined.php @@ -23,11 +23,13 @@ class SettingUndefined extends SettingHidden public function html(\admin_plugin_config $plugin, $echo = false) { // determine the name the meta key would be called - if (preg_match( - '/^(?:plugin|tpl)' . Configuration::KEYMARKER . '.*?' . Configuration::KEYMARKER . '(.*)$/', - $this->getKey(), - $undefined_setting_match - )) { + if ( + preg_match( + '/^(?:plugin|tpl)' . Configuration::KEYMARKER . '.*?' . Configuration::KEYMARKER . '(.*)$/', + $this->getKey(), + $undefined_setting_match + ) + ) { $undefined_setting_key = $undefined_setting_match[1]; } else { $undefined_setting_key = $this->getKey(); diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index ceecc9de5..ca3698024 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -919,7 +919,8 @@ class helper_plugin_extension_extension extends Plugin if (isset($http->resp_headers['content-disposition'])) { $content_disposition = $http->resp_headers['content-disposition']; $match = []; - if (is_string($content_disposition) && + if ( + is_string($content_disposition) && preg_match('/attachment;\s*filename\s*=\s*"([^"]*)"/i', $content_disposition, $match) ) { $name = PhpString::basename($match[1]); diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php index cd65c7c1c..2352ae060 100644 --- a/lib/plugins/extension/helper/list.php +++ b/lib/plugins/extension/helper/list.php @@ -588,7 +588,8 @@ class helper_plugin_extension_list extends Plugin if ($extension->isGitControlled()) { $errors .= '<p class="permerror">'.$this->getLang('git').'</p>'; } - if ($extension->isEnabled() && + if ( + $extension->isEnabled() && in_array('Auth', $extension->getTypes()) && $conf['authtype'] != $extension->getID() ) { diff --git a/lib/plugins/extension/helper/repository.php b/lib/plugins/extension/helper/repository.php index c4158b85b..5fa0343d8 100644 --- a/lib/plugins/extension/helper/repository.php +++ b/lib/plugins/extension/helper/repository.php @@ -35,7 +35,8 @@ class helper_plugin_extension_repository extends Plugin foreach ($list as $name) { $cache = new Cache('##extension_manager##'.$name, '.repo'); - if (!isset($this->loaded_extensions[$name]) && + if ( + !isset($this->loaded_extensions[$name]) && $this->hasAccess() && !$cache->useCache(['age' => 3600 * 24]) ) { @@ -100,7 +101,8 @@ class helper_plugin_extension_repository extends Plugin { $cache = new Cache('##extension_manager##'.$name, '.repo'); - if (!isset($this->loaded_extensions[$name]) && + if ( + !isset($this->loaded_extensions[$name]) && $this->hasAccess() && !$cache->useCache(['age' => 3600 * 24]) ) { diff --git a/lib/plugins/styling/action.php b/lib/plugins/styling/action.php index ee03fa751..66ab1dacc 100644 --- a/lib/plugins/styling/action.php +++ b/lib/plugins/styling/action.php @@ -42,7 +42,8 @@ class action_plugin_styling extends ActionPlugin // set preview $len = count($event->data['link']); for ($i = 0; $i < $len; $i++) { - if ($event->data['link'][$i]['rel'] == 'stylesheet' && + if ( + $event->data['link'][$i]['rel'] == 'stylesheet' && strpos($event->data['link'][$i]['href'], 'lib/exe/css.php') !== false ) { $event->data['link'][$i]['href'] .= '&preview=1&tseed='.time(); diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php index b53b45480..2cacb74ee 100644 --- a/lib/plugins/usermanager/admin.php +++ b/lib/plugins/usermanager/admin.php @@ -361,7 +361,7 @@ class admin_plugin_usermanager extends AdminPlugin { /** @var AuthPlugin $auth */ global $auth; - if (!$auth || !$auth->canDo('getUsers') ) { + if (!$auth || !$auth->canDo('getUsers')) { return false; } @@ -1058,7 +1058,8 @@ class admin_plugin_usermanager extends AdminPlugin if (!$this->auth->canDo('addUser')) return false; // check file uploaded ok. - if (empty($_FILES['import']['size']) || + if ( + empty($_FILES['import']['size']) || !empty($_FILES['import']['error']) && $this->isUploadedFile($_FILES['import']['tmp_name']) ) { msg($this->lang['import_error_upload'], -1); |