From 52357a88bc8fdfc2a093eb6a012770f31d9245ea Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 30 Mar 2009 13:00:01 -0600 Subject: [PATCH] Allow spam/blacklist reporting in read-only mode. Even if user has delete pref/config for these actions, OK to get error message. More important to do the spam/blacklist action. --- imp/mailbox.php | 12 +++++------- imp/message.php | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/imp/mailbox.php b/imp/mailbox.php index 9e78b3950..669870057 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -119,7 +119,7 @@ if (!$search_mbox) { /* Determine if mailbox is readonly. */ $readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']); if ($readonly && - in_array($actionID, array('blacklist', 'whitelist', 'spam_report', 'notspam_report', 'delete_messages', 'undelete_messages', 'move_messages', 'flag_messages', 'empty_mailbox', 'filter'))) { + in_array($actionID, array('delete_messages', 'undelete_messages', 'move_messages', 'flag_messages', 'empty_mailbox', 'filter'))) { $actionID = null; } @@ -565,11 +565,11 @@ if ($pageOb['msgcount']) { $a_template->set('purge_deleted', Horde::widget(Util::addParameter($mailbox_link, array('actionID' => 'expunge_mailbox', 'mailbox_token' => $mailbox_token)), _("Purge Deleted"), 'widget purgeAction', '', '', _("Pur_ge Deleted"))); } - if (!$readonly && $registry->hasMethod('mail/blacklistFrom')) { + if ($registry->hasMethod('mail/blacklistFrom')) { $a_template->set('blacklist', Horde::widget('#', _("Blacklist"), 'widget blacklistAction', '', '', _("_Blacklist"))); } - if (!$readonly && $registry->hasMethod('mail/whitelistFrom')) { + if ($registry->hasMethod('mail/whitelistFrom')) { $a_template->set('whitelist', Horde::widget('#', _("Whitelist"), 'widget whitelistAction', '', '', _("_Whitelist"))); } @@ -577,15 +577,13 @@ if ($pageOb['msgcount']) { $a_template->set('forward', Horde::widget('#', _("Forward"), 'widget forwardAction', '', '', _("Fo_rward"))); } - if (!$readonly && - $conf['spam']['reporting'] && + if ($conf['spam']['reporting'] && ($conf['spam']['spamfolder'] || ($imp_mbox['mailbox'] != IMP::folderPref($prefs->getValue('spam_folder'), true)))) { $a_template->set('spam', Horde::widget('#', _("Report as Spam"), 'widget spamAction', '', '', _("Report as Spam"))); } - if (!$readonly && - $conf['notspam']['reporting'] && + if ($conf['notspam']['reporting'] && (!$conf['notspam']['spamfolder'] || ($imp_mbox['mailbox'] == IMP::folderPref($prefs->getValue('spam_folder'), true)))) { $a_template->set('notspam', Horde::widget('#', _("Report as Innocent"), 'widget notspamAction', '', '', _("Report as Innocent"))); diff --git a/imp/message.php b/imp/message.php index 7c044ff94..806431efe 100644 --- a/imp/message.php +++ b/imp/message.php @@ -67,7 +67,7 @@ if ($actionID && ($actionID != 'print_message')) { /* Determine if mailbox is readonly. */ $readonly = $imp_imap->isReadOnly($imp_mbox['mailbox']); if ($readonly && - in_array($actionID, array('blacklist', 'whitelist', 'delete_message', 'undelete_message', 'move_message', 'spam_report', 'notspam_report', 'flag_message', 'strip_attachment', 'strip_all'))) { + in_array($actionID, array('delete_message', 'undelete_message', 'move_message', 'flag_message', 'strip_attachment', 'strip_all'))) { $actionID = null; } @@ -523,11 +523,11 @@ if (!IMP::$printMode) { $a_template->set('show_thread', Horde::widget(Util::addParameter(IMP::generateIMPUrl('thread.php', $imp_mbox['mailbox'], $index, $mailbox_name), array('start' => $msgindex)), _("View Thread"), 'widget', '', '', _("_View Thread"), true)); } - if (!$readonly && $registry->hasMethod('mail/blacklistFrom')) { + if ($registry->hasMethod('mail/blacklistFrom')) { $a_template->set('blacklist', Horde::widget(Util::addParameter($self_link, 'actionID', 'blacklist'), _("Blacklist"), 'widget', '', '', _("_Blacklist"), true)); } - if (!$readonly && $registry->hasMethod('mail/whitelistFrom')) { + if ($registry->hasMethod('mail/whitelistFrom')) { $a_template->set('whitelist', Horde::widget(Util::addParameter($self_link, 'actionID', 'whitelist'), _("Whitelist"), 'widget', '', '', _("_Whitelist"), true)); } @@ -549,15 +549,13 @@ if (!IMP::$printMode) { $print_params = array_merge(array('actionID' => 'print_message'), $imp_params); $a_template->set('print', Horde::widget(Util::addParameter(IMP::generateIMPUrl('message.php', $imp_mbox['mailbox']), $print_params), _("Print"), 'widget', '_blank', IMP::popupIMPString('message.php', $print_params) . 'return false;', _("_Print"), true)); - if (!$readonly && - $conf['spam']['reporting'] && + if ($conf['spam']['reporting'] && ($conf['spam']['spamfolder'] || ($mailbox_name != IMP::folderPref($prefs->getValue('spam_folder'), true)))) { $a_template->set('spam', Horde::widget('#', _("Report as Spam"), 'widget spamAction', '', '', _("Report as Spam"), true)); } - if (!$readonly && - $conf['notspam']['reporting'] && + if ($conf['notspam']['reporting'] && (!$conf['notspam']['spamfolder'] || ($mailbox_name == IMP::folderPref($prefs->getValue('spam_folder'), true)))) { $a_template->set('notspam', Horde::widget('#', _("Report as Innocent"), 'widget notspamAction', '', '', _("Report as Innocent"), true)); -- 2.11.0