phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.arrayfunctions.inc.php,NONE,1


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.arrayfunctions.inc.php,NONE,1.1.2.1 class.accounts_ldap.inc.php,1.101.2.4,1.101.2.5
Date: Wed, 26 Jun 2002 18:32:03 -0400

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv26485

Modified Files:
      Tag: Version-0_9_14-branch
        class.accounts_ldap.inc.php 
Added Files:
      Tag: Version-0_9_14-branch
        class.arrayfunctions.inc.php 
Log Message:
some fixes in class.accounts_ldap; added default homedir /home/accountid, if 
value is empty; some sortfunctions

***** Error reading new file: [Errno 2] No such file or directory: 
'class.arrayfunctions.inc.php'
Index: class.accounts_ldap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.accounts_ldap.inc.php,v
retrieving revision 1.101.2.4
retrieving revision 1.101.2.5
diff -C2 -r1.101.2.4 -r1.101.2.5
*** class.accounts_ldap.inc.php 21 May 2002 03:19:53 -0000      1.101.2.4
--- class.accounts_ldap.inc.php 26 Jun 2002 22:32:00 -0000      1.101.2.5
***************
*** 1,27 ****
  <?php
!   /**************************************************************************\
!   * phpGroupWare API - Accounts manager for LDAP                             *
!   * This file written by Joseph Engo <address@hidden>                *
!   * and Lars Kneschke <address@hidden>                            *
!   * View and manipulate account records using LDAP                           *
!   * Copyright (C) 2000, 2001 Joseph Engo                                     *
!   * -------------------------------------------------------------------------*
!   * This library is part of the phpGroupWare API                             *
!   * http://www.phpgroupware.org/api                                          
* 
!   * ------------------------------------------------------------------------ *
!   * This library is free software; you can redistribute it and/or modify it  *
!   * under the terms of the GNU Lesser General Public License as published by *
!   * the Free Software Foundation; either version 2.1 of the License,         *
!   * or any later version.                                                    *
!   * This library is distributed in the hope that it will be useful, but      *
!   * WITHOUT ANY WARRANTY; without even the implied warranty of               *
!   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
!   * See the GNU Lesser General Public License for more details.              *
!   * You should have received a copy of the GNU Lesser General Public License *
!   * along with this library; if not, write to the Free Software Foundation,  *
!   * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
!   \**************************************************************************/
! 
!   /* $Id$ */
  
        class accounts_
--- 1,26 ----
  <?php
!       
/**************************************************************************\
!       * phpGroupWare API - Accounts manager for LDAP                          
   *
!       * This file written by Joseph Engo <address@hidden>                *
!       * and Lars Kneschke <address@hidden>                            *
!       * View and manipulate account records using LDAP                        
   *
!       * Copyright (C) 2000, 2001 Joseph Engo                                  
   *
!       * 
-------------------------------------------------------------------------*
!       * This library is part of the phpGroupWare API                          
   *
!       * http://www.phpgroupware.org/api                                       
   * 
!       * 
------------------------------------------------------------------------ *
!       * This library is free software; you can redistribute it and/or modify 
it  *
!       * under the terms of the GNU Lesser General Public License as published 
by *
!       * the Free Software Foundation; either version 2.1 of the License,      
   *
!       * or any later version.                                                 
   *
!       * This library is distributed in the hope that it will be useful, but   
   *
!       * WITHOUT ANY WARRANTY; without even the implied warranty of            
   *
!       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  
   *
!       * See the GNU Lesser General Public License for more details.           
   *
!       * You should have received a copy of the GNU Lesser General Public 
License *
!       * along with this library; if not, write to the Free Software 
Foundation,  *
!       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
   *
!       
\**************************************************************************/
!       /* $Id$ */
  
        class accounts_
***************
*** 319,322 ****
--- 318,323 ----
                function get_list($_type='both', $start = '',$sort = '', $order 
= '', $query = '', $offset = '')
                {
+                       #print "\$_type=$_type, \$start=$start , \$sort=$sort, 
\$order=$order, \$query=$query, \$offset=$offset<br>";
+                       $query = strtolower($query);
                        if ($offset)
                        {
***************
*** 333,348 ****
                        }
  
-                       if ($order)
-                       {
-                               $orderclause = '';//"order by $order $sort";
-                       }
-                       else
-                       {
-                               $orderclause = '';//"order by 
account_lid,account_lastname,account_firstname asc";
-                       }
- 
                        if ($_type == 'both' || $_type == 'accounts')
                        {
!                               $sri = ldap_search($this->ds, 
$this->user_context, '(&(uidnumber=*)(phpgwaccounttype=u))');
                                $allValues = ldap_get_entries($this->ds, $sri);
                                while (list($null,$allVals) = @each($allValues))
--- 334,348 ----
                        }
  
                        if ($_type == 'both' || $_type == 'accounts')
                        {
!                               if(empty($query) || $query == "*")
!                               {
!                                       $filter = 
"(&(uidnumber=*)(phpgwaccounttype=u))";
!                               }
!                               else
!                               {
!                                       $filter = 
"(&(uidnumber=*)(phpgwaccounttype=u)(|(uid=*$query*)(sn=*$query*)(cn=*$query*)(givenname=*$query*)))";
!                               }
!                               $sri = ldap_search($this->ds, 
$this->user_context, $filter);
                                $allValues = ldap_get_entries($this->ds, $sri);
                                while (list($null,$allVals) = @each($allValues))
***************
*** 352,366 ****
                                        if 
(!$GLOBALS['phpgw_info']['server']['global_denied_users'][$test] && 
$allVals['uid'][0])
                                        {
!                                               if(!$query || strpos(' 
'.$allVals['cn'][0],$query) || strpos(' '.$allVals['givenname'][0],$query) || 
strpos(' '.$allVals['sn'][0],$query))
!                                               {
!                                                       $accounts[] = Array(
!                                                               'account_id'    
    => $allVals['uidnumber'][0],
!                                                               'account_lid'   
    => $allVals['uid'][0],
!                                                               'account_type'  
    => $allVals['phpgwaccounttype'][0],
!                                                               
'account_firstname' => $allVals['givenname'][0],
!                                                               
'account_lastname'  => $allVals['sn'][0],
!                                                               
'account_status'    => $allVals['phpgwaccountstatus'][0]
!                                                       );
!                                               }
                                        }
                                }
--- 352,363 ----
                                        if 
(!$GLOBALS['phpgw_info']['server']['global_denied_users'][$test] && 
$allVals['uid'][0])
                                        {
!                                               $accounts[] = Array(
!                                                       'account_id'        => 
$allVals['uidnumber'][0],
!                                                       'account_lid'       => 
$allVals['uid'][0],
!                                                       'account_type'      => 
$allVals['phpgwaccounttype'][0],
!                                                       'account_firstname' => 
$allVals['givenname'][0],
!                                                       'account_lastname'  => 
$allVals['sn'][0],
!                                                       'account_status'    => 
$allVals['phpgwaccountstatus'][0]
!                                               );
                                        }
                                }
***************
*** 368,372 ****
                        elseif ($_type == 'both' || $_type == 'groups')
                        {
!                               $sri = ldap_search($this->ds, 
$this->group_context, '(&(gidnumber=*)(phpgwaccounttype=g))');
                                $allValues = ldap_get_entries($this->ds, $sri);
                                while (list($null,$allVals) = @each($allValues))
--- 365,377 ----
                        elseif ($_type == 'both' || $_type == 'groups')
                        {
!                               if(empty($query) || $query == "*")
!                               {
!                                       $filter = 
"(&(gidnumber=*)(phpgwaccounttype=g))";
!                               }
!                               else
!                               {
!                                       $filter = 
"(&(gidnumber=*)(phpgwaccounttype=g)(|(uid=*$query*)(sn=*$query*)(cn=*$query*)(givenname=*$query*)))";
!                               }
!                               $sri = ldap_search($this->ds, 
$this->group_context, $filter);
                                $allValues = ldap_get_entries($this->ds, $sri);
                                while (list($null,$allVals) = @each($allValues))
***************
*** 376,395 ****
                                        if 
(!$GLOBALS['phpgw_info']['server']['global_denied_groups'][$test] && 
$allVals['cn'][0])
                                        {
!                                               if(!$query || strpos(' 
'.$allVals['cn'][0],$query) || strpos(' '.$allVals['givenname'][0],$query) || 
strpos(' '.$allVals['sn'][0],$query))
!                                               {
!                                                       $accounts[] = Array(
!                                                               'account_id'    
    => $allVals['gidnumber'][0],
!                                                               'account_lid'   
    => $allVals['cn'][0],
!                                                               'account_type'  
    => $allVals['phpgwaccounttype'][0],
!                                                               
'account_firstname' => $allVals['givenname'][0],
!                                                               
'account_lastname'  => $allVals['sn'][0],
!                                                               
'account_status'    => $allVals['phpgwaccountstatus'][0]
!                                                       );
!                                               }
                                        }
                                }
                        }
                        $this->total = count($accounts);
!                       return $accounts;
                }
  
--- 381,416 ----
                                        if 
(!$GLOBALS['phpgw_info']['server']['global_denied_groups'][$test] && 
$allVals['cn'][0])
                                        {
!                                               $accounts[] = Array(
!                                                       'account_id'        => 
$allVals['gidnumber'][0],
!                                                       'account_lid'       => 
$allVals['cn'][0],
!                                                       'account_type'      => 
$allVals['phpgwaccounttype'][0],
!                                                       'account_firstname' => 
$allVals['givenname'][0],
!                                                       'account_lastname'  => 
$allVals['sn'][0],
!                                                       'account_status'    => 
$allVals['phpgwaccountstatus'][0]
!                                               );
                                        }
                                }
                        }
+                       
+                       // sort the array
+                       $arrayFunctions = 
createObject('phpgwapi.arrayfunctions');
+                       if(empty($order)) $order="account_lid";
+                       $sortedAccounts = 
$arrayFunctions->arfsort($accounts,array($order));
                        $this->total = count($accounts);
!                       
!                       // return only the wanted accounts
!                       reset($sortedAccounts);
!                       if(is_int($start) && is_int($offset))
!                       {
!                               return array_slice($sortedAccounts, $start, 
$offset);
!                       }
!                       elseif(is_int($start))
!                       {
!                               return array_slice($sortedAccounts, $start, 
$GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"]);
!                       }
!                       else
!                       {
!                               return $sortedAccounts;   
!                       }
                }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]