using squirrelmail api for error message
[squirrelmail.git] / plugins / spamcop / options.php
CommitLineData
772be735 1<?php
772be735 2
f3a91d6b 3/**
4 * options.php -- SpamCop options page
5 *
9eb3fcb3 6 * @copyright (c) 1999-2005 The SquirrelMail Project Team
f3a91d6b 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
8 * @version $Id$
9 * @package plugins
10 * @subpackage spamcop
11 */
04f6008a 12
ea5f4b8e 13/** @ignore */
92219031 14define('SM_PATH','../../');
8d6a115b 15require_once(SM_PATH . 'include/validate.php');
772be735 16
9a422982 17/**
18 * Internal spamcop plugin function.
19 *
20 * It is used to display similar action links.
f3a91d6b 21 * @access private
9a422982 22 */
876efbe1 23function spamcop_enable_disable($option,$disable_action,$enable_action) {
91e0dccc 24 if ($option) {
9f06a087 25 $ret= _("Enabled") . " (<a href=\"options.php?action=$disable_action\">" . _("Disable it") . "</a>)\n";
876efbe1 26 } else {
9f06a087 27 $ret = _("Disabled") . " (<a href=\"options.php?action=$enable_action\">" . _("Enable it") . "</a>)\n";
876efbe1 28 }
29 return $ret;
30}
31
04f6008a 32displayPageHeader($color, 'None');
91e0dccc 33
04f6008a 34/* globals */
3267e4d8 35sqgetGlobalVar('action', $action);
36sqgetGlobalVar('meth', $meth);
9a422982 37sqgetGlobalVar('type', $type);
8ddc4111 38sqgetGlobalVar('ID' , $ID);
39
40sqgetGlobalVar('username', $username, SQ_SESSION);
04f6008a 41/* end of globals */
772be735 42
8d6a115b 43$action = (!isset($action) ? '' : $action);
772be735 44
8d6a115b 45switch ($action) {
46 case 'enable':
47 setPref($data_dir, $username, 'spamcop_enabled', 1);
48 break;
49 case 'disable':
50 setPref($data_dir, $username, 'spamcop_enabled', '');
51 break;
52 case 'save':
53 setPref($data_dir, $username, 'spamcop_delete', '');
54 break;
55 case 'delete':
56 setPref($data_dir, $username, 'spamcop_delete', 1);
57 break;
9f06a087 58 case 'keep':
59 setPref($data_dir, $username, 'spamcop_save', 0);
60 break;
61 case 'dontkeep':
62 setPref($data_dir, $username, 'spamcop_save', 1);
63 break;
8d6a115b 64 case 'meth':
65 if (isset($meth)) {
66 setPref($data_dir, $username, 'spamcop_method', $meth);
67 }
68 break;
9a422982 69 case 'type':
70 if (isset($type)) {
71 setPref($data_dir, $username, 'spamcop_type', $type);
72 }
91e0dccc 73 break;
8d6a115b 74 case 'save_id':
75 if (isset($ID)) {
dcf59aa6 76 $ID = trim($ID);
77 $ID = preg_replace('/@.*/','',$ID);
78 $ID = preg_replace('/.*\./','',$ID);
8d6a115b 79 setPref($data_dir, $username, 'spamcop_id', $ID);
80 }
81 break;
82}
83
9f06a087 84global $spamcop_enabled, $spamcop_delete, $spamcop_save, $spamcop_quick_report;
8d6a115b 85spamcop_load();
86
87?>
8ddc4111 88 <br />
89 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
90 <tr><td bgcolor="<?php echo $color[0]; ?>">
91e0dccc 91 <center><b>
92 <?php echo _("Options") . " - " . _("Spam reporting"); ?>
93 </b></center>
772be735 94 </td></tr></table>
8ddc4111 95 <br />
91e0dccc 96
8ddc4111 97 <table align="center">
772be735 98 <tr>
91e0dccc 99 <?php
100 echo html_tag('td',_("SpamCop link is:"),'right');
101 echo html_tag('td', spamcop_enable_disable($spamcop_enabled,'disable','enable') );
102 ?>
103 </tr>
104 <tr>
105 <?php
106 echo html_tag('td',_("Delete spam when reported:") . "<br />\n" .
107 '<small>(' . _("Only works with email-based reporting") . ')</small>',
108 'right','','valign="top"');
109 echo html_tag('td', spamcop_enable_disable($spamcop_delete,'save','delete'),'','','valign="top"');
110 ?>
111 </tr>
9f06a087 112 <tr>
113 <?php
114 echo html_tag('td',_("Save emails submitted to spamcop:") . "<br />\n" .
115 '<small>(' . _("Only works with email-based reporting") . ')</small>',
116 'right','','valign="top"');
117 echo html_tag('td', spamcop_enable_disable($spamcop_save,'keep','dontkeep'),'','','valign="top"');
118 ?>
119 </tr>
91e0dccc 120 <tr>
121 <?php
122 echo html_tag('td',_("Spam Reporting Method:"),'right');
123 ?>
124 <td>
125 <form method="post" action="options.php">
126 <select name="meth">
127 <?php
128 if ($spamcop_quick_report) {
129 echo '<option value="quick_email"';
130 if ($spamcop_method == 'quick_email') echo ' selected="selected"';
131 echo ">"._("Quick email-based reporting");
132 echo '</option>';
133 }
134 ?>
135 <option value="thorough_email"
136 <?php
137 if ($spamcop_method == 'thorough_email') echo ' selected="selected"';
138 echo ">"._("Thorough email-based reporting");
139 ?>
140 </option>
141 <option value="web_form"
142 <?php
143 if ($spamcop_method == 'web_form') echo ' selected="selected"';
144 echo ">"._("Web-based form");
145 ?>
146 </option>
147 </select>
148 <input type="hidden" name="action" value="meth" />
149 <?php
150 echo '<input type="submit" value="' . _("Save Method") . "\" />\n";
151 ?>
152 </form></td>
153 </tr>
154 <tr>
155 <?php
156 echo html_tag('td',_("Spam Service Type:"),'right');
157 ?>
158 <td>
159 <form method="post" action="options.php">
160 <select name="type">
161 <option value="free"
162 <?php
163 if ($spamcop_type == 'free') echo ' selected="selected"';
164 echo ">"._("Free reporting");
165 ?>
166 </option>
167 <option value="member"
168 <?php
169 if ($spamcop_type == 'member') echo ' selected="selected"';
170 echo ">"._("Member services");
171 ?>
172 </option>
173 </select>
174 <?php
175 echo '<input type="hidden" name="action" value="type" />' .
176 '<input type="submit" value="' . _("Save Service Type") . "\" />\n";
177 ?>
178 </form></td>
179 </tr>
772be735 180 <tr>
91e0dccc 181 <?php
182 echo html_tag('td',_("Your SpamCop authorization code:") . "<br />" .
183 '<small>(' . _("see below") . ')</small>','right','','valign="top"');
184 ?>
185 <td valign="top"><form method="post" action="options.php">
186 <input type="text" size="30" name="ID" value="<?php echo htmlspecialchars($spamcop_id) ?>" />
187 <input type="hidden" name="action" value="save_id" />
188 <?php
189 echo '<input type="submit" value="' . _("Save ID") . "\" />\n";
190 ?>
191 </form></td>
192 </tr>
772be735 193 </table>
2bd52bbe 194<?php
74091b64 195echo '<p><b>' . _("About SpamCop") . '</b><br />';
2bd52bbe 196echo _("SpamCop is a free service that greatly assists in finding the true source of the spam and helps in letting the proper people know about the abuse.");
197echo "</p>\n";
198
74091b64 199echo '<p>';
200printf(_("To use it, you must get a SpamCop authorization code. There is a free %ssign up page%s so you can use SpamCop."), '<a href="http://spamcop.net/anonsignup.shtml">', '</a>');
2bd52bbe 201echo "</p>\n";
202
74091b64 203echo '<p><b>' . _("Before you sign up, be warned") . '</b><br />';
204printf(_("Some users have reported that the email addresses used with SpamCop find their way onto spam lists. To be safe, you can just create an email forwarding account and have all SpamCop reports get sent to there. Also, if it gets flooded with spam, you can then just delete that account with no worries about losing your real email address. Just go create an email forwarder somewhere (%s has a %slist of places%s) so that messages from system administrators and what not can be sent to you."), '<a href="http://www.yahoo.com/">Yahoo!</a>', '<a href="http://dir.yahoo.com/Business_and_Economy/Business_to_Business/Communications_and_Networking/Internet_and_World_Wide_Web/Email_Providers/Forwarding_Services/Free_Forwarding/">', '</a>');
2bd52bbe 205echo "</p>\n";
206
74091b64 207echo '<p>';
208echo _("Once you have signed up with SpamCop and have received your SpamCop authorization code, you need to enable this plugin by clicking the link above. Once enabled, you go about your normal life. If you encounter a spam message in your mailbox, just view it. On the right-hand side, near the top of where the message is displayed, you will see a link to report this message as spam. Clicking on it brings you to a confirmation page. Confirming that you want the spam report sent will do different things with different reporting methods.");
2bd52bbe 209echo "</p>\n";
772be735 210
74091b64 211echo '<p><b>' . _("Email-based reporting") . '</b><br />';
ae394964 212echo _("Pressing the button forwards the message to the SpamCop service and will optionally delete the message. From there, you just need to go to your INBOX and quite soon a message should appear from SpamCop. (It gets sent to the account you registered with, so make sure that your mail forwarder works!) Open it up, click on the appropriate link at the top, and a new browser window will open.");
74091b64 213echo "</p>\n";
772be735 214
057e9d6e 215if ($spamcop_quick_report) {
74091b64 216 echo '<p>';
217 echo _("Currently, the quick reporting just forwards the request to the thorough reporting. Also, it appears that this is for members (non-free) only. Hopefully this will change soon.");
218 echo "</p>\n";
057e9d6e 219}
2bd52bbe 220
74091b64 221echo '<p><b>' . _("Web-based reporting") . '</b><br />';
2bd52bbe 222echo _("When you press the button on the confirmation page, this will pop open a new browser window and the SpamCop service should appear inside. The message will not be deleted (working on that part), but you won't need to wait for a response email to start the spam reporting.");
223echo "</p>\n";
224
74091b64 225echo '<p>';
ae394964 226echo _("The SpamCop service will display information as it finds it, so scroll down until you see a form button. It might pause a little while it is looking up information, so be a little patient. Read what it says, and submit the spam. Close the browser window. Press Cancel or click on the appropriate mail folder to see messages and/or delete the spam.");
9a422982 227echo "</p>\n";
228
43404bdc 229echo '<p><b>' . _("SpamCop service type") . '</b><br />';
f71e1cae 230echo _("Service type option allows selecting which SpamCop services you are using. Member services use different web reporting forms and does not display nags. You can purchase these services, if you want to support SpamCop.");
2bd52bbe 231echo "</p>\n";
232
74091b64 233echo '<p><b>' . _("More information") . '</b><br />';
234printf(_("For more information about SpamCop, it's services, spam in general, and many related topics, try reading through SpamCop's %sHelp and Feedback%s section."), '<a href="http://spamcop.net/help.shtml">', '</a>');
2bd52bbe 235echo "</p>\n";
dcc1cc82 236?>
91e0dccc 237</body></html>