From 6e921cf4fe451f4608d37bb0813d7829c71e95b6 Mon Sep 17 00:00:00 2001 From: Benoit Mortier <benoit.mortier@opensides.be> Date: Fri, 2 Dec 2016 22:38:40 +0100 Subject: [PATCH] sonar fixes: 2 statements were found on this line. Reformat the code to have only one statement per line Signed-off-by: Benoit Mortier <benoit.mortier@opensides.be> --- include/class_ldap.inc | 36 +++++++++++++++++------ include/class_management.inc | 55 +++++++++++++++++++++++++----------- include/class_userinfo.inc | 4 ++- include/functions_debug.inc | 4 ++- 4 files changed, 73 insertions(+), 26 deletions(-) diff --git a/include/class_ldap.inc b/include/class_ldap.inc index cc84bc9b2..66e2cbde9 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -572,7 +572,10 @@ class LDAP function rm($attrs = "", $dn = "") { if ($this->hascon) { - if ($this->reconnect) $this->connect(); + if ($this->reconnect) { + $this->connect(); + } + if ($dn == "") $dn = $this->basedn; @@ -588,7 +591,10 @@ class LDAP function mod_add($attrs = "", $dn = "") { if ($this->hascon) { - if ($this->reconnect) $this->connect(); + if ($this->reconnect) { + $this->connect(); + } + if ($dn == "") $dn = $this->basedn; @@ -609,7 +615,10 @@ class LDAP function rmdir($deletedn) { if ($this->hascon) { - if ($this->reconnect) $this->connect(); + if ($this->reconnect) { + $this->connect(); + } + $r = @ldap_delete($this->cid, LDAP::fix($deletedn)); $this->error = @ldap_error($this->cid); return ($r ? $r : 0); @@ -654,7 +663,10 @@ class LDAP $dest_rdn = preg_replace("/,.*$/", "", $dest); if ($this->hascon) { - if ($this->reconnect) $this->connect(); + if ($this->reconnect) { + $this->connect(); + } + $r = ldap_rename($this->cid, @LDAP::fix($source), @LDAP::fix($dest_rdn), @LDAP::fix($parent), FALSE); $this->error = ldap_error($this->cid); @@ -683,7 +695,9 @@ class LDAP function rmdir_recursive($srp, $deletedn) { if ($this->hascon) { - if ($this->reconnect) $this->connect(); + if ($this->reconnect) { + $this->connect(); + } $delarray = array(); /* Get sorted list of dn's to delete */ @@ -743,7 +757,9 @@ class LDAP return 0; } if ($this->hascon) { - if ($this->reconnect) $this->connect(); + if ($this->reconnect) { + $this->connect(); + } $r = @ldap_modify($this->cid, LDAP::fix($this->basedn), $attrs); $this->error = @ldap_error($this->cid); if (!$this->success()) { @@ -764,7 +780,9 @@ class LDAP function add($attrs) { if ($this->hascon) { - if ($this->reconnect) $this->connect(); + if ($this->reconnect) { + $this->connect(); + } $r = @ldap_add($this->cid, LDAP::fix($this->basedn), $attrs); $this->error = @ldap_error($this->cid); if (!$this->success()) { @@ -869,7 +887,9 @@ class LDAP /* Fill in MUST values - but do not overwrite existing ones. */ if (is_array($classes[$ocname]['MUST'])) { foreach ($classes[$ocname]['MUST'] as $attr) { - if (isset($na[$attr]) && !empty($na[$attr])) continue; + if (isset($na[$attr]) && !empty($na[$attr])) { + continue; + } $na[$attr] = 'filled'; } } diff --git a/include/class_management.inc b/include/class_management.inc index dd27c6a9e..c109b54c1 100644 --- a/include/class_management.inc +++ b/include/class_management.inc @@ -200,8 +200,9 @@ class management } // No bases specified? Try base - if (!count($bases)) $bases[] = $this->headpage->getBase(); - + if (!count($bases)) { + $bases[] = $this->headpage->getBase(); + } $this->snapHandler->setSnapshotBases($bases); } @@ -379,9 +380,12 @@ class management $tabClass = $this->tabClass; $aclCategory = $this->aclCategory; - if (!empty($altTabClass)) $tabClass = $altTabClass; - if (!empty($altTabType)) $tabType = $altTabType; - if (!empty($altAclCategory)) $aclCategory = $altAclCategory; + if (!empty($altTabClass)) + $tabClass = $altTabClass; + if (!empty($altTabType)) + $tabType = $altTabType; + if (!empty($altAclCategory)) + $aclCategory = $altAclCategory; @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, "Entry removal confirmed!"); @@ -423,9 +427,15 @@ class management return array(); } $action = $this->headpage->getAction(); - if (isset($_POST['edit_apply'])) $action['action'] = 'apply'; - if (isset($_POST['edit_finish'])) $action['action'] = 'save'; - if (isset($_POST['edit_cancel'])) $action['action'] = 'cancel'; + if (isset($_POST['edit_apply'])) { + $action['action'] = 'apply'; + } + if (isset($_POST['edit_finish'])) { + $action['action'] = 'save'; + } + if (isset($_POST['edit_cancel'])) { + $action['action'] = 'cancel'; + } if (!$this->is_modal_dialog()) { if (isset($_POST['delete_confirmed'])) { $action['action'] = 'removeConfirmed'; @@ -545,8 +555,9 @@ class management } // No bases specified? Try base - if (!count($bases)) $bases[] = $this->headpage->getBase(); - + if (!count($bases)) { + $bases[] = $this->headpage->getBase(); + } if (!count($target)) { // No target, open the restore removed object dialog. $this->dn = $this->headpage->getBase(); @@ -652,9 +663,15 @@ class management $tabType = $this->tabType; $tabClass = $this->tabClass; $aclCategory = $this->aclCategory; - if (!empty($altTabClass)) $tabClass = $altTabClass; - if (!empty($altTabType)) $tabType = $altTabType; - if (!empty($altAclCategory)) $aclCategory = $altAclCategory; + if (!empty($altTabClass)) { + $tabClass = $altTabClass; + } + if (!empty($altTabType)) { + $tabType = $altTabType; + } + if (!empty($altAclCategory)) { + $aclCategory = $altAclCategory; + } // Check locking & lock entry if required $this->displayApplyBtn = FALSE; @@ -726,9 +743,15 @@ class management $tabType = $this->tabType; $tabClass = $this->tabClass; $aclCategory = $this->aclCategory; - if (!empty($altTabClass)) $tabClass = $altTabClass; - if (!empty($altTabType)) $tabType = $altTabType; - if (!empty($altAclCategory)) $aclCategory = $altAclCategory; + if (!empty($altTabClass)) { + $tabClass = $altTabClass; + } + if (!empty($altTabType)) { + $tabType = $altTabType; + } + if (!empty($altAclCategory)) { + $aclCategory = $altAclCategory; + } $this->displayApplyBtn = count($target) == 1; diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc index 4145e79dc..081ef3b59 100644 --- a/include/class_userinfo.inc +++ b/include/class_userinfo.inc @@ -678,7 +678,9 @@ class userinfo /* For all gosaDepartments */ foreach ($config->departments as $dn) { - if (isset($deps[$dn])) continue; + if (isset($deps[$dn])) { + continue; + } $acl = ""; if (strpos($mod, '/')) { $acl .= $this->get_permissions($dn, $mod); diff --git a/include/functions_debug.inc b/include/functions_debug.inc index a5322e2d7..709a9711a 100644 --- a/include/functions_debug.inc +++ b/include/functions_debug.inc @@ -326,7 +326,9 @@ function show_vars($show_all_vars = FALSE, $show_object_vars = FALSE) } foreach ($vars_arr as $vars_name => $vars_data) { - if ($vars_name != 'script_globals') global $$vars_name; + if ($vars_name != 'script_globals') { + global $$vars_name; + } if ($$vars_name) { print '<div class="vars-container" style="background-color:'.$vars_data[1].';"><span class="varsname">'.$vars_data[0].'</span><br />'; print_a($$vars_name, FALSE, $show_object_vars, FALSE ); -- GitLab