[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.contacts_shared.inc.php,1.9,1
From: |
Miles Lott <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.contacts_shared.inc.php,1.9,1.10 class.contacts_ldap.inc.php,1.11,1.12 class.contacts_sql.inc.php,1.17,1.18 |
Date: |
Fri, 08 Feb 2002 00:04:36 -0500 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv21897
Modified Files:
class.contacts_shared.inc.php class.contacts_ldap.inc.php
class.contacts_sql.inc.php
Log Message:
Formatting, replace gettype with is_???
Index: class.contacts_shared.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_shared.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.contacts_shared.inc.php 5 Jan 2002 23:57:41 -0000 1.9
--- class.contacts_shared.inc.php 8 Feb 2002 05:04:33 -0000 1.10
***************
*** 30,46 ****
function check_perms($has, $needed)
{
! return (!!($has & $needed) == True);
}
function split_stock_and_extras($fields)
{
! while (list($field,$value) = @each($fields))
{
/* Depending on how the array was built, this
is needed. */
! if (gettype($value) == 'integer')
{
$value = $field;
}
! if ($this->stock_contact_fields[$field])
{
$stock_fields[$field] = $value;
--- 30,46 ----
function check_perms($has, $needed)
{
! return(!!($has & $needed) == True);
}
function split_stock_and_extras($fields)
{
! while(list($field,$value) = @each($fields))
{
/* Depending on how the array was built, this
is needed. */
! if(is_int($value))
{
$value = $field;
}
! if($this->stock_contact_fields[$field])
{
$stock_fields[$field] = $value;
***************
*** 58,62 ****
{
$absf = $this->stock_contact_fields;
! while ($t = each($absf))
{
$ta[] =
$this->db->db_addslashes($fields[$t[0]]);
--- 58,62 ----
{
$absf = $this->stock_contact_fields;
! while($t = each($absf))
{
$ta[] =
$this->db->db_addslashes($fields[$t[0]]);
***************
*** 69,75 ****
function delete($id)
{
! if (gettype($id) == 'array')
{
! while (list($null,$t_id) = each($id))
{
$this->delete_($t_id);
--- 69,75 ----
function delete($id)
{
! if(is_array($id))
{
! while(list($null,$t_id) = each($id))
{
$this->delete_($t_id);
***************
*** 84,97 ****
function asc_sort($a,$b)
{
! echo "<br>A:'".$a."' B:'".$b;
! if($a[1]==$b[1]) return 0;
! return ($a[1]>$b[1])?1:-1;
}
function desc_sort($a,$b)
{
! echo "<br>A:'".$a."' B:'".$b;
! if($a[1]==$b[1]) return 0;
! return ($a[1]<$b[1])?1:-1;
}
--- 84,103 ----
function asc_sort($a,$b)
{
! echo "<br>A:'" . $a . "' B:'" . $b;
! if($a[1] == $b[1])
! {
! return 0;
! }
! return ($a[1]>$b[1]) ? 1 : -1;
}
function desc_sort($a,$b)
{
! echo "<br>A:'" . $a . "' B:'" . $b;
! if($a[1]==$b[1])
! {
! return 0;
! }
! return ($a[1]<$b[1]) ? 1 : -1;
}
***************
*** 100,104 ****
Returns 1 if $s1 comes after $s2 alphabetically, 0 if not.
*/
! function comesafter ($s1, $s2)
{
/*
--- 106,110 ----
Returns 1 if $s1 comes after $s2 alphabetically, 0 if not.
*/
! function comesafter($s1, $s2)
{
/*
***************
*** 108,122 ****
$order = 1;
! if ( (strlen($s1) == 0) )
{
return 0;
}
! if ( (strlen($s2) == 0) )
{
return 1;
}
! if (strlen ($s1) > strlen ($s2))
{
$temp = $s1;
--- 114,128 ----
$order = 1;
! if( (strlen($s1) == 0) )
{
return 0;
}
! if( (strlen($s2) == 0) )
{
return 1;
}
! if(strlen ($s1) > strlen ($s2))
{
$temp = $s1;
***************
*** 126,140 ****
}
! for ($index = 0; $index < strlen ($s1); $index++)
{
/* $s1 comes after $s2 */
! if (strtolower($s1[$index]) >
strtolower($s2[$index])) { return ($order); }
!
/* $s1 comes before $s2 */
! if (strtolower($s1[$index]) <
strtolower($s2[$index])) { return (1 - $order); }
}
/* Special case in which $s1 is a substring of
$s2 */
! return ($order);
}
--- 132,151 ----
}
! for($index = 0; $index < strlen ($s1); $index++)
{
/* $s1 comes after $s2 */
! if(strtolower($s1[$index]) >
strtolower($s2[$index]))
! {
! return ($order);
! }
/* $s1 comes before $s2 */
! if(strtolower($s1[$index]) <
strtolower($s2[$index]))
! {
! return (1 - $order);
! }
}
/* Special case in which $s1 is a substring of
$s2 */
! return($order);
}
***************
*** 147,160 ****
* asortby
*/
! function asortbyindex ($sortarray, $index)
{
$lastindex = count($sortarray) - 2;
! for ($subindex = 0; $subindex < $lastindex; $subindex++)
{
$lastiteration = $lastindex - $subindex;
! for ($iteration = 0; $iteration <
$lastiteration; $iteration++)
{
$nextchar = 0;
! if
($this->comesafter($sortarray[$iteration][$index], $sortarray[$iteration +
1][$index]))
{
$temp = $sortarray[$iteration];
--- 158,171 ----
* asortby
*/
! function asortbyindex($sortarray, $index)
{
$lastindex = count($sortarray) - 2;
! for($subindex = 0; $subindex < $lastindex; $subindex++)
{
$lastiteration = $lastindex - $subindex;
! for($iteration = 0; $iteration <
$lastiteration; $iteration++)
{
$nextchar = 0;
!
if($this->comesafter($sortarray[$iteration][$index], $sortarray[$iteration +
1][$index]))
{
$temp = $sortarray[$iteration];
***************
*** 167,180 ****
}
! function arsortbyindex ($sortarray, $index)
{
$lastindex = count($sortarray) - 1;
! for ($subindex = $lastindex; $subindex > 0; $subindex--)
{
$lastiteration = $lastindex - $subindex;
! for ($iteration = $lastiteration; $iteration >
0; $iteration--)
{
$nextchar = 0;
! if
($this->comesafter($sortarray[$iteration][$index], $sortarray[$iteration -
1][$index]))
{
$temp = $sortarray[$iteration];
--- 178,191 ----
}
! function arsortbyindex($sortarray, $index)
{
$lastindex = count($sortarray) - 1;
! for($subindex = $lastindex; $subindex > 0; $subindex--)
{
$lastiteration = $lastindex - $subindex;
! for($iteration = $lastiteration; $iteration >
0; $iteration--)
{
$nextchar = 0;
!
if($this->comesafter($sortarray[$iteration][$index], $sortarray[$iteration -
1][$index]))
{
$temp = $sortarray[$iteration];
***************
*** 187,191 ****
}
! function filter_ldap ($ldap_fields,$filterfields,$DEBUG=0)
{
$match = 0;
--- 198,202 ----
}
! function filter_ldap($ldap_fields,$filterfields,$DEBUG=0)
{
$match = 0;
***************
*** 195,212 ****
$yes = True;
! if ($ldap_fields[$i]['uidnumber'][0])
{
reset($filterfields);
! while (list($col,$filt) =
each($filterfields))
{
! if ($col == 'phpgwcontactcatid')
{
$colarray =
explode(',',$ldap_fields[$i][$col][0]);
! if ($colarray[1])
{
while(list($key,$val) = each ($colarray))
{
if($DEBUG) { echo ' Testing "'.$col.'" for "'.$val.'"'; }
! if
($val == $filt)
{
if($DEBUG) { echo ', and number '.$ldap_fields[$i]['uidnumber'][0].'
matched.'.' '; }
--- 206,223 ----
$yes = True;
! if($ldap_fields[$i]['uidnumber'][0])
{
reset($filterfields);
! while(list($col,$filt) =
each($filterfields))
{
! if($col == 'phpgwcontactcatid')
{
$colarray =
explode(',',$ldap_fields[$i][$col][0]);
! if($colarray[1])
{
while(list($key,$val) = each ($colarray))
{
if($DEBUG) { echo ' Testing "'.$col.'" for "'.$val.'"'; }
! if($val
== $filt)
{
if($DEBUG) { echo ', and number '.$ldap_fields[$i]['uidnumber'][0].'
matched.'.' '; }
***************
*** 220,224 ****
{
if($DEBUG) {
echo ' Testing "'.$col.'" for "'.$filt.'"'; }
! if
($ldap_fields[$i][$col][0] == $filt)
{
if($DEBUG) { echo ', and number '.$ldap_fields[$i]['uidnumber'][0].'
matched.'.' '; }
--- 231,235 ----
{
if($DEBUG) {
echo ' Testing "'.$col.'" for "'.$filt.'"'; }
!
if($ldap_fields[$i][$col][0] == $filt)
{
if($DEBUG) { echo ', and number '.$ldap_fields[$i]['uidnumber'][0].'
matched.'.' '; }
***************
*** 231,235 ****
$yes &=
False;
$match--;
! }
}
}
--- 242,246 ----
$yes &=
False;
$match--;
! }
}
}
***************
*** 237,241 ****
{
if($DEBUG) { echo
' Testing "'.$col.'" for "'.$filt.'"'; }
! if
($ldap_fields[$i][$col][0] == $filt)
{
if($DEBUG) {
echo ', and number '.$ldap_fields[$i]['uidnumber'][0].'
matched.'.' '; }
--- 248,252 ----
{
if($DEBUG) { echo
' Testing "'.$col.'" for "'.$filt.'"'; }
!
if($ldap_fields[$i][$col][0] == $filt)
{
if($DEBUG) {
echo ', and number '.$ldap_fields[$i]['uidnumber'][0].'
matched.'.' '; }
***************
*** 252,256 ****
}
! if ($yes)
{
if($DEBUG) { echo
$ldap_fields[$i]['uidnumber'][0].' matched all!'.'<br>'; }
--- 263,267 ----
}
! if($yes)
{
if($DEBUG) { echo
$ldap_fields[$i]['uidnumber'][0].' matched all!'.'<br>'; }
***************
*** 286,316 ****
$fields = array
(
! 'n_given' =>
'n_given',
! 'n_family' =>
'n_family',
! 'title' =>
'title',
! 'org_name' =>
'org_name',
! 'org_unit' =>
'org_unit',
! 'adr_one_street' =>
'adr_one_street',
! 'adr_one_locality' =>
'adr_one_locality',
! 'adr_one_postalcode' => 'adr_one_postalcode',
! 'adr_one_region' =>
'adr_one_region',
! 'adr_one_countryname' =>
'adr_one_countryname',
! 'adr_two_street' =>
'adr_two_street',
! 'adr_two_locality' =>
'adr_two_locality',
! 'adr_two_postalcode' => 'adr_two_postalcode',
! 'adr_two_region' =>
'adr_two_region',
! 'adr_two_countryname' => 'adr_two_countryname'
);
$address = $this->read_single_entry($id,$fields);
! if ($address[0]['title'])
{
$title = $address[0]['title'] . ' ';
}
! if ($business)
{
! if ($address[0]['org_name'])
{
$company = $address[0]['org_name'];
--- 297,327 ----
$fields = array
(
! 'n_given' => 'n_given',
! 'n_family' => 'n_family',
! 'title' => 'title',
! 'org_name' => 'org_name',
! 'org_unit' => 'org_unit',
! 'adr_one_street' => 'adr_one_street',
! 'adr_one_locality' => 'adr_one_locality',
! 'adr_one_postalcode' => 'adr_one_postalcode',
! 'adr_one_region' => 'adr_one_region',
! 'adr_one_countryname' => 'adr_one_countryname',
! 'adr_two_street' => 'adr_two_street',
! 'adr_two_locality' => 'adr_two_locality',
! 'adr_two_postalcode' => 'adr_two_postalcode',
! 'adr_two_region' => 'adr_two_region',
! 'adr_two_countryname' => 'adr_two_countryname'
);
$address = $this->read_single_entry($id,$fields);
! if($address[0]['title'])
{
$title = $address[0]['title'] . ' ';
}
! if($business)
{
! if($address[0]['org_name'])
{
$company = $address[0]['org_name'];
***************
*** 337,346 ****
}
! if (! $country)
{
$country =
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
}
! if (file_exists(PHPGW_SERVER_ROOT . SEP . 'addressbook'
. SEP . 'templates' . SEP .'default' . SEP . 'format_' . strtolower($country) .
'.tpl'))
{
$a = $t->set_file(array('address_format' =>
'format_' . strtolower($country) . '.tpl'));
--- 348,357 ----
}
! if(!$country)
{
$country =
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
}
! if(file_exists(PHPGW_SERVER_ROOT . SEP . 'addressbook'
. SEP . 'templates' . SEP .'default' . SEP . 'format_' . strtolower($country) .
'.tpl'))
{
$a = $t->set_file(array('address_format' =>
'format_' . strtolower($country) . '.tpl'));
***************
*** 351,355 ****
}
! if (!$afont)
{
$afont =
$GLOBALS['phpgw_info']['theme']['font'];
--- 362,366 ----
}
! if(!$afont)
{
$afont =
$GLOBALS['phpgw_info']['theme']['font'];
***************
*** 365,369 ****
$a .= $t->set_var('state',$state);
! if ($country !=
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
{
$countryname = $s->get_full_name($country);
--- 376,380 ----
$a .= $t->set_var('state',$state);
! if($country !=
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
{
$countryname = $s->get_full_name($country);
***************
*** 382,418 ****
$fields = array
(
! 'n_given' =>
'n_given',
! 'n_family' =>
'n_family',
! 'title' =>
'title',
! 'org_name' =>
'org_name',
! 'org_unit' =>
'org_unit',
! 'adr_one_street' =>
'adr_one_street',
! 'adr_one_locality' =>
'adr_one_locality',
! 'adr_one_postalcode' => 'adr_one_postalcode',
! 'adr_one_region' =>
'adr_one_region',
! 'tel_work' =>
'tel_work',
! 'tel_fax' =>
'tel_fax',
! 'email' =>
'email',
! 'url' =>
'url',
! 'adr_one_countryname' =>
'adr_one_countryname',
! 'adr_two_street' =>
'adr_two_street',
! 'adr_two_locality' =>
'adr_two_locality',
! 'adr_two_postalcode' => 'adr_two_postalcode',
! 'adr_two_region' =>
'adr_two_region',
! 'adr_two_countryname' =>
'adr_two_countryname',
! 'tel_home' =>
'tel_home',
! 'email_home' => 'email_home'
);
$address = $this->read_single_entry($id,$fields);
! if ($address[0]['title'])
{
$title = $address[0]['title'] . ' ';
}
! if ($business)
{
! if ($address[0]['org_name'])
{
$company = $address[0]['org_name'];
--- 393,429 ----
$fields = array
(
! 'n_given' => 'n_given',
! 'n_family' => 'n_family',
! 'title' => 'title',
! 'org_name' => 'org_name',
! 'org_unit' => 'org_unit',
! 'adr_one_street' => 'adr_one_street',
! 'adr_one_locality' => 'adr_one_locality',
! 'adr_one_postalcode' => 'adr_one_postalcode',
! 'adr_one_region' => 'adr_one_region',
! 'tel_work' => 'tel_work',
! 'tel_fax' => 'tel_fax',
! 'email' => 'email',
! 'url' => 'url',
! 'adr_one_countryname' => 'adr_one_countryname',
! 'adr_two_street' => 'adr_two_street',
! 'adr_two_locality' => 'adr_two_locality',
! 'adr_two_postalcode' => 'adr_two_postalcode',
! 'adr_two_region' => 'adr_two_region',
! 'adr_two_countryname' => 'adr_two_countryname',
! 'tel_home' => 'tel_home',
! 'email_home' => 'email_home'
);
$address = $this->read_single_entry($id,$fields);
! if($address[0]['title'])
{
$title = $address[0]['title'] . ' ';
}
! if($business)
{
! if($address[0]['org_name'])
{
$company = $address[0]['org_name'];
***************
*** 423,452 ****
}
! $street = $address[0]['adr_one_street'];
! $city =
$address[0]['adr_one_locality'];
! $zip =
$address[0]['adr_one_postalcode'];
! $state = $address[0]['adr_one_region'];
! $country =
$address[0]['adr_one_countryname'];
! $tel = $address[0]['tel_work'];
! $email = $address[0]['email'];
}
else
{
! $company = $title .
$address[0]['n_given'] . ' ' . $address[0]['n_family'];
! $street = $address[0]['adr_two_street'];
! $city =
$address[0]['adr_two_locality'];
! $zip =
$address[0]['adr_two_postalcode'];
! $state = $address[0]['adr_two_region'];
! $country =
$address[0]['adr_two_countryname'];
! $tel = $address[0]['tel_home'];
! $email = $address[0]['email_home'];
}
! if (! $country)
{
$country =
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
}
! if (file_exists(PHPGW_SERVER_ROOT . SEP . 'addressbook'
. SEP . 'templates' . SEP .'default' . SEP . 'full_format_' .
strtolower($country) . '.tpl'))
{
$a = $t->set_file(array('address_format' =>
'full_format_' . strtolower($country) . '.tpl'));
--- 434,463 ----
}
! $street = $address[0]['adr_one_street'];
! $city = $address[0]['adr_one_locality'];
! $zip = $address[0]['adr_one_postalcode'];
! $state = $address[0]['adr_one_region'];
! $country = $address[0]['adr_one_countryname'];
! $tel = $address[0]['tel_work'];
! $email = $address[0]['email'];
}
else
{
! $company = $title . $address[0]['n_given'] .
' ' . $address[0]['n_family'];
! $street = $address[0]['adr_two_street'];
! $city = $address[0]['adr_two_locality'];
! $zip = $address[0]['adr_two_postalcode'];
! $state = $address[0]['adr_two_region'];
! $country = $address[0]['adr_two_countryname'];
! $tel = $address[0]['tel_home'];
! $email = $address[0]['email_home'];
}
! if(!$country)
{
$country =
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
}
! if(file_exists(PHPGW_SERVER_ROOT . SEP . 'addressbook'
. SEP . 'templates' . SEP .'default' . SEP . 'full_format_' .
strtolower($country) . '.tpl'))
{
$a = $t->set_file(array('address_format' =>
'full_format_' . strtolower($country) . '.tpl'));
***************
*** 457,461 ****
}
! if (!$afont)
{
$afont =
$GLOBALS['phpgw_info']['theme']['font'];
--- 468,472 ----
}
! if(!$afont)
{
$afont =
$GLOBALS['phpgw_info']['theme']['font'];
***************
*** 479,483 ****
$a .= $t->set_var('url',$address[0]['url']);
! if ($country !=
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
{
$countryname = $s->get_full_name($country);
--- 490,494 ----
$a .= $t->set_var('url',$address[0]['url']);
! if($country !=
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
{
$countryname = $s->get_full_name($country);
***************
*** 496,525 ****
$fields = array
(
! 'n_given' =>
'n_given',
! 'n_family' =>
'n_family',
! 'title' =>
'title',
! 'org_name' =>
'org_name',
! 'adr_one_street' =>
'adr_one_street',
! 'adr_one_locality' =>
'adr_one_locality',
! 'adr_one_postalcode' => 'adr_one_postalcode',
! 'adr_one_region' =>
'adr_one_region',
! 'adr_one_countryname' =>
'adr_one_countryname',
! 'adr_two_street' =>
'adr_two_street',
! 'adr_two_locality' =>
'adr_two_locality',
! 'adr_two_postalcode' => 'adr_two_postalcode',
! 'adr_two_region' =>
'adr_two_region',
! 'adr_two_countryname' => 'adr_two_countryname'
);
$address = $this->read_single_entry($id,$fields);
! if ($address[0]['title'])
{
$title = $address[0]['title'] . ' ';
}
! if ($business)
{
! if ($address[0]['org_name'])
{
$company = $address[0]['org_name'];
--- 507,536 ----
$fields = array
(
! 'n_given' => 'n_given',
! 'n_family' => 'n_family',
! 'title' => 'title',
! 'org_name' => 'org_name',
! 'adr_one_street' => 'adr_one_street',
! 'adr_one_locality' => 'adr_one_locality',
! 'adr_one_postalcode' => 'adr_one_postalcode',
! 'adr_one_region' => 'adr_one_region',
! 'adr_one_countryname' => 'adr_one_countryname',
! 'adr_two_street' => 'adr_two_street',
! 'adr_two_locality' => 'adr_two_locality',
! 'adr_two_postalcode' => 'adr_two_postalcode',
! 'adr_two_region' => 'adr_two_region',
! 'adr_two_countryname' => 'adr_two_countryname'
);
$address = $this->read_single_entry($id,$fields);
! if($address[0]['title'])
{
$title = $address[0]['title'] . ' ';
}
! if($business)
{
! if($address[0]['org_name'])
{
$company = $address[0]['org_name'];
***************
*** 546,555 ****
}
! if (! $country)
{
$country =
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
}
! if (file_exists(PHPGW_SERVER_ROOT . SEP . 'addressbook'
. SEP . 'templates' . SEP .'default' . SEP . 'line_format_' .
strtolower($country) . '.tpl'))
{
$a = $t->set_file(array('address_format' =>
'line_format_' . strtolower($country) . '.tpl'));
--- 557,566 ----
}
! if(!$country)
{
$country =
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
}
! if(file_exists(PHPGW_SERVER_ROOT . SEP . 'addressbook'
. SEP . 'templates' . SEP .'default' . SEP . 'line_format_' .
strtolower($country) . '.tpl'))
{
$a = $t->set_file(array('address_format' =>
'line_format_' . strtolower($country) . '.tpl'));
***************
*** 560,564 ****
}
! if (!$afont)
{
$afont =
$GLOBALS['phpgw_info']['theme']['font'];
--- 571,575 ----
}
! if(!$afont)
{
$afont =
$GLOBALS['phpgw_info']['theme']['font'];
***************
*** 573,577 ****
$a .= $t->set_var('state',$state);
! if ($country !=
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
{
$countryname = $s->get_full_name($country);
--- 584,588 ----
$a .= $t->set_var('state',$state);
! if($country !=
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
{
$countryname = $s->get_full_name($country);
Index: class.contacts_ldap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_ldap.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.contacts_ldap.inc.php 28 Dec 2001 04:29:31 -0000 1.11
--- class.contacts_ldap.inc.php 8 Feb 2002 05:04:33 -0000 1.12
***************
*** 171,182 ****
function read_single_entry($id,$fields = '')
{
! if (!$fields || empty($fields)) { $fields =
$this->stock_contact_fields; }
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if (count($stock_fieldnames))
{
$t_fields = "," .
implode(",",$stock_fieldnames);
! if ($t_fields == ",")
[...966 lines suppressed...]
{
return False;
}
! if($owner)
{
$sri = ldap_search($this->ldap,
$GLOBALS['phpgw_info']['server']['ldap_contact_context'],
'phpgwcontactowner='.$owner);
***************
*** 808,812 ****
$entry = '';
! while (list($null,$entry) = each($ldap_fields))
{
$err =
ldap_delete($this->ldap,$entry['dn']);
--- 833,837 ----
$entry = '';
! while(list($null,$entry) = each($ldap_fields))
{
$err =
ldap_delete($this->ldap,$entry['dn']);
Index: class.contacts_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** class.contacts_sql.inc.php 23 Nov 2001 00:59:02 -0000 1.17
--- class.contacts_sql.inc.php 8 Feb 2002 05:04:33 -0000 1.18
***************
*** 164,175 ****
function read_single_entry($id,$fields='')
{
! if (!$fields || empty($fields)) { $fields =
$this->stock_contact_fields; }
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if (count($stock_fieldnames))
{
$t_fields = ',' .
implode(',',$stock_fieldnames);
! if ($t_fields == ',')
{
unset($t_fields);
--- 164,178 ----
function read_single_entry($id,$fields='')
{
! if(!$fields || empty($fields))
! {
! $fields = $this->stock_contact_fields;
! }
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if(count($stock_fieldnames))
{
$t_fields = ',' .
implode(',',$stock_fieldnames);
! if($t_fields == ',')
{
unset($t_fields);
***************
*** 187,193 ****
$return_fields[0]['cat_id'] = $this->db->f('cat_id');
! if (gettype($stock_fieldnames) == 'array')
{
! while (list($f_name) = each($stock_fieldnames))
{
$return_fields[0][$f_name] =
$this->db->f($f_name);
--- 190,196 ----
$return_fields[0]['cat_id'] = $this->db->f('cat_id');
! if(is_array($stock_fieldnames))
{
! while(list($f_name) = each($stock_fieldnames))
{
$return_fields[0][$f_name] =
$this->db->f($f_name);
***************
*** 196,213 ****
/* Setup address type fields for ui forms display */
! if ($this->db->f('adr_one_type'))
{
$one_type = $this->db->f('adr_one_type');
reset($this->adr_types);
! while (list($name,$val) =
each($this->adr_types))
{
eval("if (strstr(\$one_type,\$name)) {
\$return_fields[0][\"one_\$name\"] = \"on\"; }");
}
}
! if ($this->db->f('adr_two_type'))
{
$two_type = $this->db->f('adr_two_type');
reset($this->adr_types);
! while (list($name,$val) =
each($this->adr_types))
{
eval("if (strstr(\$two_type,\$name)) {
\$return_fields[0][\"two_\$name\"] = \"on\"; }");
--- 199,216 ----
/* Setup address type fields for ui forms display */
! if($this->db->f('adr_one_type'))
{
$one_type = $this->db->f('adr_one_type');
reset($this->adr_types);
! while(list($name,$val) = each($this->adr_types))
{
eval("if (strstr(\$one_type,\$name)) {
\$return_fields[0][\"one_\$name\"] = \"on\"; }");
}
}
! if($this->db->f('adr_two_type'))
{
$two_type = $this->db->f('adr_two_type');
reset($this->adr_types);
! while(list($name,$val) = each($this->adr_types))
{
eval("if (strstr(\$two_type,\$name)) {
\$return_fields[0][\"two_\$name\"] = \"on\"; }");
***************
*** 216,222 ****
$this->db->query("SELECT contact_name,contact_value
FROM $this->ext_table where contact_id='" . $this->db->f('id') .
"'",__LINE__,__FILE__);
! while ($this->db->next_record())
{
! if ($extra_fields[$this->db->f('contact_name')])
{
$return_fields[0][$this->db->f('contact_name')] = $this->db->f('contact_value');
--- 219,225 ----
$this->db->query("SELECT contact_name,contact_value
FROM $this->ext_table where contact_id='" . $this->db->f('id') .
"'",__LINE__,__FILE__);
! while($this->db->next_record())
{
! if($extra_fields[$this->db->f('contact_name')])
{
$return_fields[0][$this->db->f('contact_name')] = $this->db->f('contact_value');
***************
*** 228,239 ****
function read_last_entry($fields='')
{
! if (!$fields || empty($fields)) { $fields =
$this->stock_contact_fields; }
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if (count($stock_fieldnames))
{
$t_fields = ',' .
implode(',',$stock_fieldnames);
! if ($t_fields == ',')
{
unset($t_fields);
--- 231,245 ----
function read_last_entry($fields='')
{
! if(!$fields || empty($fields))
! {
! $fields = $this->stock_contact_fields;
! }
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if(count($stock_fieldnames))
{
$t_fields = ',' .
implode(',',$stock_fieldnames);
! if($t_fields == ',')
{
unset($t_fields);
***************
*** 256,262 ****
$return_fields[0]['cat_id'] = $this->db->f('cat_id');
! if (gettype($stock_fieldnames) == 'array')
{
! while (list($f_name) = each($stock_fieldnames))
{
$return_fields[0][$f_name] =
$this->db->f($f_name);
--- 262,268 ----
$return_fields[0]['cat_id'] = $this->db->f('cat_id');
! if(is_array($stock_fieldnames))
{
! while(list($f_name) = each($stock_fieldnames))
{
$return_fields[0][$f_name] =
$this->db->f($f_name);
***************
*** 265,282 ****
/* Setup address type fields for ui forms display */
! if ($this->db->f('adr_one_type'))
{
$one_type = $this->db->f('adr_one_type');
reset($this->adr_types);
! while (list($name,$val) =
each($this->adr_types))
{
eval("if (strstr(\$one_type,\$name)) {
\$return_fields[0][\"one_\$name\"] = \"on\"; }");
}
}
! if ($this->db->f('adr_two_type'))
{
$two_type = $this->db->f('adr_two_type');
reset($this->adr_types);
! while (list($name,$val) =
each($this->adr_types))
{
eval("if (strstr(\$two_type,\$name)) {
\$return_fields[0][\"two_\$name\"] = \"on\"; }");
--- 271,288 ----
/* Setup address type fields for ui forms display */
! if($this->db->f('adr_one_type'))
{
$one_type = $this->db->f('adr_one_type');
reset($this->adr_types);
! while(list($name,$val) = each($this->adr_types))
{
eval("if (strstr(\$one_type,\$name)) {
\$return_fields[0][\"one_\$name\"] = \"on\"; }");
}
}
! if($this->db->f('adr_two_type'))
{
$two_type = $this->db->f('adr_two_type');
reset($this->adr_types);
! while(list($name,$val) = each($this->adr_types))
{
eval("if (strstr(\$two_type,\$name)) {
\$return_fields[0][\"two_\$name\"] = \"on\"; }");
***************
*** 285,291 ****
$this->db->query("SELECT contact_name,contact_value
FROM $this->ext_table WHERE contact_id='" . $this->db->f('id') .
"'",__LINE__,__FILE__);
! while ($this->db->next_record())
{
! if ($extra_fields[$this->db->f('contact_name')])
{
$return_fields[0][$this->db->f('contact_name')] = $this->db->f('contact_value');
--- 291,297 ----
$this->db->query("SELECT contact_name,contact_value
FROM $this->ext_table WHERE contact_id='" . $this->db->f('id') .
"'",__LINE__,__FILE__);
! while($this->db->next_record())
{
! if($extra_fields[$this->db->f('contact_name')])
{
$return_fields[0][$this->db->f('contact_name')] = $this->db->f('contact_value');
***************
*** 302,313 ****
if(!$filter) { $filter = 'tid=n'; }
! if (!$fields || empty($fields)) { $fields =
$this->stock_contact_fields; }
$DEBUG = 0;
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if (count($stock_fieldnames))
{
$t_fields = ',' .
implode(',',$stock_fieldnames);
! if ($t_fields == ',')
{
unset($t_fields);
--- 308,322 ----
if(!$filter) { $filter = 'tid=n'; }
! if(!$fields || empty($fields))
! {
! $fields = $this->stock_contact_fields;
! }
$DEBUG = 0;
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if(count($stock_fieldnames))
{
$t_fields = ',' .
implode(',',$stock_fieldnames);
! if($t_fields == ',')
{
unset($t_fields);
***************
*** 316,334 ****
/* turn filter's a=b,c=d OR a=b into an array */
! if ($filter)
{
$check_stock = $this->stock_contact_fields +
$this->non_contact_fields;
! if ($DEBUG) { echo 'DEBUG - Inbound filter is:
#'.$filter.'#'; }
$filterarray = split(',',$filter);
! if ($filterarray[1])
{
$i=0;
! for ($i=0;$i<count($filterarray);$i++)
{
list($name,$value) =
split('=',$filterarray[$i]);
! if ($name)
{
! if ($DEBUG) { echo
'<br>DEBUG - Filter intermediate strings 1: #'.$name.'# => #'.$value.'#'; }
$filterfields[$name] =
$value;
}
--- 325,343 ----
/* turn filter's a=b,c=d OR a=b into an array */
! if($filter)
{
$check_stock = $this->stock_contact_fields +
$this->non_contact_fields;
! if($DEBUG) { echo 'DEBUG - Inbound filter is:
#'.$filter.'#'; }
$filterarray = split(',',$filter);
! if($filterarray[1])
{
$i=0;
! for($i=0;$i<count($filterarray);$i++)
{
list($name,$value) =
split('=',$filterarray[$i]);
! if($name)
{
! if($DEBUG) { echo
'<br>DEBUG - Filter intermediate strings 1: #'.$name.'# => #'.$value.'#'; }
$filterfields[$name] =
$value;
}
***************
*** 338,342 ****
{
list($name,$value) = split('=',$filter);
! if ($DEBUG)
{
echo '<br>DEBUG - Filter
intermediate strings 1: #'.$name.'# => #'.$value.'#';
--- 347,351 ----
{
list($name,$value) = split('=',$filter);
! if($DEBUG)
{
echo '<br>DEBUG - Filter
intermediate strings 1: #'.$name.'# => #'.$value.'#';
***************
*** 348,364 ****
$i=0;
reset($filterfields);
! while (list($name,$value) = each($filterfields))
{
! if ($DEBUG) { echo '<br>DEBUG - Filter
intermediate strings 2: #'.$name.'# => #'.$value.'#'; }
$isstd=0;
! if ($name && empty($value))
{
! if ($DEBUG) { echo '<br>DEBUG -
filter field "'.$name.'" is empty (NULL)'; }
! while
(list($fname,$fvalue)=each($check_stock))
{
! if ($fvalue==$name)
{
$filterlist .=
$name.' is NULL,';
! if ($DEBUG) {
echo '<br>DEBUG - filter field "'.$name.'" is a stock field'; }
break;
}
--- 357,373 ----
$i=0;
reset($filterfields);
! while(list($name,$value) = each($filterfields))
{
! if($DEBUG) { echo '<br>DEBUG - Filter
intermediate strings 2: #'.$name.'# => #'.$value.'#'; }
$isstd=0;
! if($name && empty($value))
{
! if($DEBUG) { echo '<br>DEBUG -
filter field "'.$name.'" is empty (NULL)'; }
!
while(list($fname,$fvalue)=each($check_stock))
{
! if($fvalue==$name)
{
$filterlist .=
$name.' is NULL,';
! if($DEBUG) {
echo '<br>DEBUG - filter field "'.$name.'" is a stock field'; }
break;
}
***************
*** 368,382 ****
{
reset($check_stock);
! while
(list($fname,$fvalue)=each($check_stock))
{
! if ($fvalue==$name)
{
! if ($name ==
'cat_id')
{
!
$filterlist .= "(" . $name . " LIKE '%," . $value . ",%' OR " .
$name."='".$value."');";
}
! elseif
(gettype($value) == "integer")
{
!
$filterlist .= $name."=".$value.";";
}
else
--- 377,391 ----
{
reset($check_stock);
!
while(list($fname,$fvalue)=each($check_stock))
{
! if($fvalue==$name)
{
! if($name ==
'cat_id')
{
!
$filterlist .= '(' . $name . " LIKE '%," . $value . ",%' OR " .
$name."='".$value."');";
}
!
elseif(is_int($value))
{
!
$filterlist .= $name.'='.$value.';';
}
else
***************
*** 393,402 ****
$filterlist = ereg_replace(';',' AND
',$filterlist);
! if ($DEBUG)
{
echo '<br>DEBUG - Filter output string:
#'.$filterlist.'#';
}
! if ($filterlist)
{
$filtermethod = '('.$filterlist.') ';
--- 402,411 ----
$filterlist = ereg_replace(';',' AND
',$filterlist);
! if($DEBUG)
{
echo '<br>DEBUG - Filter output string:
#'.$filterlist.'#';
}
! if($filterlist)
{
$filtermethod = '('.$filterlist.') ';
***************
*** 409,413 ****
}
! if (!$filtermethod)
{
if($this->account_id)
--- 418,422 ----
}
! if(!$filtermethod)
{
if($this->account_id)
***************
*** 432,439 ****
}
! if (is_array($this->grants))
{
$grants = $this->grants;
! while (list($user) = each($grants))
{
$public_user_list[] = $user;
--- 441,448 ----
}
! if(is_array($this->grants))
{
$grants = $this->grants;
! while(list($user) = each($grants))
{
$public_user_list[] = $user;
***************
*** 448,459 ****
}
! if ($DEBUG && $filtermethod)
{
echo '<br>DEBUG - Filtering with: #' .
$filtermethod . '#';
}
! if (!$sort) { $sort = 'ASC'; }
! if ($order)
{
$ordermethod = "ORDER BY $order $sort ";
--- 457,471 ----
}
! if($DEBUG && $filtermethod)
{
echo '<br>DEBUG - Filtering with: #' .
$filtermethod . '#';
}
! if(!$sort)
! {
! $sort = 'ASC';
! }
! if($order)
{
$ordermethod = "ORDER BY $order $sort ";
***************
*** 464,468 ****
}
! if ($DEBUG && $ordermethod)
{
echo "<br>DEBUG - $ordermethod";
--- 476,480 ----
}
! if($DEBUG && $ordermethod)
{
echo "<br>DEBUG - $ordermethod";
***************
*** 471,475 ****
$filtermethod = '';
! if ($query)
{
$query = ereg_replace("'",'',$query);
--- 483,487 ----
$filtermethod = '';
! if($query)
{
$query = ereg_replace("'",'',$query);
***************
*** 490,494 ****
. $filtermethod . ' ' . $ordermethod;
}
! if ($DEBUG) { echo '<br>' . $sql; }
$db2 = $this->db;
--- 502,506 ----
. $filtermethod . ' ' . $ordermethod;
}
! if($DEBUG) { echo '<br>' . $sql; }
$db2 = $this->db;
***************
*** 497,505 ****
$this->total_records = $this->db->num_rows();
! if ($start && $limit)
{
$this->db->limit_query($sql,$start,__LINE__,__FILE__,$limit);
}
! elseif (!$limit)
{
$this->db->query($sql,__LINE__,__FILE__);
--- 509,517 ----
$this->total_records = $this->db->num_rows();
! if($start && $limit)
{
$this->db->limit_query($sql,$start,__LINE__,__FILE__,$limit);
}
! elseif(!$limit)
{
$this->db->query($sql,__LINE__,__FILE__);
***************
*** 511,515 ****
$i = 0;
! while ($this->db->next_record())
{
$return_fields[$i]['id'] =
$this->db->f('id');
--- 523,527 ----
$i = 0;
! while($this->db->next_record())
{
$return_fields[$i]['id'] =
$this->db->f('id');
***************
*** 520,526 ****
$return_fields[$i]['cat_id'] =
$this->db->f('cat_id');
! if (gettype($stock_fieldnames) == 'array')
{
! while (list($f_name) =
each($stock_fieldnames))
{
$return_fields[$i][$f_name] =
$this->db->f($f_name);
--- 532,538 ----
$return_fields[$i]['cat_id'] =
$this->db->f('cat_id');
! if(is_array($stock_fieldnames))
{
! while(list($f_name) =
each($stock_fieldnames))
{
$return_fields[$i][$f_name] =
$this->db->f($f_name);
***************
*** 530,536 ****
$db2->query("SELECT contact_name,contact_value
FROM $this->ext_table WHERE contact_id='"
. $this->db->f('id') . "'"
.$filterextra,__LINE__,__FILE__);
! while ($db2->next_record())
{
! if
($extra_fields[$db2->f('contact_name')])
{
$return_fields[$i][$db2->f('contact_name')] = $db2->f('contact_value');
--- 542,548 ----
$db2->query("SELECT contact_name,contact_value
FROM $this->ext_table WHERE contact_id='"
. $this->db->f('id') . "'"
.$filterextra,__LINE__,__FILE__);
! while($db2->next_record())
{
!
if($extra_fields[$db2->f('contact_name')])
{
$return_fields[$i][$db2->f('contact_name')] = $db2->f('contact_value');
***************
*** 551,555 ****
}
! if ($fields['lid'])
{
$lid[0] = 'lid,';
--- 563,567 ----
}
! if($fields['lid'])
{
$lid[0] = 'lid,';
***************
*** 569,575 ****
$id = $this->db->f(0);
! if (count($extra_fields))
{
! while (list($name,$value) = each($extra_fields))
{
$this->db->query("INSERT INTO
$this->ext_table VALUES ('$id','" . $this->account_id . "','"
--- 581,587 ----
$id = $this->db->f(0);
! if(count($extra_fields))
{
! while(list($name,$value) = each($extra_fields))
{
$this->db->query("INSERT INTO
$this->ext_table VALUES ('$id','" . $this->account_id . "','"
***************
*** 605,609 ****
$this->db->query("SELECT COUNT(*) FROM $this->std_table
WHERE id='$id'",__LINE__,__FILE__);
$this->db->next_record();
! if (!$this->db->f(0))
{
return False;
--- 617,621 ----
$this->db->query("SELECT COUNT(*) FROM $this->std_table
WHERE id='$id'",__LINE__,__FILE__);
$this->db->next_record();
! if(!$this->db->f(0))
{
return False;
***************
*** 611,622 ****
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if (count($stock_fields))
{
! while (list($stock_fieldname) =
each($stock_fieldnames))
{
$ta[] = $stock_fieldname . "='" .
$this->db->db_addslashes($stock_fields[$stock_fieldname]) . "'";
}
$fields_s = ',' . implode(',',$ta);
! if ($field_s == ',')
{
unset($field_s);
--- 623,634 ----
list($stock_fields,$stock_fieldnames,$extra_fields) =
$this->split_stock_and_extras($fields);
! if(count($stock_fields))
{
! while(list($stock_fieldname) =
each($stock_fieldnames))
{
$ta[] = $stock_fieldname . "='" .
$this->db->db_addslashes($stock_fields[$stock_fieldname]) . "'";
}
$fields_s = ',' . implode(',',$ta);
! if($field_s == ',')
{
unset($field_s);
***************
*** 626,634 ****
}
! while (list($x_name,$x_value) = @each($extra_fields))
{
! if ($this->field_exists($id,$x_name))
{
! if (!$x_value)
{
$this->delete_single_extra_field($id,$x_name);
--- 638,646 ----
}
! while(list($x_name,$x_value) = @each($extra_fields))
{
! if($this->field_exists($id,$x_name))
{
! if(!$x_value)
{
$this->delete_single_extra_field($id,$x_name);
***************
*** 651,655 ****
function change_owner($old_owner='',$new_owner='')
{
! if (!($new_owner && $old_owner))
{
return False;
--- 663,667 ----
function change_owner($old_owner='',$new_owner='')
{
! if(!($new_owner && $old_owner))
{
return False;
***************
*** 672,676 ****
function delete_all($owner=0)
{
! if ($owner)
{
$this->db->query("DELETE FROM $this->std_table
WHERE owner=$owner",__LINE__,__FILE__);
--- 684,688 ----
function delete_all($owner=0)
{
! if($owner)
{
$this->db->query("DELETE FROM $this->std_table
WHERE owner=$owner",__LINE__,__FILE__);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.contacts_shared.inc.php,1.9,1.10 class.contacts_ldap.inc.php,1.11,1.12 class.contacts_sql.inc.php,1.17,1.18,
Miles Lott <address@hidden> <=