XSS fixes
[squirrelmail.git] / plugins / listcommands / mailout.php
1 <?php
2
3 /**
4 * mailout.php
5 *
6 * Copyright (c) 1999-2005 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * @version $Id$
10 * @package plugins
11 * @subpackage listcommands
12 */
13
14 /** @ignore */
15 define('SM_PATH','../../');
16
17 /* SquirrelMail required files. */
18 require_once(SM_PATH . 'include/validate.php');
19 include_once(SM_PATH . 'functions/page_header.php');
20 include_once(SM_PATH . 'include/load_prefs.php');
21 include_once(SM_PATH . 'functions/html.php');
22 require_once(SM_PATH . 'functions/identity.php');
23 require_once(SM_PATH . 'functions/forms.php');
24 include_once(SM_PATH . 'plugins/listcommands/functions.php');
25
26 /* get globals */
27 sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
28 sqgetGlobalVar('send_to', $send_to, SQ_GET);
29 sqgetGlobalVar('subject', $subject, SQ_GET);
30 sqgetGlobalVar('body', $body, SQ_GET);
31 sqgetGlobalVar('action', $action, SQ_GET);
32
33 displayPageHeader($color, $mailbox);
34 $fieldsdescr = listcommands_fieldsdescr();
35
36 switch ( $action ) {
37 case 'help':
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.");
39 break;
40 case 'subscribe':
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.");
42 break;
43 case 'unsubscribe':
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.");
45 break;
46 default:
47 error_box(sprintf(_("Unknown action: %s"),htmlspecialchars($action)), $color);
48 exit;
49 }
50
51 echo html_tag('p', '', 'left' ) .
52 html_tag( 'table', '', 'center', $color[0], 'border="0" width="75%"' ) . "\n" .
53 html_tag( 'tr',
54 html_tag( 'th', _("Mailinglist") . ': ' . $fieldsdescr[$action], '', $color[9] )
55 ) .
56 html_tag( 'tr' ) .
57 html_tag( 'td', '', 'left' );
58
59 printf($out_string, '&quot;' . htmlspecialchars($send_to) . '&quot;');
60
61 echo addForm(SM_PATH . 'src/compose.php', 'post');
62
63 $idents = get_identities();
64
65 echo html_tag('p', '', 'center' ) . _("From:") . ' ';
66
67 if (count($idents) > 1) {
68 echo '<select name="identity">';
69 foreach($idents as $nr=>$data) {
70 echo '<option value="' . $nr . '">' .
71 htmlspecialchars(
72 $data['full_name'].' <'.
73 $data['email_address'] . ">\n");
74 }
75 echo '</select>' . "\n" ;
76 } else {
77 echo htmlspecialchars('"'.$idents[0]['full_name'].'" <'.$idents[0]['email_address'].'>');
78 }
79
80 echo '<br />' .
81 addHidden('send_to', $send_to) .
82 addHidden('subject', $subject) .
83 addHidden('body', $body) .
84 addHidden('mailbox', $mailbox) .
85 addSubmit(_("Send Mail"), 'send');
86 ?>
87 <br /><br /></center>
88 </form></td></tr></table></p></body></html>