handle DB.php load errors inside preference class and don't worry about
[squirrelmail.git] / plugins / spamcop / options.php
CommitLineData
772be735 1<?php
772be735 2
f3a91d6b 3/**
4b4abf93 4 * options.php -- SpamCop options page
f3a91d6b 5 *
47ccfad4 6 * @copyright &copy; 1999-2006 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
202bcbcc 13
14/**
15 * Include the SquirrelMail initialization file.
16 */
17require('../../include/init.php');
da297dd0 18/* plugin functions */
19include_once(SM_PATH . 'plugins/spamcop/functions.php');
876efbe1 20
04f6008a 21displayPageHeader($color, 'None');
91e0dccc 22
da297dd0 23/** is spamcop plugin disabled */
24// option changes do nothing, if read_body_header_right hook is not active.
25
04f6008a 26/* globals */
3267e4d8 27sqgetGlobalVar('action', $action);
28sqgetGlobalVar('meth', $meth);
9a422982 29sqgetGlobalVar('type', $type);
8ddc4111 30sqgetGlobalVar('ID' , $ID);
31
32sqgetGlobalVar('username', $username, SQ_SESSION);
04f6008a 33/* end of globals */
772be735 34
8d6a115b 35$action = (!isset($action) ? '' : $action);
772be735 36
8d6a115b 37switch ($action) {
38 case 'enable':
39 setPref($data_dir, $username, 'spamcop_enabled', 1);
40 break;
41 case 'disable':
42 setPref($data_dir, $username, 'spamcop_enabled', '');
43 break;
44 case 'save':
45 setPref($data_dir, $username, 'spamcop_delete', '');
46 break;
47 case 'delete':
48 setPref($data_dir, $username, 'spamcop_delete', 1);
49 break;
9f06a087 50 case 'keep':
51 setPref($data_dir, $username, 'spamcop_save', 0);
52 break;
53 case 'dontkeep':
54 setPref($data_dir, $username, 'spamcop_save', 1);
55 break;
8d6a115b 56 case 'meth':
57 if (isset($meth)) {
58 setPref($data_dir, $username, 'spamcop_method', $meth);
59 }
60 break;
9a422982 61 case 'type':
62 if (isset($type)) {
63 setPref($data_dir, $username, 'spamcop_type', $type);
64 }
91e0dccc 65 break;
8d6a115b 66 case 'save_id':
67 if (isset($ID)) {
dcf59aa6 68 $ID = trim($ID);
69 $ID = preg_replace('/@.*/','',$ID);
70 $ID = preg_replace('/.*\./','',$ID);
8d6a115b 71 setPref($data_dir, $username, 'spamcop_id', $ID);
72 }
73 break;
74}
75
9f06a087 76global $spamcop_enabled, $spamcop_delete, $spamcop_save, $spamcop_quick_report;
da297dd0 77spamcop_load_function();
8d6a115b 78
79?>
8ddc4111 80 <br />
81 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
82 <tr><td bgcolor="<?php echo $color[0]; ?>">
f265009a 83 <div style="text-align: center;"><b>
91e0dccc 84 <?php echo _("Options") . " - " . _("Spam reporting"); ?>
f265009a 85 </b></div>
772be735 86 </td></tr></table>
8ddc4111 87 <br />
91e0dccc 88
8ddc4111 89 <table align="center">
772be735 90 <tr>
91e0dccc 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 '<small>(' . _("Only works with email-based reporting") . ')</small>',
100 'right','','valign="top"');
101 echo html_tag('td', spamcop_enable_disable($spamcop_delete,'save','delete'),'','','valign="top"');
102 ?>
103 </tr>
9f06a087 104 <tr>
105 <?php
25051817 106 echo html_tag('td',_("Save emails submitted to SpamCop:") . "<br />\n" .
9f06a087 107 '<small>(' . _("Only works with email-based reporting") . ')</small>',
108 'right','','valign="top"');
109 echo html_tag('td', spamcop_enable_disable($spamcop_save,'keep','dontkeep'),'','','valign="top"');
110 ?>
111 </tr>
91e0dccc 112 <tr>
113 <?php
114 echo html_tag('td',_("Spam Reporting Method:"),'right');
115 ?>
116 <td>
117 <form method="post" action="options.php">
118 <select name="meth">
119 <?php
120 if ($spamcop_quick_report) {
121 echo '<option value="quick_email"';
122 if ($spamcop_method == 'quick_email') echo ' selected="selected"';
123 echo ">"._("Quick email-based reporting");
124 echo '</option>';
125 }
126 ?>
127 <option value="thorough_email"
128 <?php
129 if ($spamcop_method == 'thorough_email') echo ' selected="selected"';
130 echo ">"._("Thorough email-based reporting");
131 ?>
132 </option>
133 <option value="web_form"
134 <?php
135 if ($spamcop_method == 'web_form') echo ' selected="selected"';
136 echo ">"._("Web-based form");
137 ?>
138 </option>
139 </select>
140 <input type="hidden" name="action" value="meth" />
141 <?php
142 echo '<input type="submit" value="' . _("Save Method") . "\" />\n";
143 ?>
144 </form></td>
145 </tr>
146 <tr>
147 <?php
148 echo html_tag('td',_("Spam Service Type:"),'right');
149 ?>
150 <td>
151 <form method="post" action="options.php">
152 <select name="type">
153 <option value="free"
154 <?php
155 if ($spamcop_type == 'free') echo ' selected="selected"';
156 echo ">"._("Free reporting");
157 ?>
158 </option>
159 <option value="member"
160 <?php
161 if ($spamcop_type == 'member') echo ' selected="selected"';
162 echo ">"._("Member services");
163 ?>
164 </option>
165 </select>
166 <?php
167 echo '<input type="hidden" name="action" value="type" />' .
168 '<input type="submit" value="' . _("Save Service Type") . "\" />\n";
169 ?>
170 </form></td>
171 </tr>
772be735 172 <tr>
91e0dccc 173 <?php
174 echo html_tag('td',_("Your SpamCop authorization code:") . "<br />" .
175 '<small>(' . _("see below") . ')</small>','right','','valign="top"');
176 ?>
177 <td valign="top"><form method="post" action="options.php">
178 <input type="text" size="30" name="ID" value="<?php echo htmlspecialchars($spamcop_id) ?>" />
179 <input type="hidden" name="action" value="save_id" />
180 <?php
181 echo '<input type="submit" value="' . _("Save ID") . "\" />\n";
182 ?>
183 </form></td>
184 </tr>
772be735 185 </table>
2bd52bbe 186<?php
74091b64 187echo '<p><b>' . _("About SpamCop") . '</b><br />';
2bd52bbe 188echo _("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.");
189echo "</p>\n";
190
74091b64 191echo '<p>';
192printf(_("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 193echo "</p>\n";
194
74091b64 195echo '<p><b>' . _("Before you sign up, be warned") . '</b><br />';
196printf(_("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 197echo "</p>\n";
198
74091b64 199echo '<p>';
200echo _("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 201echo "</p>\n";
772be735 202
74091b64 203echo '<p><b>' . _("Email-based reporting") . '</b><br />';
ae394964 204echo _("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 205echo "</p>\n";
772be735 206
057e9d6e 207if ($spamcop_quick_report) {
74091b64 208 echo '<p>';
209 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.");
210 echo "</p>\n";
057e9d6e 211}
2bd52bbe 212
74091b64 213echo '<p><b>' . _("Web-based reporting") . '</b><br />';
2bd52bbe 214echo _("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.");
215echo "</p>\n";
216
74091b64 217echo '<p>';
ae394964 218echo _("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 219echo "</p>\n";
220
43404bdc 221echo '<p><b>' . _("SpamCop service type") . '</b><br />';
f71e1cae 222echo _("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 223echo "</p>\n";
224
74091b64 225echo '<p><b>' . _("More information") . '</b><br />';
226printf(_("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 227echo "</p>\n";
dcc1cc82 228?>
91e0dccc 229</body></html>