ソースを参照

Two fixes for vcard.php, thanks to Kurt Pires.
1) be liberal in what you accept
2) workaround for outlook, not doing a complete rewrite of vcard now but
that's something that should definately be considered.

Thijs Kinkhorst 22 年 前
コミット
8f5fa02568
1 ファイル変更10 行追加5 行削除
  1. 10 5
      src/vcard.php

+ 10 - 5
src/vcard.php

@@ -69,7 +69,7 @@ foreach ($vcard as $l) {
         if ($attr == 'quoted-printable')
         if ($attr == 'quoted-printable')
         $v = quoted_printable_decode($v);
         $v = quoted_printable_decode($v);
         else
         else
-            $k .= ';' . $attr;
+            $k .= ';' . strtolower($attr);
     }
     }
 
 
     $v = str_replace(';', "\n", $v);
     $v = str_replace(';', "\n", $v);
@@ -78,10 +78,15 @@ foreach ($vcard as $l) {
 
 
 if ($vcard_nice['version'] == '2.1') {
 if ($vcard_nice['version'] == '2.1') {
     // get firstname and lastname for sm addressbook
     // get firstname and lastname for sm addressbook
-    $vcard_nice["firstname"] = substr($vcard_nice["n"],
-    strpos($vcard_nice["n"], "\n") + 1, strlen($vcard_nice["n"]));
-    $vcard_nice["lastname"] = substr($vcard_nice["n"], 0,
-        strpos($vcard_nice["n"], "\n"));
+    $vcard_nice['firstname'] = substr($vcard_nice['n'],
+    strpos($vcard_nice['n'], "\n") + 1, strlen($vcard_nice['n']));
+    $vcard_nice['lastname'] = substr($vcard_nice['n'], 0,
+        strpos($vcard_nice['n'], "\n"));
+    // workaround for Outlook, should be fixed in a better way,
+    // maybe in new 'vCard' class.
+    if (isset($vcard_nice['email;pref;internet'])) {
+       $vcard_nice['email;internet'] = $vcard_nice['email;pref;internet'];
+    }
 } else {
 } else {
     echo '<tr><td align=center>vCard Version ' . $vcard_nice['version'] .
     echo '<tr><td align=center>vCard Version ' . $vcard_nice['version'] .
         ' is not supported.  Some information might not be converted ' .
         ' is not supported.  Some information might not be converted ' .