big update
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 21 May 2004 11:44:34 +0000 (11:44 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 21 May 2004 11:44:34 +0000 (11:44 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7507 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/right_main.php
src/search.php

index e3d5a5055fea80ded01322b78ea92532f59bf6f9..60111838f402d1512587c35f193f2557638b665e 100644 (file)
@@ -129,26 +129,6 @@ if ($imap_server_type == 'uw' && (strstr($mailbox, '../') ||
    $mailbox = 'INBOX';
 }
 
-/* decide if we are thread sorting or not */
-if ($allow_thread_sort == TRUE) {
-    if (isset($set_thread)) {
-        if ($set_thread == 1) {
-            setPref($data_dir, $username, "thread_$mailbox", 1);
-            $thread_sort_messages = '1';
-        }
-        elseif ($set_thread == 2)  {
-            setPref($data_dir, $username, "thread_$mailbox", 0);
-            $thread_sort_messages = '0';
-        }
-    }
-    else {
-        $thread_sort_messages = getPref($data_dir, $username, "thread_$mailbox");
-    }
-}
-else {
-    $thread_sort_messages = 0;
-}
-
 do_hook ('generic_header');
 
 $aMbxResponse = sqimap_mailbox_select($imapConnection, $mailbox);
@@ -178,14 +158,40 @@ if ($aLastSelectedMailbox && !isset($newsort)) {
                $aMbxResponse['SORT_ARRAY'] = $server_sort_array;
            }
        }
-    } 
+    }
 }
+
 $aLastSelectedMailbox['NAME'] = $mailbox;
 $aLastSelectedMailbox['EXISTS'] = $aMbxResponse['EXISTS'];
 $aLastSelectedMailbox['UIDVALIDITY'] = $aMbxResponse['UIDVALIDITY'];
 $aLastSelectedMailbox['UIDNEXT'] = $aMbxResponse['UIDNEXT'];
 
+/* decide if we are thread sorting or not */
+if ($allow_thread_sort == TRUE) {
+    if (isset($set_thread)) {
+        $aMbxResponse['SORT_ARRAY'] = false;
+        if (sqsession_is_registered('indent_array')) {
+            sqsession_unregister('indent_array');
+        }
+        if (sqsession_is_registered('server_sort_array')) {
+            sqsession_unregister('server_sort_array');
+        }
+        if ($set_thread == 1) {
+            setPref($data_dir, $username, "thread_$mailbox", 1);
+            $thread_sort_messages = '1';
+        } else if ($set_thread == 2)  {
+            setPref($data_dir, $username, "thread_$mailbox", 0);
+            $thread_sort_messages = '0';
+        }
+    } else {
+        $thread_sort_messages = getPref($data_dir, $username, "thread_$mailbox");
+    }
+} else {
+    $thread_sort_messages = 0;
+}
+
+
+
 if ($composenew) {
     $comp_uri = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
         "&session=$session";
@@ -236,8 +242,8 @@ if (! isset($use_mailbox_cache)) {
 }
 
 if ($use_mailbox_cache && sqsession_is_registered('msgs')) {
-    showMessagesForMailbox($imapConnection, $mailbox, $numMessages, 
-                           $startMessage, $sort, $color, $show_num, 
+    showMessagesForMailbox($imapConnection, $mailbox, $numMessages,
+                           $startMessage, $sort, $color, $show_num,
                            $use_mailbox_cache, '',$aMbxResponse);
 } else {
     if (sqsession_is_registered('msgs')) {
index 539ae1b702a69a513c9f1c28bc2ea6e787872bde..2b476f8ad577ec254c5f248bbb23a093292ac646 100644 (file)
@@ -852,25 +852,25 @@ function asearch_print_form_basic($imapConnection, &$boxes, $mailbox_array, $bio
 
 /** Print the $msgs messages from $mailbox mailbox
  */
-function asearch_print_mailbox_msgs($imapConnection, $mbxresponse, $mailbox, $msgs, $cnt, $sort, $color, $where, $what)
+function asearch_print_mailbox_msgs($imapConnection, $mbxresponse, $mailbox, $id, $cnt, $sort, $color, $where, $what)
 {
        if ($cnt > 0) {
                global $allow_server_sort, $allow_thread_sort, $thread_sort_messages;
-
+        $msgs = sqimap_get_small_header_list ($imapConnection, $id, count($id));
                $thread_sort_messages = 0;
                if ($allow_thread_sort) {
                        global $data_dir, $username;
                        $thread_sort_messages = getPref($data_dir, $username, 'thread_' . $mailbox);
-                       $msort = $msgs;
-                       $real_sort = 6;
+                       //$msort = $msgs;
+                       //$real_sort = 6;
                }
                elseif ($allow_server_sort) {
-                       $msort = $msgs;
-                       $real_sort = 6;
+                       //$msort = $msgs;
+                       //$real_sort = 6;
                }
                else {
-                       $msort = calc_msort($msgs, $sort);
-                       $real_sort = $sort;
+                       //$msort = calc_msort($msgs, $sort);
+                       //$real_sort = $sort;
                }
 
                $mailbox_display = asearch_get_mailbox_display($mailbox);
@@ -886,12 +886,12 @@ function asearch_print_mailbox_msgs($imapConnection, $mbxresponse, $mailbox, $ms
 
                echo '<tr><td>';
                if ($devel)
-                       mail_message_listing_beginning($imapConnection, $mbxresponse, $mailbox, $real_sort, $msg_cnt_str, $mailbox_title, 1, 1);
+                       mail_message_listing_beginning($imapConnection, $mbxresponse, $mailbox, $sort, $msg_cnt_str, $mailbox_title, 1, 1);
                else
-                       mail_message_listing_beginning($imapConnection, $mailbox, $real_sort, $msg_cnt_str, $mailbox_title, 1, 1);
+                       mail_message_listing_beginning($imapConnection, $mailbox, $sort, $msg_cnt_str, $mailbox_title, 1, 1);
                echo '</td></tr>';
 
-               echo '<tr><td HEIGHT="5" BGCOLOR="'.$color[4].'"></td></tr>';  
+               echo '<tr><td HEIGHT="5" BGCOLOR="'.$color[4].'"></td></tr>';
 
                echo '<tr><td>';
                echo '    <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
@@ -900,17 +900,17 @@ function asearch_print_mailbox_msgs($imapConnection, $mbxresponse, $mailbox, $ms
                echo '       <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[5].'">';
                echo '        <tr><td>';
                printHeader($mailbox, $sort, $color, !$thread_sort_messages);
-               displayMessageArray($imapConnection, $cnt, 1, $msort, $mailbox, $real_sort, $color, $cnt, $where, $what);
+               displayMessageArray($imapConnection, $cnt, 1, $id, $msgs, $mailbox, $sort, $cnt, $where, $what);
                echo '        </td></tr>';
                echo '       </table>';
                echo '     </td></tr>';
                echo '    </table>';
-               mail_message_listing_end($cnt, '', $msg_cnt_str, $color); 
+               mail_message_listing_end($cnt, '', $msg_cnt_str, $color);
                echo '</td></tr>';
 
                echo '</table>';
        }
-}                            
+}
 
 /**
  * @param array $boxes mailboxes array (reference)
@@ -935,9 +935,10 @@ sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
 
 if ( sqgetGlobalVar('checkall', $temp, SQ_GET) ) {
-  $checkall = (int) $temp;
+    $checkall = (int) $temp;
 }
 
+
 $search_button_html = _("Search");
 $search_button_text = asearch_unhtmlentities($search_button_html);
 $add_criteria_button_html = _("Add New Criteria");
@@ -1374,7 +1375,7 @@ if ($submit == $search_button_text) {
                        foreach($mboxes_msgs as $mailbox => $msgs) {
                                echo '<br />';
                                $mbxresponse = sqimap_mailbox_select($imapConnection, $mailbox);
-                               $msgs = fillMessageArray($imapConnection, $msgs, count($msgs));
+                               //$msgs = sqimap_get_small_header_list ($imapConnection, $msgs, count($msgs));
 /* For now just keep the first criteria to make the regular search happy if the user tries to come back to search */
 /*                     $where = asearch_serialize($where_array);
                                $what = asearch_serialize($what_array);*/
@@ -1392,4 +1393,4 @@ do_hook('search_bottom');
 sqimap_logout($imapConnection);
 echo '</body></html>';
 
-?>
+?>
\ No newline at end of file