コード例 #1
0
ファイル: setup.php プロジェクト: jprice/EHCP
function fix_sort_array()
{
    global $username, $data_dir, $allow_server_sort, $allow_thread_sort, $thread_sort_messages, $mailbox, $imapConnection, $sort, $uid_support, $mbx_response;
    // Got to grab this out of prefs, since it isn't saved from mailbox_view.php
    if ($allow_thread_sort) {
        $thread_sort_messages = getPref($data_dir, $username, "thread_{$mailbox}", 0);
    }
    switch (true) {
        case $allow_thread_sort && $thread_sort_messages:
            $server_sort_array = get_thread_sort($imapConnection);
            break;
        case $allow_server_sort:
            $server_sort_array = sqimap_get_sort_order($imapConnection, $sort, $mbx_response);
            break;
        case $uid_support:
            $server_sort_array = sqimap_get_php_sort_order($imapConnection, $mbx_response);
            break;
        default:
            break;
    }
}
コード例 #2
0
ファイル: mailbox_display.php プロジェクト: jprice/EHCP
function getSelfSortMessages($imapConnection, $start_msg, $show_num, $num_msgs, $sort, $mbxresponse)
{
    $msgs = array();
    if ($num_msgs >= 1) {
        $id = sqimap_get_php_sort_order($imapConnection, $mbxresponse);
        if ($sort != 6) {
            $end = $num_msgs;
            $end_loop = $end;
            /* set shownum to 999999 to fool sqimap_get_small_header_list
               and rebuild the msgs_str to 1:* */
            $show_num = 999999;
        } else {
            /* if it's not sorted */
            if ($start_msg + ($show_num - 1) < $num_msgs) {
                $end_msg = $start_msg + ($show_num - 1);
            } else {
                $end_msg = $num_msgs;
            }
            if ($end_msg < $start_msg) {
                $start_msg = $start_msg - $show_num;
                if ($start_msg < 1) {
                    $start_msg = 1;
                }
            }
            $id = array_slice(array_reverse($id), $start_msg - 1, $show_num);
            $end = $start_msg + $show_num - 1;
            if ($num_msgs < $show_num) {
                $end_loop = $num_msgs;
            } else {
                if ($end > $num_msgs) {
                    $end_loop = $num_msgs - $start_msg + 1;
                } else {
                    $end_loop = $show_num;
                }
            }
        }
        $msgs = fillMessageArray($imapConnection, $id, $end_loop, $show_num);
    }
    return $msgs;
}
コード例 #3
0
function getSelfSortMessages($imapConnection, $start_msg, $show_num, $num_msgs, $sort, $mbxresponse)
{
    $msgs = array();
    if ($num_msgs >= 1) {
        $id = sqimap_get_php_sort_order($imapConnection, $mbxresponse);
        if ($sort < 6) {
            $end = $num_msgs;
            $end_loop = $end;
        } else {
            /* if it's not sorted */
            if ($start_msg + ($show_num - 1) < $num_msgs) {
                $end_msg = $start_msg + ($show_num - 1);
            } else {
                $end_msg = $num_msgs;
            }
            if ($end_msg < $start_msg) {
                $start_msg = $start_msg - $show_num;
                if ($start_msg < 1) {
                    $start_msg = 1;
                }
            }
            $id = array_slice(array_reverse($id), $start_msg - 1, $show_num);
            $end = $start_msg + $show_num - 1;
            if ($num_msgs < $show_num) {
                $end_loop = $num_msgs;
            } else {
                if ($end > $num_msgs) {
                    $end_loop = $num_msgs - $start_msg + 1;
                } else {
                    $end_loop = $show_num;
                }
            }
        }
        $msgs = fillMessageArray($imapConnection, $id, $end_loop);
    }
    return $msgs;
}