formatting

This commit is contained in:
Miles Lott 2001-12-08 21:55:13 +00:00
parent 290aa0d6da
commit 77a7f314b4

View File

@ -37,7 +37,7 @@
while (list($field,$value) = @each($fields)) while (list($field,$value) = @each($fields))
{ {
/* Depending on how the array was built, this is needed. */ /* Depending on how the array was built, this is needed. */
if (gettype($value) == "integer") if (gettype($value) == 'integer')
{ {
$value = $field; $value = $field;
} }
@ -68,7 +68,7 @@
/* This will take an array or integer */ /* This will take an array or integer */
function delete($id) function delete($id)
{ {
if (gettype($id) == "array") if (gettype($id) == 'array')
{ {
while (list($null,$t_id) = each($id)) while (list($null,$t_id) = each($id))
{ {
@ -189,11 +189,12 @@
function filter_ldap ($ldap_fields,$filterfields,$DEBUG=0) function filter_ldap ($ldap_fields,$filterfields,$DEBUG=0)
{ {
$match = 0; $match = 0;
if($DEBUG) { echo "<br>"; } if($DEBUG) { echo '<br>'; }
for($i=0;$i<count($ldap_fields);$i++) { for($i=0;$i<count($ldap_fields);$i++)
{
$yes = True; $yes = True;
if ($ldap_fields[$i]["uidnumber"][0]) if ($ldap_fields[$i]['uidnumber'][0])
{ {
reset($filterfields); reset($filterfields);
while (list($col,$filt) = each($filterfields)) while (list($col,$filt) = each($filterfields))
@ -208,7 +209,7 @@
if($DEBUG) { echo '&nbsp;&nbsp;Testing "'.$col.'" for "'.$val.'"'; } if($DEBUG) { echo '&nbsp;&nbsp;Testing "'.$col.'" for "'.$val.'"'; }
if ($val == $filt) if ($val == $filt)
{ {
if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."&nbsp;&nbsp;"; } if($DEBUG) { echo ', and number '.$ldap_fields[$i]['uidnumber'][0].' matched.'.'&nbsp;&nbsp;'; }
$yes &= True; $yes &= True;
$match++; $match++;
break; break;
@ -220,13 +221,13 @@
if($DEBUG) { echo '&nbsp;&nbsp;Testing "'.$col.'" for "'.$filt.'"'; } if($DEBUG) { echo '&nbsp;&nbsp;Testing "'.$col.'" for "'.$filt.'"'; }
if ($ldap_fields[$i][$col][0] == $filt) if ($ldap_fields[$i][$col][0] == $filt)
{ {
if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."&nbsp;&nbsp;"; } if($DEBUG) { echo ', and number '.$ldap_fields[$i]['uidnumber'][0].' matched.'.'&nbsp;&nbsp;'; }
$yes &= True; $yes &= True;
$match++; $match++;
} }
else else
{ {
if($DEBUG) { echo ', but number '.$ldap_fields[$i]["uidnumber"][0].' did not match.'."&nbsp;&nbsp;"; } if($DEBUG) { echo ', but number '.$ldap_fields[$i]['uidnumber'][0].' did not match.'.'&nbsp;&nbsp;'; }
$yes &= False; $yes &= False;
$match--; $match--;
} }
@ -237,13 +238,13 @@
if($DEBUG) { echo '&nbsp;&nbsp;Testing "'.$col.'" for "'.$filt.'"'; } if($DEBUG) { echo '&nbsp;&nbsp;Testing "'.$col.'" for "'.$filt.'"'; }
if ($ldap_fields[$i][$col][0] == $filt) if ($ldap_fields[$i][$col][0] == $filt)
{ {
if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."&nbsp;&nbsp;"; } if($DEBUG) { echo ', and number '.$ldap_fields[$i]['uidnumber'][0].' matched.'.'&nbsp;&nbsp;'; }
$yes &= True; $yes &= True;
$match++; $match++;
} }
else else
{ {
if($DEBUG) { echo ', but number '.$ldap_fields[$i]["uidnumber"][0].' did not match.'."&nbsp;&nbsp;"; } if($DEBUG) { echo ', but number '.$ldap_fields[$i]['uidnumber'][0].' did not match.'.'&nbsp;&nbsp;'; }
$yes &= False; $yes &= False;
$match--; $match--;
} }
@ -252,12 +253,12 @@
if ($yes) if ($yes)
{ {
if($DEBUG) { echo $ldap_fields[$i]["uidnumber"][0].' matched all!'."<br>"; } if($DEBUG) { echo $ldap_fields[$i]['uidnumber'][0].' matched all!'.'<br>'; }
$new_ldap[] = $ldap_fields[$i]; $new_ldap[] = $ldap_fields[$i];
} }
else else
{ {
if($DEBUG) { echo $ldap_fields[$i]["uidnumber"][0].' did not match all.'."<br>"; } if($DEBUG) { echo $ldap_fields[$i]['uidnumber'][0].' did not match all.'.'<br>'; }
} }
} }
} }
@ -279,12 +280,9 @@
function formatted_address($id = '',$fields = '',$business = True) function formatted_address($id = '',$fields = '',$business = True)
{ {
global $phpgw,$phpgw_info; $font = $GLOBALS['phpgw_info']['theme']['font'];
$font = $phpgw_info['theme']['font'];
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('addressbook'));
$t = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('addressbook'));
$s = CreateObject('phpgwapi.sbox'); $s = CreateObject('phpgwapi.sbox');
$address = $this->read_single_entry($id,$fields); $address = $this->read_single_entry($id,$fields);
@ -296,24 +294,24 @@
if ($business) if ($business)
{ {
$street = $address[0]['adr_one_street']; $street = $address[0]['adr_one_street'];
$city = $address[0]['adr_one_locality']; $city = $address[0]['adr_one_locality'];
$zip = $address[0]['adr_one_postalcode']; $zip = $address[0]['adr_one_postalcode'];
$state = $address[0]['adr_one_region']; $state = $address[0]['adr_one_region'];
$country = $address[0]['adr_one_countryname']; $country = $address[0]['adr_one_countryname'];
} }
else else
{ {
$street = $address[0]['adr_two_street']; $street = $address[0]['adr_two_street'];
$city = $address[0]['adr_two_locality']; $city = $address[0]['adr_two_locality'];
$zip = $address[0]['adr_two_postalcode']; $zip = $address[0]['adr_two_postalcode'];
$state = $address[0]['adr_two_region']; $state = $address[0]['adr_two_region'];
$country = $address[0]['adr_two_countryname']; $country = $address[0]['adr_two_countryname'];
} }
if (! $country) if (! $country)
{ {
$country = $phpgw_info['user']['preferences']['common']['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')) if (file_exists(PHPGW_SERVER_ROOT . SEP . 'addressbook' . SEP . 'templates' . SEP .'default' . SEP . 'format_' . strtolower($country) . '.tpl'))