[cvs] [Wiki] changed: CustomizingPreferences

Wiki Guest wikiguest at horde.org
Thu Jun 21 10:25:26 UTC 2007


guest [62.58.32.70]  Thu, 21 Jun 2007 03:25:26 -0700

Modified page: http://wiki.horde.org/CustomizingPreferences
New Revision:  2.3
Change log:  Added check for populated $information

@@ -40,12 +40,14 @@

         $information = @ldap_get_entries($ds, $searchResult);

         // derive the email address if possible
-        if ($information[0]['mail'][0] != '') {
-            $emailname = $information[0]['mail'][0];
-        } else {
-            $emailname = $information[0]['uid'][0] . '@' . $domain_name;
+        if ($information['count'] > 0) {
+            if ($information[0]['mail'][0] != '') {
+                $emailname = $information[0]['mail'][0];
+            } else {
+                $emailname = $information[0]['uid'][0] . '@' .
$domain_name;
+            }
         }

         ldap_close($ds);

@@ -79,12 +81,14 @@

         $information = @ldap_get_entries($ds, $searchResult);

         // derive the email address if possible
-        if ($information[0]['cn'][0] != '') {
-            $name = $information[0]['cn'][0];
-        } else {
-            $name = $information[0]['gecos'][0];
+        if ($information['count'] > 0) {
+            if ($information[0]['cn'][0] != '') {
+                $name = $information[0]['cn'][0];
+            } else {
+                $name = $information[0]['gecos'][0];
+            }
         }

         ldap_close($ds);


More information about the cvs mailing list