]> git.sur5r.net Git - contagged/commitdiff
use the organization attribute from namedentries() instead of hardcoded o
authorManuel Zach <loogaroo@gmail.com>
Thu, 1 Mar 2007 08:37:23 +0000 (09:37 +0100)
committerManuel Zach <loogaroo@gmail.com>
Thu, 1 Mar 2007 08:37:23 +0000 (09:37 +0100)
If organizations are stored in a different LDAP attribute then the default 'o'
it can now be modfied in the namedentries() function in functions.php

darcs-hash:20070301083723-745c8-50b33d1813c4fb246b31d83cab1285ef663db057.gz

index.php
template.php

index 93954d4f19fa8ada557417972313c4d5fb927fbc..ae8912952a83281c4d9eb2267938d8d61e8464f5 100644 (file)
--- a/index.php
+++ b/index.php
@@ -93,6 +93,9 @@
    * Creates an LDAP filter from given request variables search or filter
    */
   function _makeldapfilter(){
+
+    $f_entries = namedentries(true);
+
     //handle given filter
 
     if (empty($_REQUEST['filter'])) { $_REQUEST['filter']=''; }
       $words=preg_split('/\s+/',$search);
       $filter='';
       foreach($words as $word){
-        $filter .= "(|(|(sn=*$word*)(givenName=*$word*))(o=*$word*))";
+        $filter .= "(|(|(sn=*$word*)(givenName=*$word*))(".$f_entries['organization']."=*$word*))";
       }
       $ldapfilter = "(&(objectClass=inetOrgPerson)$filter)";
     }elseif(!empty($org)){
-      $ldapfilter = "(&(objectClass=inetOrgPerson)(o=$org))";
+      $ldapfilter = "(&(objectClass=inetOrgPerson)(".$f_entries['organization']."=$org))";
     }elseif($filter=='other'){
       $other='';
       for ($i=ord('a');$i<=ord('z');$i++){
index f0fe1fa75a86a94523c6435bef2bd56b0fa17638..df83800a0d8925b1d8911b918331ed89ce653a4a 100644 (file)
@@ -147,23 +147,25 @@ function tpl_orgs(){
   global $LDAP_CON;
   global $smarty;
 
+  $f_entries = namedentries(true);
+  
   $orgs = array();
 
-  $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=inetOrgPerson",array("o"));
+  $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=inetOrgPerson",array($f_entries['organization']));
   $result1 = ldap_get_binentries($LDAP_CON, $sr);
   //check users private addressbook
   if(!empty($_SESSION['ldapab']['binddn'])){
     $sr = @ldap_list($LDAP_CON,
                     $conf['privatebook'].','.$_SESSION['ldapab']['binddn'],
-                    "ObjectClass=inetOrgPerson",array("o"));
+                    "ObjectClass=inetOrgPerson",array($f_entries['organization']));
     $result2 = ldap_get_binentries($LDAP_CON, $sr);
   }
   $result = array_merge((array)$result1,(array)$result2);
 
   if(count($result)){
     foreach ($result as $entry){
-      if(!empty($entry['o'][0])){
-        array_push($orgs, $entry['o'][0]);
+      if(!empty($entry[$f_entries['organization']][0])){
+        array_push($orgs, $entry[$f_entries['organization']][0]);
       }
     }
   }