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