From: tokul Date: Wed, 13 Jul 2005 13:50:51 +0000 (+0000) Subject: stop loading functions in setup.php X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=9f06a087c58806b5178dabe4b5aa00b5ae504733 stop loading functions in setup.php detect spamcop submission inside compose_send hook. add keep/don't keep submitted mails option fix redirection when compose_new_win = true. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9771 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/plugins/spamcop/options.php b/plugins/spamcop/options.php index c16cf61d..fea10414 100755 --- a/plugins/spamcop/options.php +++ b/plugins/spamcop/options.php @@ -22,9 +22,9 @@ require_once(SM_PATH . 'include/validate.php'); */ function spamcop_enable_disable($option,$disable_action,$enable_action) { if ($option) { - $ret= _("Enabled") . "(" . _("Disable it") . ")\n"; + $ret= _("Enabled") . " (" . _("Disable it") . ")\n"; } else { - $ret = _("Disabled") . "(" . _("Enable it") . ")\n"; + $ret = _("Disabled") . " (" . _("Enable it") . ")\n"; } return $ret; } @@ -55,6 +55,12 @@ switch ($action) { case 'delete': setPref($data_dir, $username, 'spamcop_delete', 1); break; + case 'keep': + setPref($data_dir, $username, 'spamcop_save', 0); + break; + case 'dontkeep': + setPref($data_dir, $username, 'spamcop_save', 1); + break; case 'meth': if (isset($meth)) { setPref($data_dir, $username, 'spamcop_method', $meth); @@ -75,7 +81,7 @@ switch ($action) { break; } -global $spamcop_enabled, $spamcop_delete, $spamcop_quick_report; +global $spamcop_enabled, $spamcop_delete, $spamcop_save, $spamcop_quick_report; spamcop_load(); ?> @@ -103,6 +109,14 @@ spamcop_load(); echo html_tag('td', spamcop_enable_disable($spamcop_delete,'save','delete'),'','','valign="top"'); ?> + + \n" . + '(' . _("Only works with email-based reporting") . ')', + 'right','','valign="top"'); + echo html_tag('td', spamcop_enable_disable($spamcop_save,'keep','dontkeep'),'','','valign="top"'); + ?> + \n"; /* - Catch situation when user use quick_email and does not update + Catch situation when user uses 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 */ @@ -123,8 +117,7 @@ document.write(""); * Show spamcop options block * @access private */ -function spamcop_options() -{ +function spamcop_options() { global $optpage_blocks; $optpage_blocks[] = array( @@ -140,19 +133,30 @@ function spamcop_options() * When we send the email, we optionally trash it then too * @access private */ -function spamcop_while_sending() -{ - global $mailbox, $spamcop_delete, $spamcop_is_composing, $auto_expunge, +function spamcop_while_sending() { + global $mailbox, $spamcop_delete, $spamcop_save, $spamcop_is_composing, $auto_expunge, $username, $key, $imapServerAddress, $imapPort; - if ($spamcop_delete) { - $imapConnection = sqimap_login($username, $key, $imapServerAddress, + if (sqgetGlobalVar('spamcop_is_composing' , $spamcop_is_composing)) { + // delete spam message + if ($spamcop_delete) { + $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - sqimap_mailbox_select($imapConnection, $mailbox); - sqimap_msgs_list_delete($imapConnection, $mailbox, array($spamcop_is_composing)); - if ($auto_expunge) - sqimap_mailbox_expunge($imapConnection, $mailbox, true); + sqimap_mailbox_select($imapConnection, $mailbox); + sqimap_msgs_list_delete($imapConnection, $mailbox, array($spamcop_is_composing)); + if ($auto_expunge) + sqimap_mailbox_expunge($imapConnection, $mailbox, true); + } + if (! $spamcop_save) { + // disable use of send folder. + // Temporally override in order to disable saving of 'reply anyway' messages. + global $default_move_to_sent; + $default_move_to_sent=false; + } + // change default email composition setting. Plugin always operates in right frame. + // make sure that compose.php redirects to right page. Temporally override. + global $compose_new_win; + $compose_new_win = false; } } - ?> \ No newline at end of file