A start for a new change_password master plugin. This is not finished
[squirrelmail.git] / plugins / listcommands / mailout.php
index 56b8416c4520782da4e992e3e5fa9488dded67e7..5d08b20b78d992801783f71786dd500c136a5661 100644 (file)
@@ -6,8 +6,11 @@
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * $Id$
+ * @package plugins
+ * @subpackage listcommands
  */
 
+/** @ignore */
 define('SM_PATH','../../');
 
 /* SquirrelMail required files. */
@@ -15,6 +18,7 @@ require_once(SM_PATH . 'include/validate.php');
 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);
 
@@ -48,40 +52,22 @@ printf( $out_string, htmlspecialchars($send_to) );
 
 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[0]['full_name'].'" <'.$idents[0]['email_address'].'>');
 }
 
 echo '<br />'