Reset the pageindex on a new search
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 18 Apr 2005 20:59:46 +0000 (20:59 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 18 Apr 2005 20:59:46 +0000 (20:59 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9353 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox_display.php

index 3fc5a2b8153d2560867376b7b53fa36694a95f94..adf6b5efb25687ebc9aadaad88fb228b3058c049 100644 (file)
@@ -217,6 +217,12 @@ function sqm_api_mailbox_select($imapConnection,$account,$mailbox,$aConfig,$aPro
     }
     if (!isset($aConfig['search']) && isset($aCachedMailbox['SEARCH'][$iSetIndx])) {
         $aMailbox['SEARCH'][$iSetIndx] = $aCachedMailbox['SEARCH'][$iSetIndx];
+    } else if (isset($aConfig['search']) && isset($aCachedMailbox['SEARCH'][$iSetIndx]) &&
+        $aConfig['search'] != $aCachedMailbox['SEARCH'][$iSetIndx]) {
+        // reset the pageindex
+        $aMailbox['SEARCH'][$iSetIndx] = $aConfig['search'];
+        $aMailbox['OFFSET'] = 0;
+        $aMailbox['PAGEOFFSET'] = 1;
     } else {
         $aMailbox['SEARCH'][$iSetIndx] =  (isset($aConfig['search'])) ? $aConfig['search'] : 'ALL';
     }