formatting

This commit is contained in:
Miles Lott 2005-07-28 03:44:13 +00:00
parent 9a33b1f7be
commit b8bf4655fb

View File

@ -72,17 +72,29 @@
$tempVal = ';WORK';
if(isset($vcardRow['params']['INTERNET']))
{
$rowName .= ";INTERNET";
}
if(isset($vcardRow['params']['CELL']))
{
$rowName .= ';CELL';
}
if(isset($vcardRow['params']['FAX']))
{
$rowName .= ';FAX';
}
if(isset($vcardRow['params']['PAGER']))
{
$rowName .= ';PAGER';
}
if(isset($vcardRow['params']['WORK']))
{
$rowName .= ';WORK';
}
if(isset($vcardRow['params']['HOME']))
{
$rowName .= ';HOME';
}
$rowNames[$rowName] = $key;
}
@ -104,16 +116,22 @@
case 'TEL;CELL':
case 'TEL;PAGER':
if(!isset($rowNames[$rowName.';WORK']))
{
$finalRowNames[$rowName.';WORK'] = $vcardKey;
}
break;
case 'EMAIL':
case 'EMAIL;WORK':
if(!isset($rowNames['EMAIL;INTERNET;WORK']))
{
$finalRowNames['EMAIL;INTERNET;WORK'] = $vcardKey;
}
break;
case 'EMAIL;HOME':
if(!isset($rowNames['EMAIL;INTERNET;HOME']))
{
$finalRowNames['EMAIL;INTERNET;HOME'] = $vcardKey;
}
break;
case 'VERSION':
break;
@ -146,16 +164,46 @@
/* _debug_array($contact);exit; */
$contact['fn'] = trim($contact['n_given'].' '.$contact['n_family']);
if(!$contact['tel_work']) $contact['tel_work'] = '';
if(!$contact['tel_home']) $contact['tel_home'] = '';
if(!$contact['tel_voice']) $contact['tel_voice'] = '';
if(!$contact['tel_fax']) $contact['tel_fax'] = '';
if(!$contact['tel_msg']) $contact['tel_msg'] = '';
if(!$contact['tel_cell']) $contact['tel_cell'] = '';
if(!$contact['tel_pager']) $contact['tel_pager'] = '';
if(!$contact['tel_car']) $contact['tel_car'] = '';
if(!$contact['tel_isdn']) $contact['tel_isdn'] = '';
if(!$contact['tel_video']) $contact['tel_video'] = '';
if(!$contact['tel_work'])
{
$contact['tel_work'] = '';
}
if(!$contact['tel_home'])
{
$contact['tel_home'] = '';
}
if(!$contact['tel_voice'])
{
$contact['tel_voice'] = '';
}
if(!$contact['tel_fax'])
{
$contact['tel_fax'] = '';
}
if(!$contact['tel_msg'])
{
$contact['tel_msg'] = '';
}
if(!$contact['tel_cell'])
{
$contact['tel_cell'] = '';
}
if(!$contact['tel_pager'])
{
$contact['tel_pager'] = '';
}
if(!$contact['tel_car'])
{
$contact['tel_car'] = '';
}
if(!$contact['tel_isdn'])
{
$contact['tel_isdn'] = '';
}
if(!$contact['tel_video'])
{
$contact['tel_video'] = '';
}
$GLOBALS['egw']->translation->convert($contact,'utf-8');
@ -199,7 +247,6 @@
# return $entry;
#}
$vcardFields[0] = array(
'ADR;WORK' => array('','','adr_one_street','adr_one_locality','adr_one_region',
'adr_one_postalcode','adr_one_countryname'),
@ -258,9 +305,11 @@
foreach($databaseFields as $databaseField)
{
if(!empty($databaseField))
{
$fields[] = $databaseField;
}
}
}
#_debug_array($fields);
@ -284,8 +333,10 @@
{
$tempVal = ';';
if(!empty($databaseField))
{
#$tempVal = trim('value').';';
$tempVal = trim($entry[0][$databaseField]).';';
}
$value .= $tempVal;
}
// remove the last ;
@ -311,11 +362,17 @@
// don't add the entry if it contains only ';'
if(strlen(str_replace(';','',$value)) != 0)
{
$vCard->setAttribute($vcardField, $value);
}
if(preg_match('/([\000-\012\015\016\020-\037\075])/',$value))
{
$options['ENCODING'] = 'QUOTED-PRINTABLE';
}
if(preg_match('/([\177-\377])/',$value))
{
$options['CHARSET'] = 'UTF-8';
}
$vCard->setParameter($vcardField, $options);
}