From 3725cfb245bfae3a77baf857ea5403e8064b84b9 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 07 May 2013 09:12:22 -0400
Subject: [PATCH] Avoid uninitialized/unused variables

---
 program/lib/Roundcube/rcube_ldap.php |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index 26f46a0..70163b2 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -169,7 +169,7 @@
         // Build sub_fields filter
         if (!empty($this->prop['sub_fields']) && is_array($this->prop['sub_fields'])) {
             $this->sub_filter = '';
-            foreach ($this->prop['sub_fields'] as $attr => $class) {
+            foreach ($this->prop['sub_fields'] as $class) {
                 if (!empty($class)) {
                     $class = is_array($class) ? array_pop($class) : $class;
                     $this->sub_filter .= '(objectClass=' . $class . ')';
@@ -1035,7 +1035,6 @@
                 $mail_field  = $this->fieldmap['email'];
 
                 // try to extract surname and firstname from displayname
-                $reverse_map = array_flip($this->fieldmap);
                 $name_parts  = preg_split('/[\s,.]+/', $save_data['name']);
 
                 if ($sn_field && $missing[$sn_field]) {
@@ -1107,7 +1106,7 @@
         // Remove attributes that need to be added separately (child objects)
         $xfields = array();
         if (!empty($this->prop['sub_fields']) && is_array($this->prop['sub_fields'])) {
-            foreach ($this->prop['sub_fields'] as $xf => $xclass) {
+            foreach (array_keys($this->prop['sub_fields']) as $xf) {
                 if (!empty($newentry[$xf])) {
                     $xfields[$xf] = $newentry[$xf];
                     unset($newentry[$xf]);
@@ -1170,7 +1169,7 @@
             }
         }
 
-        foreach ($this->fieldmap as $col => $fld) {
+        foreach ($this->fieldmap as $fld) {
             if ($fld) {
                 $val = $ldap_data[$fld];
                 $old = $old_data[$fld];
@@ -1783,7 +1782,7 @@
             $vlv_active = $this->_vlv_set_controls($this->prop['groups'], $vlv_page+1, $page_size);
         }
 
-        $function = $this->_scope2func($this->prop['groups']['scope'], $ns_function);
+        $function = $this->_scope2func($this->prop['groups']['scope']);
         $res = @$function($this->conn, $base_dn, $filter, array_unique(array('dn', 'objectClass', $name_attr, $email_attr, $sort_attr)));
         if ($res === false)
         {

--
Gitblit v1.9.1