More rg=0
[squirrelmail.git] / src / vcard.php
index 8aa55c2d5b32673ef6e283464df5e51d54e69905..4c3790a273f1d85f5f76c10b2b48109fe1d3e790 100644 (file)
  * $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 */
+$key  = $_COOKIE['key'];
+$username = $_SESSION['username'];
+$onetimepad = $_SESISON['onetimepad'];
+
+$mailbox = $_GET['mailbox'];
+$passed_id = $_GET['passed_id'];
+$passed_ent_id = $_GET['passed_ent_id'];
+
+/* end globals */
 
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 sqimap_mailbox_select($imapConnection, $mailbox);
@@ -28,23 +43,17 @@ echo '<br><table width="100%" border="0" cellspacing="0" cellpadding="2" ' .
         '<tr><td bgcolor="' . $color[0] . '">' .
         '<b><center>' .
         _("Viewing a Business Card") . " - ";
-if (isset($where) && isset($what)) {
-    // from a search
-    echo '<a href="../src/read_body.php?mailbox=' . urlencode($mailbox) .
-            '&passed_id=' . $passed_id . '&where=' . urlencode($where) .
-            '&what=' . urlencode($what). '">' . _("View message") . '</a>';
-} else {
-    echo '<a href="../src/read_body.php?mailbox=' . urlencode($mailbox) .
-        '&passed_id=' . $passed_id . '&startMessage=' . $startMessage .
-        '&show_more=0">' . _("View message") . '</a>';
-}
+$msg_url = 'read_body.php?' . $QUERY_STRING;
+$msg_url = set_url_var($msg_url, 'ent_id', 0);
+echo '<a href="'.$msg_url.'">'. _("View message") . '</a>';
+
 echo '</center></b></td></tr>';
 
 $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) {
@@ -59,7 +68,7 @@ foreach ($vcard as $l) {
             $k .= ';' . $attr;
     }
 
-    $v = ereg_replace(';', "\n", $v);
+    $v = str_replace(';', "\n", $v);
     $vcard_nice[$k] = $v;
 }
 
@@ -190,9 +199,9 @@ echo '</select>' .
         '</FORM>' .
         '</td></tr>' .
         '<tr><td align=center>' .
-        '<a href="../src/download.php?absolute_dl=true&passed_id=' .
-        $passed_id . '&mailbox=' . urlencode($mailbox) .
-        '&passed_ent_id=' . $passed_ent_id . '">' .
+        '<a href="../src/download.php?absolute_dl=true&amp;passed_id=' .
+        $passed_id . '&amp;mailbox=' . urlencode($mailbox) .
+        '&amp;passed_ent_id=' . $passed_ent_id . '">' .
         _("Download this as a file") . '</A>' .
         '</TD></TR></TABLE>' .
 
@@ -201,4 +210,4 @@ echo '</select>' .
         '</TD></TR></TABLE>' .
         '</body></html>';
 
-?>
\ No newline at end of file
+?>