diff --git a/html/index.php b/html/index.php
index d6fa366675697e6237b1714171135072ba5f18cb..ef48b50e857e3e004dac01bf79340fab6aa9c446 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 7eb7ece10fbb550d6d84855975bf3bedaade63bd..45e8e6175c8f8061de2133a6cb133c98e1538abf 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 8b03a9e2b71e4f68450a9caae6a59c73784010bf..6019aa122f5b1272a290c4599fd6990db58ac866 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 daa27428a104c55adbb4615cef8491e5c5ecbd35..1cb89a074ee6e513d0844f7fce24b1504e635fc1 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 20dce7039810f4b1afe96b5472ec182f547b56ef..a5b57336bbd178847e95734c070119b840215699 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 46b2f7413b6af610d192d66467b99a80640b0985..ab9dcbeac57ff52caafad378cb7ffaf1aed1d46d 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 f10ea6c6d1b26bc6ac356b92c836a448d108d0b2..6fb5f62d5cfb1807ee8ee07b81fb0091560d43ed 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 a8435313fa24c974ab1e16ebd5f0d3a7b481a42c..89ed55392fe93706666de1eeba940cc49340ed07 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 c36be130a33032655bc33524addaeb559c05fe15..2a44f5647030b9d7a0e1975d6351e9ad80f4dd84 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);