Remove use of some "default" values.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 May 2009 18:34:39 +0000 (12:34 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 May 2009 18:36:31 +0000 (12:36 -0600)
It can sometimes be difficult to determine what the actual default
values really are.

imp/lib/IMP.php
imp/lib/Mailbox.php
imp/lib/base.php
imp/mailbox.php
imp/message-mimp.php
imp/message.php

index ad7d749..f46eab2 100644 (file)
@@ -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);
 
index b780742..91f29f5 100644 (file)
@@ -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 {
index 7f5efe3..814b863 100644 (file)
@@ -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();
 
index 5464eac..3ddc771 100644 (file)
@@ -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. */
index 1405f0b..de51658 100644 (file)
@@ -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');
             }
index 23db289..2d96235 100644 (file)
@@ -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'));
 }