X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fvcard.php;h=401e12087b3e2ac6a641e1237a4d9601ec03b951;hb=c3ccfa1912b4ca47279d259bb587ceb293ce5d83;hp=e6343006b2804e278a9a9cea0d44219db3cc6a68;hpb=5e9e90fd78a930cc74432034fad600d38ac50563;p=squirrelmail.git
diff --git a/src/vcard.php b/src/vcard.php
index e6343006..401e1208 100644
--- a/src/vcard.php
+++ b/src/vcard.php
@@ -3,7 +3,7 @@
/**
* vcard.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This file shows an attched vcard
@@ -11,11 +11,26 @@
* $Id$
*/
-require_once('../src/validate.php');
-require_once('../functions/date.php');
-require_once('../functions/page_header.php');
-require_once('../functions/mime.php');
-require_once('../src/load_prefs.php');
+/* Path for SquirrelMail required files. */
+Define('SM_PATH','../');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/date.php');
+require_once(SM_PATH . 'functions/page_header.php');
+require_once(SM_PATH . 'functions/mime.php');
+require_once(SM_PATH . 'include/load_prefs.php');
+
+/* globals */
+sqgetGlobalVar('username', $username, SQ_SESSION);
+sqgetGlobalVar('key', $key, SQ_COOKIE);
+sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
+
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
+sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
+sqgetGlobalVar('ent_id', $ent_id, SQ_GET);
+sqgetGlobalVar('startMessage', $startMessage, SQ_GET);
+/* end globals */
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
sqimap_mailbox_select($imapConnection, $mailbox);
@@ -28,23 +43,21 @@ echo '
' .
' | ';
$message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
-$entity_vcard = getEntity($message,$passed_ent_id);
+$entity_vcard = getEntity($message,$ent_id);
-$vcard = mime_fetch_body ($imapConnection, $passed_id, $passed_ent_id);
+$vcard = mime_fetch_body ($imapConnection, $passed_id, $ent_id);
$vcard = decodeBody($vcard, $entity_vcard->header->encoding);
$vcard = explode ("\n",$vcard);
foreach ($vcard as $l) {
@@ -56,7 +69,7 @@ foreach ($vcard as $l) {
if ($attr == 'quoted-printable')
$v = quoted_printable_decode($v);
else
- $k .= ';' . $attr;
+ $k .= ';' . strtolower($attr);
}
$v = str_replace(';', "\n", $v);
@@ -65,10 +78,15 @@ foreach ($vcard as $l) {
if ($vcard_nice['version'] == '2.1') {
// 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 {
echo '|
vCard Version ' . $vcard_nice['version'] . ' is not supported. Some information might not be converted ' . @@ -97,10 +115,11 @@ $ShowValues = array( echo ' | |
' . '
|