moving functions to separate file, adding configuration files
[squirrelmail.git] / plugins / spamcop / options.php
CommitLineData
772be735 1<?php
772be735 2
f3a91d6b 3/**
4 * options.php -- SpamCop options page
5 *
6 * @copyright (c) 1999-2004 The SquirrelMail development team
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) {
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
04f6008a 32displayPageHeader($color, 'None');
33
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;
58 case 'meth':
59 if (isset($meth)) {
60 setPref($data_dir, $username, 'spamcop_method', $meth);
61 }
62 break;
9a422982 63 case 'type':
64 if (isset($type)) {
65 setPref($data_dir, $username, 'spamcop_type', $type);
66 }
67 break;
8d6a115b 68 case 'save_id':
69 if (isset($ID)) {
dcf59aa6 70 $ID = trim($ID);
71 $ID = preg_replace('/@.*/','',$ID);
72 $ID = preg_replace('/.*\./','',$ID);
8d6a115b 73 setPref($data_dir, $username, 'spamcop_id', $ID);
74 }
75 break;
76}
77
057e9d6e 78global $spamcop_enabled, $spamcop_delete, $spamcop_quick_report;
8d6a115b 79spamcop_load();
80
81?>
8ddc4111 82 <br />
83 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
84 <tr><td bgcolor="<?php echo $color[0]; ?>">
7d56f214 85 <center><b>
86 <?php echo _("Options") . " - " . _("Spam reporting"); ?>
87 </b></center>
772be735 88 </td></tr></table>
8ddc4111 89 <br />
772be735 90
8ddc4111 91 <table align="center">
772be735 92 <tr>
876efbe1 93 <?php
94 echo html_tag('td',_("SpamCop link is:"),'right');
95 echo html_tag('td', spamcop_enable_disable($spamcop_enabled,'disable','enable') );
96 ?>
772be735 97 </tr>
98 <tr>
876efbe1 99 <?php
100 echo html_tag('td',_("Delete spam when reported:") . "<br />\n" .
7d56f214 101 '<small>(' . _("Only works with email-based reporting") . ')</small>',
876efbe1 102 'right','','valign="top"');
103 echo html_tag('td', spamcop_enable_disable($spamcop_delete,'save','delete'),'','','valign="top"');
104 ?>
772be735 105 </tr>
106 <tr>
876efbe1 107 <?php
108 echo html_tag('td',_("Spam Reporting Method:"),'right');
109 ?>
876efbe1 110 <td>
ae394964 111 <form method="post" action="options.php">
8ddc4111 112 <select name="meth">
876efbe1 113 <?php
057e9d6e 114 if ($spamcop_quick_report) {
115 echo '<option value="quick_email"';
e1728a7a 116 if ($spamcop_method == 'quick_email') echo ' selected="selected"';
057e9d6e 117 echo ">"._("Quick email-based reporting");
118 echo '</option>';
119 }
120 ?>
876efbe1 121 <option value="thorough_email"
122 <?php
e1728a7a 123 if ($spamcop_method == 'thorough_email') echo ' selected="selected"';
876efbe1 124 echo ">"._("Thorough email-based reporting");
125 ?>
126 </option>
127 <option value="web_form"
128 <?php
e1728a7a 129 if ($spamcop_method == 'web_form') echo ' selected="selected"';
876efbe1 130 echo ">"._("Web-based form");
131 ?>
132 </option>
772be735 133 </select>
7d56f214 134 <input type="hidden" name="action" value="meth" />
135 <?php
136 echo '<input type="submit" value="' . _("Save Method") . "\" />\n";
137 ?>
ae394964 138 </form></td>
772be735 139 </tr>
9a422982 140 <tr>
7d56f214 141 <?php
142 echo html_tag('td',_("Spam Service Type:"),'right');
143 ?>
9a422982 144 <td>
ae394964 145 <form method="post" action="options.php">
9a422982 146 <select name="type">
147 <option value="free"
148 <?php
e1728a7a 149 if ($spamcop_type == 'free') echo ' selected="selected"';
9a422982 150 echo ">"._("Free reporting");
151 ?>
152 </option>
153 <option value="member"
154 <?php
e1728a7a 155 if ($spamcop_type == 'member') echo ' selected="selected"';
9a422982 156 echo ">"._("Member services");
157 ?>
158 </option>
159 </select>
7d56f214 160 <?php
161 echo '<input type="hidden" name="action" value="type" />' .
162 '<input type="submit" value="' . _("Save Service Type") . "\" />\n";
163 ?>
ae394964 164 </form></td>
9a422982 165 </tr>
772be735 166 <tr>
876efbe1 167 <?php
168 echo html_tag('td',_("Your SpamCop authorization code:") . "<br />" .
7d56f214 169 '<small>(' . _("see below") . ')</small>','right','','valign="top"');
876efbe1 170 ?>
ae394964 171 <td valign="top"><form method="post" action="options.php">
2bd52bbe 172 <input type="text" size="30" name="ID" value="<?php echo htmlspecialchars($spamcop_id) ?>" />
8ddc4111 173 <input type="hidden" name="action" value="save_id" />
7d56f214 174 <?php
175 echo '<input type="submit" value="' . _("Save ID") . "\" />\n";
176 ?>
ae394964 177 </form></td>
772be735 178 </tr>
179 </table>
2bd52bbe 180<?php
74091b64 181echo '<p><b>' . _("About SpamCop") . '</b><br />';
2bd52bbe 182echo _("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.");
183echo "</p>\n";
184
74091b64 185echo '<p>';
186printf(_("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 187echo "</p>\n";
188
74091b64 189echo '<p><b>' . _("Before you sign up, be warned") . '</b><br />';
190printf(_("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 191echo "</p>\n";
192
74091b64 193echo '<p>';
194echo _("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 195echo "</p>\n";
772be735 196
74091b64 197echo '<p><b>' . _("Email-based reporting") . '</b><br />';
ae394964 198echo _("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 199echo "</p>\n";
772be735 200
057e9d6e 201if ($spamcop_quick_report) {
74091b64 202 echo '<p>';
203 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.");
204 echo "</p>\n";
057e9d6e 205}
2bd52bbe 206
74091b64 207echo '<p><b>' . _("Web-based reporting") . '</b><br />';
2bd52bbe 208echo _("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.");
209echo "</p>\n";
210
74091b64 211echo '<p>';
ae394964 212echo _("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 213echo "</p>\n";
214
43404bdc 215echo '<p><b>' . _("SpamCop service type") . '</b><br />';
f71e1cae 216echo _("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 217echo "</p>\n";
218
74091b64 219echo '<p><b>' . _("More information") . '</b><br />';
220printf(_("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 221echo "</p>\n";
dcc1cc82 222?>
223</body></html>