From: tokul Date: Fri, 26 Dec 2003 08:39:17 +0000 (+0000) Subject: Adding support for spamcop member service. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=9a422982f7133d981fe505f468b1f8c5aca44720;hp=a75e70b1b5fb3a111e84cf658cc6937a8e97dc2c;ds=sidebyside Adding support for spamcop member service. Adding fix that allows submiting attached spams with web based reporting form (thanks to Magnus Henoch ) Removing page header display, when form is opened in new window. Removing insertion of javascript, when javascript is disabled. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6320 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/plugins/spamcop/options.php b/plugins/spamcop/options.php index 8c4c1e0e..111903ff 100755 --- a/plugins/spamcop/options.php +++ b/plugins/spamcop/options.php @@ -15,6 +15,11 @@ 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") . "(" . _("Disable it") . ")\n"; @@ -29,6 +34,7 @@ displayPageHeader($color, 'None'); /* globals */ sqgetGlobalVar('action', $action); sqgetGlobalVar('meth', $meth); +sqgetGlobalVar('type', $type); sqgetGlobalVar('ID' , $ID); sqgetGlobalVar('username', $username, SQ_SESSION); @@ -54,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); @@ -122,6 +133,30 @@ spamcop_load(); "> + + +
+ + + + "> +
+ " . @@ -166,7 +201,11 @@ echo _("When you press the button on the confirmation page, this will pop open a echo "

\n"; echo "

"; -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 "

\n"; + +echo "

". _("Spamcop Service Type") . "
\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 "

\n"; echo "

"; diff --git a/plugins/spamcop/setup.php b/plugins/spamcop/setup.php index 06cf3389..afe03abc 100755 --- a/plugins/spamcop/setup.php +++ b/plugins/spamcop/setup.php @@ -37,23 +37,20 @@ function squirrelmail_plugin_init_spamcop() { } -// Load the settings -// Validate some of it (make '' into 'default', etc.) +/** + * Loads spamcop settings and validates some of values (make '' into 'default', etc.) + */ function spamcop_load() { global $username, $data_dir, $spamcop_enabled, $spamcop_delete, - $spamcop_method, $spamcop_id, $spamcop_quick_report; + $spamcop_method, $spamcop_id, $spamcop_quick_report, $spamcop_type; $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_type = getPref($data_dir, $username, 'spamcop_type'); $spamcop_id = getPref($data_dir, $username, 'spamcop_id'); 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. + // Default to web_form. It is faster. $spamcop_method = 'web_form'; setPref($data_dir, $username, 'spamcop_method', $spamcop_method); } @@ -61,24 +58,36 @@ function spamcop_load() { $spamcop_method = 'web_form'; setPref($data_dir, $username, 'spamcop_method', $spamcop_method); } + if ($spamcop_type == '') { + $spamcop_type = 'free'; + setPref($data_dir, $username, 'spamcop_type', $spamcop_type); + } if ($spamcop_id == '') $spamcop_enabled = 0; } -// Show the link on the read-a-message screen +/** + * Shows spamcop link on the read-a-message screen + */ function spamcop_show_link() { - global $spamcop_enabled, $spamcop_method, $spamcop_quick_report; + global $spamcop_enabled, $spamcop_method, $spamcop_quick_report,$javascript_on; if (! $spamcop_enabled) return; /* GLOBALS */ sqgetGlobalVar('passed_id', $passed_id, SQ_FORM); + sqgetGlobalVar('passed_ent_id',$passed_ent_id,SQ_FORM); sqgetGlobalVar('mailbox', $mailbox, SQ_FORM); sqgetGlobalVar('startMessage', $startMessage, SQ_FORM); /* END GLOBALS */ + // catch unset passed_ent_id + if (! sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_FORM) ) { + $passed_ent_id = 0; + } + echo "
\n"; /* @@ -90,24 +99,24 @@ function spamcop_show_link() { $spamcop_method = 'web_form'; } - if ($spamcop_method == 'web_form') { + // Javascript is used only in web based reporting + // don't insert javascript if javascript is disabled + if ($spamcop_method == 'web_form' && $javascript_on) { ?> +?> \n"; +} else { + displayPageHeader($color,$mailbox); +} $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); @@ -112,7 +125,7 @@ if(! sqgetGlobalVar('composesession', $composesession, SQ_SESSION) ) { $message = sqimap_get_message($imap_stream, $passed_id, $mailbox); $composeMessage = getMessage_RFC822_Attachment($message, $composeMessage, $passed_id, - $passed_ent_id='', $imap_stream); + $passed_ent_id, $imap_stream); $compose_messages[$session] = $composeMessage; sqsession_register($compose_messages, 'compose_messages'); @@ -166,18 +179,23 @@ echo "

";
\n"; } else { -?> \n"; } ?>