Adding support for spamcop member service.
[squirrelmail.git] / plugins / spamcop / options.php
index d264cf933d4e47d232fd020a93012f7df65b9289..111903ffaa0e2e62de79492155223c21a601c238 100755 (executable)
@@ -7,11 +7,19 @@
     **  Licensed under the GNU GPL. For full terms see the file COPYING.
     **
     **  $Id$
+    * @package plugins
+    * @subpackage spamcop
     **/
 
+/** @ignore */
 define('SM_PATH','../../');
 require_once(SM_PATH . 'include/validate.php');
 
+/**
+ * Internal spamcop plugin function.
+ *
+ * It is used to display similar action links.
+ */
 function spamcop_enable_disable($option,$disable_action,$enable_action) {
     if ($option) { 
        $ret= _("Enabled") . "(<a href=\"options.php?action=$disable_action\">" . _("Disable it") . "</a>)\n";
@@ -26,6 +34,7 @@ displayPageHeader($color, 'None');
 /* globals */
 sqgetGlobalVar('action', $action);
 sqgetGlobalVar('meth', $meth);
+sqgetGlobalVar('type', $type);
 sqgetGlobalVar('ID' , $ID);
 
 sqgetGlobalVar('username', $username, SQ_SESSION);
@@ -51,6 +60,11 @@ switch ($action) {
             setPref($data_dir, $username, 'spamcop_method', $meth);
         }
         break;
+    case 'type':
+        if (isset($type)) {
+            setPref($data_dir, $username, 'spamcop_type', $type);
+        }
+       break;
     case 'save_id':
         if (isset($ID)) {
             $ID = trim($ID);
@@ -61,7 +75,7 @@ switch ($action) {
         break;
 }
 
-global $spamcop_enabled, $spamcop_delete;
+global $spamcop_enabled, $spamcop_delete, $spamcop_quick_report;
 spamcop_load();
 
 ?>
@@ -94,12 +108,14 @@ spamcop_load();
          <form method="post" action="options.php">
          <td>
            <select name="meth">
-             <option value="quick_email"
                <?php
-                 if ($spamcop_method == 'quick_email') echo ' selected';
-                 echo ">"._("Quick email-based reporting");
-               ?>
-             </option>
+                   if ($spamcop_quick_report) {
+                       echo '<option value="quick_email"';
+                       if ($spamcop_method == 'quick_email') echo ' selected';
+                       echo ">"._("Quick email-based reporting");
+                       echo '</option>';
+                   }
+               ?>
              <option value="thorough_email"
                <?php
                  if ($spamcop_method == 'thorough_email') echo ' selected';
@@ -117,6 +133,30 @@ spamcop_load();
            <input type="submit" value="<?php echo _("Save Method"); ?>">
          </td></form>
        </tr>
+       <tr>
+                 <?php
+         echo html_tag('td',_("Spam Service Type:"),'right');
+         ?>
+         <form method="post" action="options.php">
+         <td>
+           <select name="type">
+             <option value="free"
+               <?php
+                 if ($spamcop_type == 'free') echo ' selected';
+                 echo ">"._("Free reporting");
+               ?>
+             </option>
+             <option value="member"
+               <?php
+                 if ($spamcop_type == 'member') echo ' selected';
+                 echo ">"._("Member services");
+               ?>
+             </option>
+           </select>
+           <input type="hidden" name="action" value="type">
+           <input type="submit" value="<?php echo _("Save Service Type"); ?>">
+          </td></form>
+       </tr>
        <tr>
          <?php
            echo html_tag('td',_("Your SpamCop authorization code:") . "<br />" .
@@ -150,16 +190,22 @@ echo "<p><b>" . _("Email-based Reporting") . "</b><br />";
 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.");
 echo "</p>";
 
+if ($spamcop_quick_report) {
 echo "<p>";
 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.");
 echo "</p>\n";
+}
 
 echo "<p><b>" . _("Web-based Reporting") . "</b><br />";
 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.");
 echo "</p>\n";
 
 echo "<p>";
-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.");
+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.");
+echo "</p>\n";
+
+echo "<p><b>". _("Spamcop Service Type") . "</b><br />\n";
+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.");
 echo "</p>\n";
 
 echo "<p>";