Replace None mailbox with first available mailbox (eg INBOX)
authoralex-brainstorm <alex-brainstorm@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 27 Jul 2003 00:44:15 +0000 (00:44 +0000)
committeralex-brainstorm <alex-brainstorm@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 27 Jul 2003 00:44:15 +0000 (00:44 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5431 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/search.php

index 97eb545f60419238613c2972cb8ffe3205947964..b8e4b6c8a727ff3a41b4ea5b7bef690866e3e6d2 100644 (file)
@@ -837,12 +837,13 @@ else {
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 /* get mailbox names once here */
 $boxes = sqimap_mailbox_list($imapConnection);
-
-if (isset($mailbox_array[0])) {
-    $mailbox = strip_tags($mailbox_array[0]);
-}
-if (empty($mailbox))
+/* ensure we have a valid default mailbox name */
+$mailbox = strip_tags(asearch_nz($mailbox_array[0]));
+if (($mailbox == '') || ($mailbox == 'None'))  {       //Workaround for sm quirk IMHO (what if I really have a mailbox called None?)
        $mailbox = $boxes[0]['unformatted'];
+       $mailbox_array[0] = $mailbox;
+}
+
 if (isset($composenew) && $composenew) {
        $comp_uri = "../src/compose.php?mailbox=" . urlencode($mailbox) .
                "&amp;session=$composesession&amp;attachedmessages=true&amp";