Browse Source

disables quick reporting feature by default. This is not documented
spamcop feature. See bug. 809452

tokul 21 years ago
parent
commit
fcc546d2bd
2 changed files with 37 additions and 15 deletions
  1. 10 6
      plugins/spamcop/options.php
  2. 27 9
      plugins/spamcop/setup.php

+ 10 - 6
plugins/spamcop/options.php

@@ -64,7 +64,7 @@ switch ($action) {
         break;
 }
 
-global $spamcop_enabled, $spamcop_delete;
+global $spamcop_enabled, $spamcop_delete, $spamcop_quick_report;
 spamcop_load();
 
 ?>
@@ -97,12 +97,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';
@@ -153,9 +155,11 @@ 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.");

+ 27 - 9
plugins/spamcop/setup.php

@@ -13,6 +13,8 @@
 /** @ignore */
 require_once(SM_PATH . 'functions/global.php');
 
+/** Disable Quick Reporting by default */
+$spamcop_quick_report = false;
 
 /** Initialize the plugin */
 function squirrelmail_plugin_init_spamcop() {
@@ -39,18 +41,25 @@ function squirrelmail_plugin_init_spamcop() {
 // Validate some of it (make '' into 'default', etc.)
 function spamcop_load() {
    global $username, $data_dir, $spamcop_enabled, $spamcop_delete,
-      $spamcop_method, $spamcop_id;
+      $spamcop_method, $spamcop_id, $spamcop_quick_report;
 
    $spamcop_enabled = getPref($data_dir, $username, 'spamcop_enabled');
    $spamcop_delete = getPref($data_dir, $username, 'spamcop_delete');
    $spamcop_method = getPref($data_dir, $username, 'spamcop_method');
    $spamcop_id = getPref($data_dir, $username, 'spamcop_id');
-   if ($spamcop_method == '') {
-      if (getPref($data_dir, $username, 'spamcop_form'))
-         $spamcop_method = 'web_form';
-      else
-         $spamcop_method = 'thorough_email';
-      setPref($data_dir, $username, 'spamcop_method', $spamcop_method);
+    if ($spamcop_method == '') {
+// This variable is not used
+//      if (getPref($data_dir, $username, 'spamcop_form'))
+//         $spamcop_method = 'web_form';
+//      else
+
+// Default to web_form. It is faster.
+	$spamcop_method = 'web_form';
+	setPref($data_dir, $username, 'spamcop_method', $spamcop_method);
+    }
+   if (! $spamcop_quick_report && $spamcop_method=='quick_email') {
+	$spamcop_method = 'web_form';
+	setPref($data_dir, $username, 'spamcop_method', $spamcop_method);
    }
    if ($spamcop_id == '')
       $spamcop_enabled = 0;
@@ -59,7 +68,7 @@ function spamcop_load() {
 
 // Show the link on the read-a-message screen
 function spamcop_show_link() {
-   global $spamcop_enabled, $spamcop_method;
+   global $spamcop_enabled, $spamcop_method, $spamcop_quick_report;
 
    if (! $spamcop_enabled)
       return;
@@ -71,6 +80,15 @@ function spamcop_show_link() {
    /* END GLOBALS */
 
    echo "<br>\n";
+
+    /* 
+       Catch situation when user use quick_email and does not update 
+       preferences. User gets web_form link. If prefs are set to 
+       quick_email format - they will be updated after clicking the link
+     */
+    if (! $spamcop_quick_report && $spamcop_method=='quick_email') {
+	$spamcop_method = 'web_form';
+    }
    
    if ($spamcop_method == 'web_form') {
 ?><script language="javascript" type="text/javascript">
@@ -120,4 +138,4 @@ function spamcop_while_sending()
    }
 }
 
-?>
+?>