formatting

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

View File

@ -55,7 +55,7 @@
$vCard = Horde_iCalendar::newComponent('vcard', $container);
if (!$vCard->parsevCalendar($_vcard,'VCARD'))
if(!$vCard->parsevCalendar($_vcard,'VCARD'))
{
return False;
}
@ -67,22 +67,34 @@
foreach($vcardValues as $key => $vcardRow)
{
$rowName = $vcardRow['name'];
$mailtype = ';INTERNET';
$tempVal = ';WORK';
$rowName = $vcardRow['name'];
$mailtype = ';INTERNET';
$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');
@ -185,21 +233,20 @@
$vCard =& new Horde_iCalendar_vcard;
#if ($this->xmlrpc && !isset($data['fields']))
#if($this->xmlrpc && !isset($data['fields']))
#{
# $data['fields'] = array_keys(array_merge($this->so->contacts->non_contact_fields,$this->so->contacts->stock_contact_fields,$this->customfields()));
#}
#if ($data['id'] < 0)
#if($data['id'] < 0)
#{
# $entry = array($this->user_pseudo_entry(-$data['id']));
# if ($this->xmlrpc)
# if($this->xmlrpc)
# {
# $entry = $this->data2xmlrpc($entry);
# }
# return $entry;
#}
$vcardFields[0] = array(
'ADR;WORK' => array('','','adr_one_street','adr_one_locality','adr_one_region',
'adr_one_postalcode','adr_one_countryname'),
@ -258,7 +305,9 @@
foreach($databaseFields as $databaseField)
{
if(!empty($databaseField))
{
$fields[] = $databaseField;
}
}
}
@ -269,7 +318,7 @@
//$data = array('id' => $_id, 'fields' => $fields);
$entry = $this->so->read_entry($_id,$fields);
$entry = $this->strip_html($entry);
if ($this->xmlrpc)
if($this->xmlrpc)
{
$entry = $this->data2xmlrpc($entry);
}
@ -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);
}
@ -335,7 +392,7 @@
return $result;
}
if ($this->xmlrpc)
if($this->xmlrpc)
{
$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
}