cleanup some plugins to make use of sqgetGlobalVar
[squirrelmail.git] / plugins / listcommands / mailout.php
CommitLineData
73ee43b1 1<?php
519f07d7 2/**
3 * mailout.php
73ee43b1 4 *
76911253 5 * Copyright (c) 1999-2003 The SquirrelMail Project Team
519f07d7 6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * $Id$
73ee43b1 9 */
050722c4 10
8d6a115b 11define('SM_PATH','../../');
cdf82d4a 12
13/* SquirrelMail required files. */
14require_once(SM_PATH . 'include/validate.php');
15include_once(SM_PATH . 'functions/page_header.php');
aa7fb30c 16include_once(SM_PATH . 'include/load_prefs.php');
cdf82d4a 17include_once(SM_PATH . 'functions/html.php');
73ee43b1 18
19displayPageHeader($color, $mailbox);
20
6a85a764 21/* get globals */
b587ac51 22sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
23sqgetGlobalVar('send_to', $send_to, SQ_GET);
24sqgetGlobalVar('subject', $subject, SQ_GET);
25sqgetGlobalVar('body', $body, SQ_GET);
26sqgetGlobalVar('action', $action, SQ_GET);
6a85a764 27
4cf43843 28echo html_tag('p', '', 'left' ) .
29html_tag( 'table', '', 'center', $color[0], 'border="0" width="75%"' ) . "\n" .
30 html_tag( 'tr',
31 html_tag( 'th', _("Mailinglist") . ' ' . _($action), '', $color[9] )
32 ) .
33 html_tag( 'tr' ) .
34 html_tag( 'td', '', 'left' );
73ee43b1 35
36switch ( $action ) {
83feb57a 37case 'help':
519f07d7 38 $out_string = _("This will send a message to %s requesting help for this list. You will receive an emailed response at the address below.");
73ee43b1 39 break;
83feb57a 40case 'subscribe':
519f07d7 41 $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.");
73ee43b1 42 break;
83feb57a 43case 'unsubscribe':
050722c4 44 $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.");
73ee43b1 45}
46
47printf( $out_string, htmlspecialchars($send_to) );
48
4cf43843 49echo '<form method="post" action="../../src/compose.php">';
73ee43b1 50
51/*
52 * Identity support (RFC 2369 sect. B.1.)
53 *
54 * I had to copy this from compose.php because there doesn't
55 * seem to exist a function to get the identities.
56 */
57
58$defaultmail = htmlspecialchars(getPref($data_dir, $username, 'full_name'));
59$em = getPref($data_dir, $username, 'email_address');
60if ($em != '') {
61 $defaultmail .= htmlspecialchars(' <' . $em . '>') . "\n";
62}
4cf43843 63echo html_tag('p', '', 'center' ) . _("From:") . ' ';
73ee43b1 64
050722c4 65$idents = getPref($data_dir, $username, 'identities');
66if ($idents != '' && $idents > 1) {
4cf43843 67 echo ' <select name="identity">' . "\n" .
68 '<option value="default">' . $defaultmail;
73ee43b1 69 for ($i = 1; $i < $idents; $i ++) {
70 echo '<option value="' . $i . '"';
71 if (isset($identity) && $identity == $i) {
4cf43843 72 echo ' selected';
73ee43b1 73 }
74 echo '>' . htmlspecialchars(getPref($data_dir, $username,
75 'full_name' . $i));
76 $em = getPref($data_dir, $username, 'email_address' . $i);
77 if ($em != '') {
78 echo htmlspecialchars(' <' . $em . '>') . "\n";
79 }
050722c4 80 }
73ee43b1 81 echo '</select>' . "\n" ;
82
050722c4 83} else {
73ee43b1 84 echo $defaultmail;
050722c4 85}
86
b1379bdf 87echo '<br />'
88. '<input type="hidden" name="send_to" value="' . htmlspecialchars($send_to) . '">'
89. '<input type="hidden" name="subject" value="' . htmlspecialchars($subject) . '">'
90. '<input type="hidden" name="body" value="' . htmlspecialchars($body) . '">'
91. '<input type="hidden" name="mailbox" value="' . htmlspecialchars($mailbox) . '">'
92. '<input type="submit" name="send" value="' . _("Send Mail") . '"><br /><br /></center>'
93. '</form></td></tr></table></p></body></html>';
665ec685 94?>