From 2ba9e5c0d550b1ef7ee921d16f03c9079af74c80 Mon Sep 17 00:00:00 2001
From: Benoit Mortier <benoit.mortier@opensides.be>
Date: Sat, 3 Dec 2016 01:48:10 +0100
Subject: [PATCH] sonar fixes:

Remove this unused "$ui" local variable
Remove this unused "$config" local variable

Signed-off-by: Benoit Mortier <benoit.mortier@opensides.be>
---
 html/index.php                                      |  2 +-
 include/class_listing.inc                           |  2 +-
 include/class_objects.inc                           |  1 -
 include/class_pluglist.inc                          |  2 +-
 include/functions.inc                               | 11 ++++-------
 include/password-methods/class_password-methods.inc |  4 +---
 include/simpleplugin/class_simpleManagement.inc     |  2 +-
 plugins/admin/aclrole/class_aclEditionDialog.inc    |  2 --
 plugins/config/class_configInLdap.inc               |  1 -
 9 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/html/index.php b/html/index.php
index d6fa36667..ef48b50e8 100644
--- a/html/index.php
+++ b/html/index.php
@@ -407,7 +407,7 @@ class Index {
   /* All login steps in the right order for HTTP auth login */
   static function authLoginProcess()
   {
-    global $config, $message, $ui;
+    global $config, $message;
 
     static::init();
 
diff --git a/include/class_listing.inc b/include/class_listing.inc
index 7eb7ece10..45e8e6175 100644
--- a/include/class_listing.inc
+++ b/include/class_listing.inc
@@ -1664,7 +1664,7 @@ class listing
 
   function renderCopyPasteActions($row, $dn, $category, $class, $copy = TRUE, $cut = TRUE)
   {
-    global $config;
+
     // We can only provide information if we've got a copypaste handler
     // instance
     if (!is_object($this->copyPasteHandler)) {
diff --git a/include/class_objects.inc b/include/class_objects.inc
index 8b03a9e2b..6019aa122 100644
--- a/include/class_objects.inc
+++ b/include/class_objects.inc
@@ -146,7 +146,6 @@ class objects
    */
   static function open ($dn, $type)
   {
-    global $config;
 
     $infos    = static::infos($type);
     $tabClass = $infos['tabClass'];
diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc
index daa27428a..1cb89a074 100644
--- a/include/class_pluglist.inc
+++ b/include/class_pluglist.inc
@@ -58,7 +58,7 @@ class pluglist {
    */
   function __construct()
   {
-    global $class_mapping, $config;
+    global $class_mapping;
 
     /* Fill info part of pluglist */
     $classes = get_declared_classes();
diff --git a/include/functions.inc b/include/functions.inc
index 20dce7039..a5b57336b 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -166,7 +166,7 @@ function plugin_available($plugin)
  */
 function load_plist ($ldap_available = TRUE)
 {
-  global $config, $ui;
+  global $config;
   if (!session::global_is_set('plist')) {
     /* Initially load all classes */
     load_all_classes();
@@ -765,8 +765,6 @@ function del_user_locks($userdn)
  */
 function get_lock($object)
 {
-  global $config;
-
   /* Sanity check */
   if ($object == '') {
     msg_dialog::display(_('Internal error'), _('Error while adding a lock. Contact the developers!'), ERROR_DIALOG);
@@ -2200,8 +2198,9 @@ function scan_directory($path, $sort_desc = FALSE)
 
       /* Is this a correct result ?*/
       if ($dir) {
-        while ($fp = readdir($dir))
+        while ($fp = readdir($dir)) {
           $ret[] = $fp;
+        }
       }
     }
   }
@@ -2783,7 +2782,6 @@ function get_correct_class_name($cls)
  */
 function change_password ($dn, $password, $hash = "")
 {
-  global $config;
   $userTabs = objects::open($dn, 'user');
   $userTab  = $userTabs->getBaseObject();
   $userTab->userPassword = array(
@@ -2837,7 +2835,6 @@ function lock_samba_account($mode, $attrs)
 /* Lock or unlock ssh account */
 function lock_ssh_account($mode, $attrs, &$modify)
 {
-  global $config;
   if (!isset($attrs['sshPublicKey'])) {
     return;
   }
@@ -3313,7 +3310,7 @@ function load_all_classes()
 
 function initLanguage($lang = NULL)
 {
-  global $GLOBALS,$BASE_DIR;
+  global $BASE_DIR;
   if ($lang === NULL) {
     $lang = get_browser_language();
   }
diff --git a/include/password-methods/class_password-methods.inc b/include/password-methods/class_password-methods.inc
index 46b2f7413..ab9dcbeac 100644
--- a/include/password-methods/class_password-methods.inc
+++ b/include/password-methods/class_password-methods.inc
@@ -190,7 +190,7 @@ class passwordMethod
    */
   static function get_available_methods()
   {
-    global $class_mapping, $config;
+    global $class_mapping;
     $ret  = FALSE;
     $i    = 0;
 
@@ -291,8 +291,6 @@ class passwordMethod
    */
   static function get_method($password_hash, $dn = "")
   {
-    global $config;
-
     $methods = passwordMethod::get_available_methods();
 
     foreach ($methods['class'] as $class) {
diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc
index f10ea6c6d..6fb5f62d5 100644
--- a/include/simpleplugin/class_simpleManagement.inc
+++ b/include/simpleplugin/class_simpleManagement.inc
@@ -867,7 +867,7 @@ class simpleManagement extends management
 
   static function mainInc ($classname)
   {
-    global $remove_lock, $cleanup, $display, $config, $ui;
+    global $remove_lock, $cleanup, $display;
 
     /* Remove locks */
     if ($remove_lock) {
diff --git a/plugins/admin/aclrole/class_aclEditionDialog.inc b/plugins/admin/aclrole/class_aclEditionDialog.inc
index a8435313f..89ed55392 100644
--- a/plugins/admin/aclrole/class_aclEditionDialog.inc
+++ b/plugins/admin/aclrole/class_aclEditionDialog.inc
@@ -269,8 +269,6 @@ class ACLEditionDialog extends GenericDialog
    */
   function buildAclSelector($list)
   {
-    global $config;
-
     $display  = '<input type="hidden" name="acl_dummy_0_0_0" value="1"/>';
     $cols     = 3;
     $tmp      = session::global_get('plist');
diff --git a/plugins/config/class_configInLdap.inc b/plugins/config/class_configInLdap.inc
index c36be130a..2a44f5647 100644
--- a/plugins/config/class_configInLdap.inc
+++ b/plugins/config/class_configInLdap.inc
@@ -477,7 +477,6 @@ class configInLdap extends simplePlugin
 
   function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE, $attributesInfo = NULL)
   {
-    global $config;
     $attributesInfo = static::getAttributesInfo();
     /* Languages */
     $languages = get_languages(TRUE);
-- 
GitLab