/**
* vcard.php
*
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
* This file shows an attched vcard
*
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
*/
/* SquirrelMail required files. */
require_once(SM_PATH . 'include/validate.php');
require_once(SM_PATH . 'functions/mime.php');
+require_once(SM_PATH . 'functions/url_parser.php');
/* globals */
sqgetGlobalVar('username', $username, SQ_SESSION);
$ShowValues = array(
'fn' => _("Name"),
'title' => _("Title"),
- 'email;internet' => _("Email"),
+ 'email;internet' => _("E-mail"),
'url' => _("Web Page"),
'org' => _("Organization / Department"),
'adr' => _("Address"),
</td></tr></table>
<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr><td bgcolor="<?php echo $color[0]; ?>">
-<center><b><?php echo _("Add to Addressbook"); ?></b></center>
+<center><b><?php echo _("Add to address book"); ?></b></center>
</td></tr>
<tr><td align="center">
<?php echo addForm('../src/addressbook.php', 'post', 'f_add'); ?><br />
'-' . $vcard_safe['lastname'], '20');
/*
- * If the vcard comes with an e-mail address it should be added to the
+ * If the vCard comes with an e-mail address it should be added to the
* address book, otherwise the user must add one manually to avoid an
- * error message in src/addressbook.php.
- *
- * TODO: If there's no e-mail address in the vcard, use the sender's address
- * instead of letting the user entering it manually.
+ * error message in src/addressbook.php. SquirrelMail is nice enough to
+ * suggest the e-mail address of the sender though.
*/
if (isset($vcard_nice['email;internet'])) {
echo addHidden('addaddr[email]', $vcard_nice['email;internet']);
} else {
+ $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
+ $header = $message->rfc822_header;
+ $from_name = $header->getAddr_s('from');
+
echo '</td></tr>' .
'<tr><td align="right"><b>' . _("E-mail address") . ':</b></td><td>' .
- addInput('addaddr[email]', '', '20');
+ addInput('addaddr[email]',
+ getEmail(decodeHeader($from_name)), '20');
}
echo '</td></tr>' .
echo addHidden('addaddr[firstname]', $vcard_safe['firstname']) .
addHidden('addaddr[lastname]', $vcard_safe['lastname']) .
- addSubmit(_("Add to Address Book"), 'addaddr[SUBMIT]');
+ addSubmit(_("Add to address book"), 'addaddr[SUBMIT]');
?>
</td></tr>
<table border="0" cellspacing="0" cellpadding="2" align="center">
<tr><td bgcolor="<?php echo $color[4]; ?>">
</td></tr></table>
-</body></html>
+</body></html>
\ No newline at end of file