From 1431fde91572c51c2a8ca9c9c5c93c4993cf4f65 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 20 May 2009 12:34:39 -0600 Subject: [PATCH] Remove use of some "default" values. It can sometimes be difficult to determine what the actual default values really are. --- imp/lib/IMP.php | 7 ++++--- imp/lib/Mailbox.php | 6 +++--- imp/lib/base.php | 2 +- imp/mailbox.php | 6 +++--- imp/message-mimp.php | 2 +- imp/message.php | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index ad7d7492f..f46eab26c 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -1015,13 +1015,14 @@ class IMP /** * Determine whether we're hiding deleted messages. * + * @param string $mbox The current mailbox. * @param boolean $force Force a redetermination of the return value * (return value is normally cached after the first * call). * * @return boolean True if deleted messages should be hidden. */ - static public function hideDeletedMsgs($force = false) + static public function hideDeletedMsgs($mbox, $force = false) { $delhide = &self::$_delhide; @@ -1032,7 +1033,7 @@ class IMP $sortpref = self::getSort(); $delhide = ($GLOBALS['prefs']->getValue('delhide') && !$GLOBALS['prefs']->getValue('use_trash') && - ($GLOBALS['imp_search']->isSearchMbox() || + ($GLOBALS['imp_search']->isSearchMbox($mbox) || ($sortpref['by'] != Horde_Imap_Client::SORT_THREAD))); } } @@ -1188,7 +1189,7 @@ class IMP $mbox = $GLOBALS['imp_mbox']['mailbox']; } - $prefmbox = $GLOBALS['imp_search']->isSearchMbox() + $prefmbox = $GLOBALS['imp_search']->isSearchMbox($mbox) ? $mbox : self::folderPref($mbox, false); diff --git a/imp/lib/Mailbox.php b/imp/lib/Mailbox.php index b780742bd..91f29f58a 100644 --- a/imp/lib/Mailbox.php +++ b/imp/lib/Mailbox.php @@ -283,7 +283,7 @@ class IMP_Mailbox $query = null; if ($this->_searchmbox) { - if (IMP::hideDeletedMsgs()) { + if (IMP::hideDeletedMsgs($this->_mailbox)) { $query = new Horde_Imap_Client_Search_Query(); $query->flag('\\deleted', false); } @@ -303,7 +303,7 @@ class IMP_Mailbox $this->_sorted = $threadob->messageList((bool)$sortpref['dir']); } else { if (($_SESSION['imp']['protocol'] != 'pop') && - IMP::hideDeletedMsgs()) { + IMP::hideDeletedMsgs($this->_mailbox)) { $query = new Horde_Imap_Client_Search_Query(); $query->flag('\\deleted', false); } @@ -364,7 +364,7 @@ class IMP_Mailbox $criteria = new Horde_Imap_Client_Search_Query(); - if (IMP::hideDeletedMsgs()) { + if (IMP::hideDeletedMsgs($this->_mailbox)) { $criteria->flag('\\deleted', false); } elseif ($count) { try { diff --git a/imp/lib/base.php b/imp/lib/base.php index 7f5efe315..814b86383 100644 --- a/imp/lib/base.php +++ b/imp/lib/base.php @@ -204,7 +204,7 @@ if ((IMP::loginTasksFlag() === 2) && $GLOBALS['imp_mbox'] = IMP::getCurrentMailboxInfo(); // Initialize IMP_Search object. -$GLOBALS['imp_search'] = (isset($_SESSION['imp']) && strpos($GLOBALS['imp_mbox']['mailbox'], IMP::SEARCH_MBOX) === 0) +$GLOBALS['imp_search'] = (isset($_SESSION['imp']) && IMP_Search::isSearchMbox($GLOBALS['imp_mbox']['mailbox'])) ? new IMP_Search(array('id' => $GLOBALS['imp_mbox']['mailbox'])) : new IMP_Search(); diff --git a/imp/mailbox.php b/imp/mailbox.php index 5464eac40..3ddc7717d 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -55,7 +55,7 @@ if (!empty($conf['hooks']['mbox_redirect'])) { } /* Is this a search mailbox? */ -$search_mbox = $imp_search->isSearchMbox(); +$search_mbox = $imp_search->isSearchMbox($imp_mbox['mailbox']); $vfolder = $imp_search->isVFolder(); /* There is a chance that this page is loaded directly via message.php. If so, @@ -182,7 +182,7 @@ case 'flag_messages': case 'hide_deleted': $prefs->setValue('delhide', !$prefs->getValue('delhide')); - IMP::hideDeletedMsgs(true); + IMP::hideDeletedMsgs($imp_mbox['mailbox'], true); break; case 'expunge_mailbox': @@ -250,7 +250,7 @@ if (empty($conf['fetchmail']['show_account_colors'])) { $mbox_info = $imp_mailbox->getMailboxArray(range($pageOb['begin'], $pageOb['end']), array('preview' => $show_preview, 'headers' => $overview_headers, 'structure' => $prefs->getValue('atc_flag'))); /* Determine sorting preferences. */ -$sortpref = IMP::getSort(); +$sortpref = IMP::getSort($imp_mbox['mailbox']); /* If search results are empty, return to the search page if this is * not a virtual folder. */ diff --git a/imp/message-mimp.php b/imp/message-mimp.php index 1405f0bb8..de51658ee 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -62,7 +62,7 @@ case 'u': exit; } if (($_SESSION['imp']['protocol'] != 'pop') && - !IMP::hideDeletedMsgs() && + !IMP::hideDeletedMsgs($imp_mbox['mailbox']) && !$GLOBALS['prefs']->getValue('use_trash')) { $imp_mailbox->setIndex(1, 'offset'); } diff --git a/imp/message.php b/imp/message.php index 23db289b2..2d9623535 100644 --- a/imp/message.php +++ b/imp/message.php @@ -22,7 +22,7 @@ function _returnToMailbox($startIndex = null, $actID = null) function _moveAfterAction() { return (($_SESSION['imp']['protocol'] != 'pop') && - !IMP::hideDeletedMsgs() && + !IMP::hideDeletedMsgs($GLOBALS['imp_mbox']['mailbox']) && !$GLOBALS['prefs']->getValue('use_trash')); } -- 2.11.0