9a76fd3bd3a854723436b19a8a9faeeab86f1289
[squirrelmail.git] / plugins / listcommands / mailout.php
1 <?php
2
3 /**
4 * mailout.php
5 *
6 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
8 * @version $Id$
9 * @package plugins
10 * @subpackage listcommands
11 */
12
13 /** @ignore */
14 define('SM_PATH','../../');
15
16 /* SquirrelMail required files. */
17 require_once(SM_PATH . 'include/validate.php');
18 include_once(SM_PATH . 'functions/page_header.php');
19 include_once(SM_PATH . 'include/load_prefs.php');
20 include_once(SM_PATH . 'functions/html.php');
21 require_once(SM_PATH . 'functions/identity.php');
22 require_once(SM_PATH . 'functions/forms.php');
23 include_once(SM_PATH . 'plugins/listcommands/functions.php');
24
25 /* get globals */
26 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
27 sqgetGlobalVar('send_to', $send_to, SQ_GET);
28 sqgetGlobalVar('subject', $subject, SQ_GET);
29 sqgetGlobalVar('body', $body, SQ_GET);
30 sqgetGlobalVar('action', $action, SQ_GET);
31
32 displayPageHeader($color, $mailbox);
33 $fieldsdescr = listcommands_fieldsdescr();
34
35 switch ( $action ) {
36 case 'help':
37 $out_string = _("This will send a message to %s requesting help for this list. You will receive an emailed response at the address below.");
38 break;
39 case 'subscribe':
40 $out_string = _("This will send a message to %s requesting that you will be subscribed to this list. You will be subscribed with the address below.");
41 break;
42 case 'unsubscribe':
43 $out_string = _("This will send a message to %s requesting that you will be unsubscribed from this list. It will try to unsubscribe the adress below.");
44 break;
45 default:
46 error_box(sprintf(_("Unknown action: %s"),htmlspecialchars($action)), $color);
47 exit;
48 }
49
50 echo html_tag('p', '', 'left' ) .
51 html_tag( 'table', '', 'center', $color[0], 'border="0" width="75%"' ) . "\n" .
52 html_tag( 'tr',
53 html_tag( 'th', _("Mailinglist") . ': ' . $fieldsdescr[$action], '', $color[9] )
54 ) .
55 html_tag( 'tr' ) .
56 html_tag( 'td', '', 'left' );
57
58 printf($out_string, '&quot;' . htmlspecialchars($send_to) . '&quot;');
59
60 echo addForm(SM_PATH . 'src/compose.php', 'post');
61
62 $idents = get_identities();
63
64 echo html_tag('p', '', 'center' ) . _("From:") . ' ';
65
66 if (count($idents) > 1) {
67 echo '<select name="identity">';
68 foreach($idents as $nr=>$data) {
69 echo '<option value="' . $nr . '">' .
70 htmlspecialchars(
71 $data['full_name'].' <'.
72 $data['email_address'] . ">\n");
73 }
74 echo '</select>' . "\n" ;
75 } else {
76 echo htmlspecialchars('"'.$idents[0]['full_name'].'" <'.$idents[0]['email_address'].'>');
77 }
78
79 echo '<br />' .
80 addHidden('send_to', $send_to) .
81 addHidden('subject', $subject) .
82 addHidden('body', $body) .
83 addHidden('mailbox', $mailbox) .
84 addSubmit(_("Send Mail"), 'send');
85 ?>
86 <br /><br /></div>
87 </form></td></tr></table></p></body></html>