include_once(SM_PATH . 'functions/page_header.php');
include_once(SM_PATH . 'include/load_prefs.php');
include_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/identity.php');
displayPageHeader($color, $mailbox);
echo '<form method="post" action="../../src/compose.php">';
-/*
- * Identity support (RFC 2369 sect. B.1.)
- *
- * I had to copy this from compose.php because there doesn't
- * seem to exist a function to get the identities.
- */
-$defaultmail = htmlspecialchars(getPref($data_dir, $username, 'full_name'));
-$em = getPref($data_dir, $username, 'email_address');
-if ($em != '') {
- $defaultmail .= htmlspecialchars(' <' . $em . '>') . "\n";
-}
+$idents = get_identities();
+
echo html_tag('p', '', 'center' ) . _("From:") . ' ';
-$idents = getPref($data_dir, $username, 'identities');
-if ($idents != '' && $idents > 1) {
- echo ' <select name="identity">' . "\n" .
- '<option value="default">' . $defaultmail;
- for ($i = 1; $i < $idents; $i ++) {
- echo '<option value="' . $i . '"';
- if (isset($identity) && $identity == $i) {
- echo ' selected';
- }
- echo '>' . htmlspecialchars(getPref($data_dir, $username,
- 'full_name' . $i));
- $em = getPref($data_dir, $username, 'email_address' . $i);
- if ($em != '') {
- echo htmlspecialchars(' <' . $em . '>') . "\n";
- }
+if (count($idents) > 1) {
+ echo '<select name="identity">';
+ foreach($idents as $nr=>$data) {
+ echo '<option value="' . $nr . '">' .
+ htmlspecialchars(
+ $data['full_name'].' <'.
+ $data['email_address'] . ">\n");
}
echo '</select>' . "\n" ;
-
} else {
- echo $defaultmail;
+ echo htmlspecialchars('"'.$idents['default']['full_name'].'" <'.$idents['default']['email_address'].'>');
}
echo '<br />'