111903ffaa0e2e62de79492155223c21a601c238
[squirrelmail.git] / plugins / spamcop / options.php
1 <?php
2
3 /**
4 ** options.php -- SpamCop options page
5 **
6 ** Copyright (c) 1999-2003 The SquirrelMail development team
7 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 **
9 ** $Id$
10 * @package plugins
11 * @subpackage spamcop
12 **/
13
14 /** @ignore */
15 define('SM_PATH','../../');
16 require_once(SM_PATH . 'include/validate.php');
17
18 /**
19 * Internal spamcop plugin function.
20 *
21 * It is used to display similar action links.
22 */
23 function spamcop_enable_disable($option,$disable_action,$enable_action) {
24 if ($option) {
25 $ret= _("Enabled") . "(<a href=\"options.php?action=$disable_action\">" . _("Disable it") . "</a>)\n";
26 } else {
27 $ret = _("Disabled") . "(<a href=\"options.php?action=$enable_action\">" . _("Enable it") . "</a>)\n";
28 }
29 return $ret;
30 }
31
32 displayPageHeader($color, 'None');
33
34 /* globals */
35 sqgetGlobalVar('action', $action);
36 sqgetGlobalVar('meth', $meth);
37 sqgetGlobalVar('type', $type);
38 sqgetGlobalVar('ID' , $ID);
39
40 sqgetGlobalVar('username', $username, SQ_SESSION);
41 /* end of globals */
42
43 $action = (!isset($action) ? '' : $action);
44
45 switch ($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;
58 case 'meth':
59 if (isset($meth)) {
60 setPref($data_dir, $username, 'spamcop_method', $meth);
61 }
62 break;
63 case 'type':
64 if (isset($type)) {
65 setPref($data_dir, $username, 'spamcop_type', $type);
66 }
67 break;
68 case 'save_id':
69 if (isset($ID)) {
70 $ID = trim($ID);
71 $ID = preg_replace('/@.*/','',$ID);
72 $ID = preg_replace('/.*\./','',$ID);
73 setPref($data_dir, $username, 'spamcop_id', $ID);
74 }
75 break;
76 }
77
78 global $spamcop_enabled, $spamcop_delete, $spamcop_quick_report;
79 spamcop_load();
80
81 ?>
82 <br />
83 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
84 <tr><td bgcolor="<?php echo $color[0]; ?>">
85 <center><b><?php echo _("Options") . " - " . _("Spam reporting"); ?></b></center>
86 </td></tr></table>
87 <br />
88
89 <table align="center">
90 <tr>
91 <?php
92 echo html_tag('td',_("SpamCop link is:"),'right');
93 echo html_tag('td', spamcop_enable_disable($spamcop_enabled,'disable','enable') );
94 ?>
95 </tr>
96 <tr>
97 <?php
98 echo html_tag('td',_("Delete spam when reported:") . "<br />\n" .
99 '<font size="-2">(' . _("Only works with email-based reporting") . ')</font>',
100 'right','','valign="top"');
101 echo html_tag('td', spamcop_enable_disable($spamcop_delete,'save','delete'),'','','valign="top"');
102 ?>
103 </tr>
104 <tr>
105 <?php
106 echo html_tag('td',_("Spam Reporting Method:"),'right');
107 ?>
108 <form method="post" action="options.php">
109 <td>
110 <select name="meth">
111 <?php
112 if ($spamcop_quick_report) {
113 echo '<option value="quick_email"';
114 if ($spamcop_method == 'quick_email') echo ' selected';
115 echo ">"._("Quick email-based reporting");
116 echo '</option>';
117 }
118 ?>
119 <option value="thorough_email"
120 <?php
121 if ($spamcop_method == 'thorough_email') echo ' selected';
122 echo ">"._("Thorough email-based reporting");
123 ?>
124 </option>
125 <option value="web_form"
126 <?php
127 if ($spamcop_method == 'web_form') echo ' selected';
128 echo ">"._("Web-based form");
129 ?>
130 </option>
131 </select>
132 <input type="hidden" name="action" value="meth">
133 <input type="submit" value="<?php echo _("Save Method"); ?>">
134 </td></form>
135 </tr>
136 <tr>
137 <?php
138 echo html_tag('td',_("Spam Service Type:"),'right');
139 ?>
140 <form method="post" action="options.php">
141 <td>
142 <select name="type">
143 <option value="free"
144 <?php
145 if ($spamcop_type == 'free') echo ' selected';
146 echo ">"._("Free reporting");
147 ?>
148 </option>
149 <option value="member"
150 <?php
151 if ($spamcop_type == 'member') echo ' selected';
152 echo ">"._("Member services");
153 ?>
154 </option>
155 </select>
156 <input type="hidden" name="action" value="type">
157 <input type="submit" value="<?php echo _("Save Service Type"); ?>">
158 </td></form>
159 </tr>
160 <tr>
161 <?php
162 echo html_tag('td',_("Your SpamCop authorization code:") . "<br />" .
163 '<font size="-2">(' . _("see below") . ')</font>','right','','valign="top"');
164 ?>
165 <form method="post" action="options.php"><td valign="top">
166 <input type="text" size="30" name="ID" value="<?php echo htmlspecialchars($spamcop_id) ?>" />
167 <input type="hidden" name="action" value="save_id" />
168 <input type="submit" value="<?php echo _("Save ID"); ?>" />
169 </td></form>
170 </tr>
171 </table>
172 <?php
173 echo "<p>";
174 echo _("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.");
175 echo "</p>\n";
176
177 echo "<p>";
178 echo _("To use it, you must get a SpamCop authorization code. There is a free <a href=\"http://spamcop.net/anonsignup.shtml\">sign up page</a> so you can use SpamCop.");
179 echo "</p>\n";
180
181 echo "<p>";
182 echo _("<b>Before you sign up, be warned:</b> 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 (<a href=\"http://www.yahoo.com/\">Yahoo!</a> has 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/\">list of places</a>) so that messages from system administrators and whatnot can be sent to you.");
183 echo "</p>\n";
184
185 echo "<p>";
186 echo _("Once you have signed up with SpamCop and have received your SpamCop authorization code, you need to enable this plugin -- just click 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.");
187 echo "</p>\n";
188
189 echo "<p><b>" . _("Email-based Reporting") . "</b><br />";
190 echo _("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.");
191 echo "</p>";
192
193 if ($spamcop_quick_report) {
194 echo "<p>";
195 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.");
196 echo "</p>\n";
197 }
198
199 echo "<p><b>" . _("Web-based Reporting") . "</b><br />";
200 echo _("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.");
201 echo "</p>\n";
202
203 echo "<p>";
204 echo _("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.");
205 echo "</p>\n";
206
207 echo "<p><b>". _("Spamcop Service Type") . "</b><br />\n";
208 echo _("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.");
209 echo "</p>\n";
210
211 echo "<p>";
212 echo _("<b>For more information</b> about SpamCop, it's services, spam in general, and many related topics, try reading through SpamCop's <a href=\"http://spamcop.net/help.shtml\">Help and Feedback</a> section.");
213 echo "</p>\n";
214 ?>
215 </body></html>