X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fspamcop%2Fsetup.php;h=0613a87b991ac71502b72fdf0f02250ba6870e4e;hb=bb50b50818e1eb3b2ff8f8c49883c1a7f19707e5;hp=6c026dd303bd536bc76e232372ef4afe15e0d40a;hpb=ea5f4b8eaf805c4cc4e9533e87d057300a7fe666;p=squirrelmail.git diff --git a/plugins/spamcop/setup.php b/plugins/spamcop/setup.php index 6c026dd3..0613a87b 100755 --- a/plugins/spamcop/setup.php +++ b/plugins/spamcop/setup.php @@ -2,7 +2,7 @@ /** ** setup.php -- SpamCop plugin ** - ** Copyright (c) 1999-2003 The SquirrelMail development team + ** Copyright (c) 1999-2004 The SquirrelMail development team ** Licensed under the GNU GPL. For full terms see the file COPYING. ** ** $Id$ @@ -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() { @@ -35,61 +37,86 @@ 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_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 == '') { - 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 == '') { + // 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_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; + global $spamcop_enabled, $spamcop_method, $spamcop_quick_report,$javascript_on; if (! $spamcop_enabled) return; /* GLOBALS */ - sqgetGlobalVar('passed_id', $passed_id, SQ_GET); - sqgetGlobalVar('mailbox', $mailbox, SQ_GET); - sqgetGlobalVar('startMessage', $startMessage, SQ_GET); + 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"; + + /* + 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') { + // Javascript is used only in web based reporting + // don't insert javascript if javascript is disabled + if ($spamcop_method == 'web_form' && $javascript_on) { ?> +?> +?> \ No newline at end of file