Fix parsing of birthday and label, still some issues

This commit is contained in:
Miles Lott 2001-03-21 00:25:50 +00:00
parent 80de3179a1
commit dd4d8a56bc

View File

@ -96,7 +96,13 @@
$company = $fields["org_name"]; $company = $fields["org_name"];
$dept = $fields["org_unit"]; $dept = $fields["org_unit"];
$bday = $fields["bday"]; $bday = $fields["bday"];
$tmp = split("/",$bday); # 12/31/1969 -> 1969-12-31
if ($tmp[0]) {
$bday = $tmp[2]."-".$tmp[0]."/".$tmp[1];
}
$notes = ereg_replace("\r\n","=0A",$fields["note"]); $notes = ereg_replace("\r\n","=0A",$fields["note"]);
$access = $fields["access"]; $access = $fields["access"];
$url = $fields["url"]; $url = $fields["url"];
@ -153,10 +159,11 @@
$astreet,$acity,$astate,$azip,$acountry); $astreet,$acity,$astate,$azip,$acountry);
} }
if ($label) { if ($label) {
printf("LABEL;WORK;QUOTED-PRINTABLE:%s\r\n",$label); $label = ereg_replace("\n","=0D=0A",$label);
printf("LABEL;WORK;QUOTED-PRINTABLE:%s\n",$label);
} else { } else {
if ($address2 && $astreet && $acity && $astate && $azip && $acountry) { if ($address2 && $astreet && $acity && $astate && $azip && $acountry) {
printf("LABEL;WORK;QUOTED-PRINTABLE:%s=0A%s=0A%s,%s %s=0A%s\r\n",$address2,$astreet,$acity,$astate,$azip,$acountry); printf("LABEL;WORK;QUOTED-PRINTABLE:%s=0D=0A%s=0D=0A%s,%s %s=0D=0A%s\n",$address2,$astreet,$acity,$astate,$azip,$acountry);
} }
} }
// end 'A' grouping // end 'A' grouping
@ -175,7 +182,7 @@
$bcity,$bstate,$bzip,$bcountry); $bcity,$bstate,$bzip,$bcountry);
} }
if ($bstreet && $bcity && $bstate && $bzip && $bcountry) { if ($bstreet && $bcity && $bstate && $bzip && $bcountry) {
printf("LABEL;HOME;QUOTED-PRINTABLE:%s=0A%s,%s %s=0A%s\r\n",$bstreet,$bcity,$bstate,$bzip,$bcountry); printf("LABEL;HOME;QUOTED-PRINTABLE:%s=0D=0A%s,%s %s=0D=0A%s\n",$bstreet,$bcity,$bstate,$bzip,$bcountry);
} }
if ($url) { if ($url) {