*/
function spamcop_enable_disable($option,$disable_action,$enable_action) {
if ($option) {
- $ret= _("Enabled") . "(<a href=\"options.php?action=$disable_action\">" . _("Disable it") . "</a>)\n";
+ $ret= _("Enabled") . " (<a href=\"options.php?action=$disable_action\">" . _("Disable it") . "</a>)\n";
} else {
- $ret = _("Disabled") . "(<a href=\"options.php?action=$enable_action\">" . _("Enable it") . "</a>)\n";
+ $ret = _("Disabled") . " (<a href=\"options.php?action=$enable_action\">" . _("Enable it") . "</a>)\n";
}
return $ret;
}
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);
break;
}
-global $spamcop_enabled, $spamcop_delete, $spamcop_quick_report;
+global $spamcop_enabled, $spamcop_delete, $spamcop_save, $spamcop_quick_report;
spamcop_load();
?>
echo html_tag('td', spamcop_enable_disable($spamcop_delete,'save','delete'),'','','valign="top"');
?>
</tr>
+ <tr>
+ <?php
+ echo html_tag('td',_("Save emails submitted to spamcop:") . "<br />\n" .
+ '<small>(' . _("Only works with email-based reporting") . ')</small>',
+ 'right','','valign="top"');
+ echo html_tag('td', spamcop_enable_disable($spamcop_save,'keep','dontkeep'),'','','valign="top"');
+ ?>
+ </tr>
<tr>
<?php
echo html_tag('td',_("Spam Reporting Method:"),'right');
* @subpackage spamcop
*/
-/** @ignore */
-require_once(SM_PATH . 'functions/global.php');
-
/** Disable Quick Reporting by default */
+global $spamcop_quick_report;
$spamcop_quick_report = false;
/**
* @access private
*/
function squirrelmail_plugin_init_spamcop() {
- global $squirrelmail_plugin_hooks, $spamcop_is_composing;
+ global $squirrelmail_plugin_hooks;
$squirrelmail_plugin_hooks['optpage_register_block']['spamcop'] =
'spamcop_options';
'spamcop_load';
$squirrelmail_plugin_hooks['read_body_header_right']['spamcop'] =
'spamcop_show_link';
-
- sqgetGlobalVar('spamcop_is_composing' , $spamcop_is_composing);
-
- if (isset($spamcop_is_composing)) {
- $squirrelmail_plugin_hooks['compose_send']['spamcop'] =
- 'spamcop_while_sending';
- }
+ $squirrelmail_plugin_hooks['compose_send']['spamcop'] =
+ 'spamcop_while_sending';
}
* @access private
*/
function spamcop_load() {
- global $username, $data_dir, $spamcop_enabled, $spamcop_delete,
+ global $username, $data_dir, $spamcop_enabled, $spamcop_delete, $spamcop_save,
$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_save = getPref($data_dir, $username, 'spamcop_save',true);
$spamcop_method = getPref($data_dir, $username, 'spamcop_method');
$spamcop_type = getPref($data_dir, $username, 'spamcop_type');
$spamcop_id = getPref($data_dir, $username, 'spamcop_id');
echo "<br />\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
*/
* Show spamcop options block
* @access private
*/
-function spamcop_options()
-{
+function spamcop_options() {
global $optpage_blocks;
$optpage_blocks[] = array(
* 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