[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.accounts_ldap.inc.php,1.103,1
From: |
Miles Lott <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.accounts_ldap.inc.php,1.103,1.104 |
Date: |
Thu, 07 Mar 2002 23:08:15 -0500 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv27882
Modified Files:
class.accounts_ldap.inc.php
Log Message:
use in_array() instead of class function; formatting
Index: class.accounts_ldap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.accounts_ldap.inc.php,v
retrieving revision 1.103
retrieving revision 1.104
diff -C2 -r1.103 -r1.104
*** class.accounts_ldap.inc.php 27 Feb 2002 03:48:52 -0000 1.103
--- class.accounts_ldap.inc.php 8 Mar 2002 04:08:12 -0000 1.104
***************
*** 46,50 ****
/* search the dn for the given uid */
! if ( ($acct_type == 'g') && $this->group_context )
{
$sri = ldap_search($this->ds,
$this->group_context, 'gidnumber='.$this->account_id);
--- 46,50 ----
/* search the dn for the given uid */
! if( ($acct_type == 'g') && $this->group_context )
{
$sri = ldap_search($this->ds,
$this->group_context, 'gidnumber='.$this->account_id);
***************
*** 74,78 ****
$this->data['fullname'] = $allValues[0]['cn'][0];
! if
($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
{
$this->data['homedirectory'] =
$allValues[0]['homedirectory'][0];
--- 74,78 ----
$this->data['fullname'] = $allValues[0]['cn'][0];
!
if($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
{
$this->data['homedirectory'] =
$allValues[0]['homedirectory'][0];
***************
*** 95,99 ****
/* search the dn for the given u/gidnumber */
! if ( ($acct_type == 'g') && $this->group_context )
{
$sri = ldap_search($this->ds,
$this->group_context, 'gidnumber='.$this->account_id);
--- 95,99 ----
/* search the dn for the given u/gidnumber */
! if( ($acct_type == 'g') && $this->group_context )
{
$sri = ldap_search($this->ds,
$this->group_context, 'gidnumber='.$this->account_id);
***************
*** 109,117 ****
if($acct_type == 'u')
{
! $entry['cn'] = sprintf("%s %s",
$this->data['firstname'], $this->data['lastname']);
}
else
{
! $entry['cn'] =
$this->data['firstname'];
}
--- 109,117 ----
if($acct_type == 'u')
{
! $entry['cn'] = sprintf("%s %s",
$this->data['firstname'], $this->data['lastname']);
}
else
{
! $entry['cn'] =
$this->data['firstname'];
}
***************
*** 125,129 ****
$entry['phpgwaccountexpires'] =
$this->data['expires'];
! if
($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
{
$entry['homedirectory'] =
$this->data['homedirectory'];
--- 125,129 ----
$entry['phpgwaccountexpires'] =
$this->data['expires'];
!
if($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
{
$entry['homedirectory'] =
$this->data['homedirectory'];
***************
*** 135,139 ****
PHP cannot change the dn for the entry.
*/
! if ($acct_type == 'g')
{
$test = $allValues[0]['cn'][0];
--- 135,139 ----
PHP cannot change the dn for the entry.
*/
! if($acct_type == 'g')
{
$test = $allValues[0]['cn'][0];
***************
*** 143,158 ****
$test = $allValues[0]['uid'][0];
}
! if ($test != $this->data['account_lid'])
{
ldap_delete($this->ds,$allValues[0]['dn']);
unset($allValues[0]['dn']);
! while (list($key,$val) = each($allValues[0]))
{
/* Don't include row count and headers
*/
! if (is_string($key) && $key != 'count')
{
! if (is_array($val))
{
! if (count($val) == 1)
{
if($val[0])
--- 143,158 ----
$test = $allValues[0]['uid'][0];
}
! if($test != $this->data['account_lid'])
{
ldap_delete($this->ds,$allValues[0]['dn']);
unset($allValues[0]['dn']);
! while(list($key,$val) = each($allValues[0]))
{
/* Don't include row count and headers
*/
! if(is_string($key) && $key != 'count')
{
! if(is_array($val))
{
! if(count($val) == 1)
{
if($val[0])
***************
*** 163,167 ****
else
{
! for
($i=0;$i<count($val);$i++)
{
if($val[$i])
--- 163,167 ----
else
{
!
for($i=0;$i<count($val);$i++)
{
if($val[$i])
***************
*** 180,184 ****
/* Groups */
! if ($this->data['account_type'] == 'g' &&
$this->group_context )
{
$dn =
'cn='.$this->data['account_lid'].','.$this->group_context;
--- 180,184 ----
/* Groups */
! if($this->data['account_type'] == 'g' &&
$this->group_context )
{
$dn =
'cn='.$this->data['account_lid'].','.$this->group_context;
***************
*** 190,197 ****
$members =
$this->member($this->data["account_id"]);
$entry['memberuid'] = array();
! for ($i=0;$i<count($members);$i++)
{
$currname =
$this->id2name($members[$i]['account_id']);
! if
(!$this->isin_array($currname,$entry['memberuid']))
{
$entry['memberuid'][] =
$currname;
--- 190,197 ----
$members =
$this->member($this->data["account_id"]);
$entry['memberuid'] = array();
! for($i=0;$i<count($members);$i++)
{
$currname =
$this->id2name($members[$i]['account_id']);
!
if(address@hidden($currname,$entry['memberuid']))
{
$entry['memberuid'][] =
$currname;
***************
*** 218,222 ****
$entry['objectclass'][6] =
'phpgwAccount';
! if
($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
{
$entry['homedirectory'] =
$this->data['homedirectory'];
--- 218,222 ----
$entry['objectclass'][6] =
'phpgwAccount';
!
if($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
{
$entry['homedirectory'] =
$this->data['homedirectory'];
***************
*** 230,241 ****
else
{
! if ($this->data['account_type'] == 'g' &&
$this->group_context )
{
$members =
$this->member($this->data['account_id']);
$entry['memberuid'] = array();
! for ($i=0;$i<count($members);$i++)
{
$currname =
$this->id2name($members[$i]['account_id']);
! if
(!$this->isin_array($currname,$entry['memberuid']))
{
$entry['memberuid'][] =
$currname;
--- 230,241 ----
else
{
! if($this->data['account_type'] == 'g' &&
$this->group_context )
{
$members =
$this->member($this->data['account_id']);
$entry['memberuid'] = array();
! for($i=0;$i<count($members);$i++)
{
$currname =
$this->id2name($members[$i]['account_id']);
!
if(address@hidden($currname,$entry['memberuid']))
{
$entry['memberuid'][] =
$currname;
***************
*** 245,249 ****
unset($entry['sn']);
}
! while (list($key,$val) = each($entry))
{
$tmpentry = '';
--- 245,249 ----
unset($entry['sn']);
}
! while(list($key,$val) = each($entry))
{
$tmpentry = '';
***************
*** 257,263 ****
}
! if ($tmpentry[$key] && $key)
{
! if (!$allValues[0][$key][0])
{
/* attribute was not in
LDAP, add it */
--- 257,263 ----
}
! if($tmpentry[$key] && $key)
{
! if(!$allValues[0][$key][0])
{
/* attribute was not in
LDAP, add it */
***************
*** 272,278 ****
}
/* If status is to be set inactive, insert a
space here. This is trimmed in read_repository. */
! if (!$entry['phpgwaccountstatus'])
{
! if
(!$allValues[0]['phpgwaccountstatus'][0])
{
/* attribute was not in LDAP,
add it */
--- 272,278 ----
}
/* If status is to be set inactive, insert a
space here. This is trimmed in read_repository. */
! if(!$entry['phpgwaccountstatus'])
{
!
if(!$allValues[0]['phpgwaccountstatus'][0])
{
/* attribute was not in LDAP,
add it */
***************
*** 288,306 ****
}
- function isin_array($needle,$haystack='')
- {
- if(gettype($haystack) != 'array')
- {
- return False;
- }
- for($i=0;$i<count($haystack) && $haystack[$i]
!=$needle;$i++);
- return ($i!=count($haystack));
- }
-
function delete($accountid = '')
{
$account_id = get_account_id($accountid);
$account_lid = $this->id2name($account_id);
!
$sri = ldap_search($this->ds, $this->group_context,
'gidnumber='.$account_id);
$allValues = ldap_get_entries($this->ds, $sri);
--- 288,296 ----
}
function delete($accountid = '')
{
$account_id = get_account_id($accountid);
$account_lid = $this->id2name($account_id);
!
$sri = ldap_search($this->ds, $this->group_context,
'gidnumber='.$account_id);
$allValues = ldap_get_entries($this->ds, $sri);
***************
*** 312,316 ****
}
! if ($allValues[0]['dn'])
{
$del = ldap_delete($this->ds,
$allValues[0]['dn']);
--- 302,306 ----
}
! if($allValues[0]['dn'])
{
$del = ldap_delete($this->ds,
$allValues[0]['dn']);
***************
*** 320,338 ****
function get_list($_type='both', $start = '',$sort = '', $order
= '', $query = '', $offset = '')
{
! if ($offset)
{
$limitclause =
'';//$phpgw->db->limit($start,$offset);
}
! elseif ($start && !$offset)
{
$limitclause = '';//$phpgw->db->limit($start);
}
! if (! $sort)
{
$sort = '';//"desc";
}
! if ($order)
{
$orderclause = '';//"order by $order $sort";
--- 310,328 ----
function get_list($_type='both', $start = '',$sort = '', $order
= '', $query = '', $offset = '')
{
! if($offset)
{
$limitclause =
'';//$phpgw->db->limit($start,$offset);
}
! elseif($start && !$offset)
{
$limitclause = '';//$phpgw->db->limit($start);
}
! if(!$sort)
{
$sort = '';//"desc";
}
! if($order)
{
$orderclause = '';//"order by $order $sort";
***************
*** 343,357 ****
}
! 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))
{
settype($allVals,'array');
$test = @$allVals['uid'][0];
! 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(
--- 333,350 ----
}
! 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))
{
settype($allVals,'array');
$test = @$allVals['uid'][0];
!
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(
***************
*** 367,381 ****
}
}
! 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))
{
settype($allVals,'array');
$test = $allVals['cn'][0];
! 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(
--- 360,377 ----
}
}
! 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))
{
settype($allVals,'array');
$test = $allVals['cn'][0];
!
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(
***************
*** 407,411 ****
$allValues = ldap_get_entries($this->ds, $sri);
! if (@$allValues[0]['gidnumber'][0])
{
$name_list[$account_lid] =
intval($allValues[0]['gidnumber'][0]);
--- 403,407 ----
$allValues = ldap_get_entries($this->ds, $sri);
! if(@$allValues[0]['gidnumber'][0])
{
$name_list[$account_lid] =
intval($allValues[0]['gidnumber'][0]);
***************
*** 416,420 ****
$allValues = ldap_get_entries($this->ds, $sri);
! if (@$allValues[0]['uidnumber'][0])
{
$name_list[$account_lid] =
intval($allValues[0]['uidnumber'][0]);
--- 412,416 ----
$allValues = ldap_get_entries($this->ds, $sri);
! if(@$allValues[0]['uidnumber'][0])
{
$name_list[$account_lid] =
intval($allValues[0]['uidnumber'][0]);
***************
*** 438,442 ****
$allValues = ldap_get_entries($this->ds, $sri);
! if (@$allValues[0]['cn'][0])
{
$id_list[$account_id] = $allValues[0]['cn'][0];
--- 434,438 ----
$allValues = ldap_get_entries($this->ds, $sri);
! if(@$allValues[0]['cn'][0])
{
$id_list[$account_id] = $allValues[0]['cn'][0];
***************
*** 448,452 ****
$allValues = ldap_get_entries($this->ds, $sri);
! if (@$allValues[0]['uid'][0])
{
$id_list[$account_id] = $allValues[0]['uid'][0];
--- 444,448 ----
$allValues = ldap_get_entries($this->ds, $sri);
! if(@$allValues[0]['uid'][0])
{
$id_list[$account_id] = $allValues[0]['uid'][0];
***************
*** 459,463 ****
function get_type($accountid = '')
{
! if (isset($this->account_type))
{
return $this->account_type;
--- 455,459 ----
function get_type($accountid = '')
{
! if(isset($this->account_type))
{
return $this->account_type;
***************
*** 476,480 ****
$allValues = ldap_get_entries($this->ds, $sri);
! if ($allValues[0]['phpgwaccounttype'][0])
{
$allValues[0]['phpgwaccounttype'][0];
--- 472,476 ----
$allValues = ldap_get_entries($this->ds, $sri);
! if($allValues[0]['phpgwaccounttype'][0])
{
$allValues[0]['phpgwaccounttype'][0];
***************
*** 487,491 ****
$allValues = ldap_get_entries($this->ds, $sri);
! if ($allValues[0]['phpgwaccounttype'][0])
{
$account_type[$account_id] =
$allValues[0]['phpgwaccounttype'][0];
--- 483,487 ----
$allValues = ldap_get_entries($this->ds, $sri);
! if($allValues[0]['phpgwaccounttype'][0])
{
$account_type[$account_id] =
$allValues[0]['phpgwaccounttype'][0];
***************
*** 498,502 ****
/*
* returns nonzero if $account exists in LDAP: 0: nowhere 1:
user accounts, 2: group accounts, 3: both
! * $account can be an account_id (LDAP: uidnumber) or an
account_lid (LDAP: uid) (is determinded by gettype($account) == 'integer')
*/
function exists($account)
--- 494,498 ----
/*
* returns nonzero if $account exists in LDAP: 0: nowhere 1:
user accounts, 2: group accounts, 3: both
! * $account can be an account_id (LDAP: uidnumber) or an
account_lid (LDAP: uid) (is determinded by is_int($account))
*/
function exists($account)
***************
*** 530,534 ****
$acct_type = $this->get_type($account);
! if ($acct_type == 'g' && $this->group_context)
{
$sri = ldap_search($this->ds,
$this->group_context, $ldapgroup . '=' . $account);
--- 526,530 ----
$acct_type = $this->get_type($account);
! if($acct_type == 'g' && $this->group_context)
{
$sri = ldap_search($this->ds,
$this->group_context, $ldapgroup . '=' . $account);
***************
*** 538,546 ****
$users = ldap_get_entries($this->ds, $sri);
! if ($users[0]['dn'])
{
$in += 1;
}
! if ($groups[0]['dn'])
{
$in += 2;
--- 534,542 ----
$users = ldap_get_entries($this->ds, $sri);
! if($users[0]['dn'])
{
$in += 1;
}
! if($groups[0]['dn'])
{
$in += 2;
***************
*** 564,568 ****
{
/* echo '<br>in create for account_lid:
"'.$account_lid.'"'; */
! if (empty($account_info['account_id']) ||
!$account_info['account_id'])
{
$account_id =
$this->get_nextid($account_info['account_type']);
--- 560,564 ----
{
/* echo '<br>in create for account_lid:
"'.$account_lid.'"'; */
! if(empty($account_info['account_id']) ||
!$account_info['account_id'])
{
$account_id =
$this->get_nextid($account_info['account_type']);
***************
*** 577,581 ****
$entry['phpgwaccountexpires'] =
$account_info['account_expires'];
! if ($account_info['account_type'] == 'g')
{
$sri = ldap_search($this->ds,
$this->group_context, 'cn=' . $account_info['account_lid']);
--- 573,577 ----
$entry['phpgwaccountexpires'] =
$account_info['account_expires'];
! if($account_info['account_type'] == 'g')
{
$sri = ldap_search($this->ds,
$this->group_context, 'cn=' . $account_info['account_lid']);
***************
*** 587,591 ****
$allValues = ldap_get_entries($this->ds, $sri);
! if
($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'] &&
$account_info['account_type'] != 'g')
{
$entry['homedirectory'] =
$account_info['homedirectory'] && $account_info['homedirectory'] !=
$GLOBALS['phpgw_info']['server']['ldap_account_home'] ?
$account_info['homedirectory'] :
$GLOBALS['phpgw_info']['server']['ldap_account_home'].SEP.$account_info['account_lid'];
--- 583,587 ----
$allValues = ldap_get_entries($this->ds, $sri);
!
if($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'] &&
$account_info['account_type'] != 'g')
{
$entry['homedirectory'] =
$account_info['homedirectory'] && $account_info['homedirectory'] !=
$GLOBALS['phpgw_info']['server']['ldap_account_home'] ?
$account_info['homedirectory'] :
$GLOBALS['phpgw_info']['server']['ldap_account_home'].SEP.$account_info['account_lid'];
***************
*** 593,597 ****
}
! if ($allValues[0]['dn'])
{
/* This should keep the password from being
overwritten here on ldap import */
--- 589,593 ----
}
! if($allValues[0]['dn'])
{
/* This should keep the password from being
overwritten here on ldap import */
***************
*** 599,610 ****
$entry['gidnumber'] = $account_id;
! while (list($key,$val) = each($entry))
{
$tmpentry = '';
$tmpentry[$key] = trim($val); /* must
trim! */
/* echo '<br>'.$key.' '.$val; */
! if ($tmpentry[$key])
{
! if (!$allValues[0][$key][0])
{
/* attribute was not in
LDAP, add it */
--- 595,606 ----
$entry['gidnumber'] = $account_id;
! while(list($key,$val) = each($entry))
{
$tmpentry = '';
$tmpentry[$key] = trim($val); /* must
trim! */
/* echo '<br>'.$key.' '.$val; */
! if($tmpentry[$key])
{
! if(!$allValues[0][$key][0])
{
/* attribute was not in
LDAP, add it */
***************
*** 619,623 ****
}
! if ($account_info['account_type'] == 'g')
{
$tmpentry['objectclass'][0] = 'top';
--- 615,619 ----
}
! if($account_info['account_type'] == 'g')
{
$tmpentry['objectclass'][0] = 'top';
***************
*** 646,650 ****
{
/* Not already there, we will add it */
! if ($account_info['account_type'] == 'g')
{
$dn =
'cn='.$account_info['account_lid'] . ',' . $this->group_context;
--- 642,646 ----
{
/* Not already there, we will add it */
! if($account_info['account_type'] == 'g')
{
$dn =
'cn='.$account_info['account_lid'] . ',' . $this->group_context;
***************
*** 667,671 ****
$entry['uid'] =
$account_info['account_lid'];
$entry['uidnumber'] = $account_id;
! if
($GLOBALS['phpgw_info']['server']['ldap_group_id'])
{
$entry['gidnumber'] =
$GLOBALS['phpgw_info']['server']['ldap_group_id'];
--- 663,667 ----
$entry['uid'] =
$account_info['account_lid'];
$entry['uidnumber'] = $account_id;
!
if($GLOBALS['phpgw_info']['server']['ldap_group_id'])
{
$entry['gidnumber'] =
$GLOBALS['phpgw_info']['server']['ldap_group_id'];
***************
*** 704,708 ****
return False;
! if ($expiredate)
{
$expires = mktime(2,0,0,date('n',$expiredate),
intval(date('d',$expiredate)), date('Y',$expiredate));
--- 700,704 ----
return False;
! if($expiredate)
{
$expires = mktime(2,0,0,date('n',$expiredate),
intval(date('d',$expiredate)), date('Y',$expiredate));
***************
*** 748,752 ****
}
! if ($default_acls == False)
{
$default_group_lid =
$GLOBALS['phpgw_info']['server']['default_group_lid'];
--- 744,748 ----
}
! if($default_acls == False)
{
$default_group_lid =
$GLOBALS['phpgw_info']['server']['default_group_lid'];
***************
*** 785,789 ****
/* search the dn for the given uid */
! if ( ($acct_type == 'g') && $this->group_context )
{
$sri = ldap_search($this->ds,
$this->group_context, 'gidnumber='.$account_id);
--- 781,785 ----
/* search the dn for the given uid */
! if( ($acct_type == 'g') && $this->group_context )
{
$sri = ldap_search($this->ds,
$this->group_context, 'gidnumber='.$account_id);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.accounts_ldap.inc.php,1.103,1.104,
Miles Lott <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.validator.inc.php,1.2,1.3
- Next by Date:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.translation_file.inc.php,1.2,1.3 class.setup_translation.inc.php,1.1,1.2 class.schema_proc_pgsql.inc.php,1.1,1.2
- Previous by thread:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.validator.inc.php,1.2,1.3
- Next by thread:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.translation_file.inc.php,1.2,1.3 class.setup_translation.inc.php,1.1,1.2 class.schema_proc_pgsql.inc.php,1.1,1.2
- Index(es):