From 139b39917a6eb7d26469c7a9159b1f335bda6f8c Mon Sep 17 00:00:00 2001 From: stekkel Date: Fri, 21 May 2004 11:44:34 +0000 Subject: [PATCH] big update git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7507 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/right_main.php | 54 +++++++++++++++++++++++++--------------------- src/search.php | 35 +++++++++++++++--------------- 2 files changed, 48 insertions(+), 41 deletions(-) diff --git a/src/right_main.php b/src/right_main.php index e3d5a505..60111838 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -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')) { diff --git a/src/search.php b/src/search.php index 539ae1b7..2b476f8a 100644 --- a/src/search.php +++ b/src/search.php @@ -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 ''; 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 ''; - echo ''; + echo ''; echo ''; echo ' '; @@ -900,17 +900,17 @@ function asearch_print_mailbox_msgs($imapConnection, $mbxresponse, $mailbox, $ms echo '
'; echo ' '; echo '
'; 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 '
'; echo ' '; echo ' '; - mail_message_listing_end($cnt, '', $msg_cnt_str, $color); + mail_message_listing_end($cnt, '', $msg_cnt_str, $color); echo ''; echo ''; } -} +} /** * @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 '
'; $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 ''; -?> +?> \ No newline at end of file -- 2.25.1