From 0fdc2fb6049a1d28ccf26d30af109d34db094778 Mon Sep 17 00:00:00 2001 From: stekkel Date: Thu, 20 May 2004 23:44:15 +0000 Subject: [PATCH] code cleanup 2 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7502 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_messages.php | 260 +++++----- functions/mailbox_display.php | 868 +++++++++++++++++----------------- 2 files changed, 551 insertions(+), 577 deletions(-) diff --git a/functions/imap_messages.php b/functions/imap_messages.php index f7c79bb2..f38d0be0 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -1,27 +1,27 @@ 'DATE', - 1=> 'DATE', - 2=> 'FROM', - 3=> 'FROM', - 4=> 'SUBJECT', - 5=> 'SUBJECT'); + 1=> 'DATE', + 2=> 'FROM', + 3=> 'FROM', + 4=> 'SUBJECT', + 5=> 'SUBJECT'); if ($internal_date_sort == true) { $sort_on[0] = 'ARRIVAL'; $sort_on[1] = 'ARRIVAL'; @@ -187,31 +187,31 @@ function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) { $sort_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, TRUE); } if (isset($sort_test[0])) { - for ($i=0,$iCnt=count($sort_test);$i<$iCnt;++$i) { + for ($i=0,$iCnt=count($sort_test);$i<$iCnt;++$i) { if (preg_match("/^\* SORT (.+)$/", $sort_test[$i], $regs)) { $server_sort_array = preg_split("/ /", trim($regs[1])); - break; + break; } - } + } } if ($sort == 0 || $sort == 2 || $sort == 4) { - $server_sort_array = array_reverse($server_sort_array); + $server_sort_array = array_reverse($server_sort_array); } if (!preg_match("/OK/", $response)) { - $server_sort_array = 'no'; + $server_sort_array = 'no'; } sqsession_register($server_sort_array, 'server_sort_array'); return $server_sort_array; } /** - * Get sort order from server if server does not have the SORT extension - * and return it as array for mailbox_display. - * - * @param resource $imap_stream - * @param array $mbxresponse response from a sqimap_mailbox_select - * @return array $php_sort_array - */ +* Get sort order from server if server does not have the SORT extension +* and return it as array for mailbox_display. +* +* @param resource $imap_stream +* @param array $mbxresponse response from a sqimap_mailbox_select +* @return array $php_sort_array +*/ function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) { if (sqsession_is_registered('php_sort_array')) { @@ -232,7 +232,7 @@ function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) { // EIMS workaround. EIMS returns the result as multiple untagged SEARCH responses foreach($uids as $line) { if (preg_match("/^\* SEARCH (.+)$/", $line, $regs)) { - $php_sort_array += preg_split("/ /", trim($regs[1])); + $php_sort_array += preg_split("/ /", trim($regs[1])); } } } @@ -245,10 +245,10 @@ function sqimap_get_php_sort_order ($imap_stream, $mbxresponse) { /** - * Returns an indent array for printMessageinfo() - * This represents the amount of indent needed (value), - * for this message number (key) - */ +* Returns an indent array for printMessageinfo() +* This represents the amount of indent needed (value), +* for this message number (key) +*/ function get_parent_level ($imap_stream) { global $sort_by_ref, $default_charset, $thread_new; $parent = ''; @@ -256,8 +256,8 @@ function get_parent_level ($imap_stream) { $cutoff = 0; /* loop through the threads and take unwanted characters out - of the thread string then chop it up - */ + of the thread string then chop it up + */ for ($i=0;$i strlen($read)) { - break; - } - } + $iPos = ++$i; + while (true) { + $iPos = strpos($read,'"',$iPos); + if (!$iPos) break; + if ($iPos && $read{$iPos -1} != '\\') { + $s = substr($read,$i,($iPos-$i)); + $i = $iPos; + break; + } + $iPos++; + if ($iPos > strlen($read)) { + break; + } + } } else if ($char == '{') { $lit_cnt = ''; ++$i; $iPos = strpos($read,'}',$i); if ($iPos) { - $lit_cnt = substr($read, $i, $iPos - $i); - $i += strlen($lit_cnt) + 3; /* skip } + \r + \n */ - /* Now read the literal */ - $s = ($lit_cnt ? substr($read,$i,$lit_cnt): ''); - $i += $lit_cnt; - /* temp bugfix (SM 1.5 will have a working clean version) - too much work to implement that version right now */ - --$i; - } else { /* should never happen */ + $lit_cnt = substr($read, $i, $iPos - $i); + $i += strlen($lit_cnt) + 3; /* skip } + \r + \n */ + /* Now read the literal */ + $s = ($lit_cnt ? substr($read,$i,$lit_cnt): ''); + $i += $lit_cnt; + /* temp bugfix (SM 1.5 will have a working clean version) + too much work to implement that version right now */ + --$i; + } else { /* should never happen */ $i += 3; /* } + \r + \n */ $s = ''; - } + } } else { - return false; + return false; } ++$i; return $s; @@ -497,10 +497,10 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) $read_list = array(); /* - * We need to return the data in the same order as the caller supplied - * in $msg_list, but IMAP servers are free to return responses in - * whatever order they wish... So we need to re-sort manually - */ + * We need to return the data in the same order as the caller supplied + * in $msg_list, but IMAP servers are free to return responses in + * whatever order they wish... So we need to re-sort manually + */ for ($i = 0; $i < sizeof($msg_list); $i++) { $messages["$msg_list[$i]"] = array(); } @@ -520,7 +520,7 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) $from = _("Unknown sender"); $priority = 0; $messageid = '<>'; - $type = array('',''); + $type = array('',''); $cc = $to = $inrepto = ''; // use unset because we do isset below unset($date); @@ -539,11 +539,11 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) if (!is_numeric($id) && $fetch !== 'FETCH') { set_up_language($squirrelmail_language); echo '
' . - _("ERROR : Could not complete request.") . - '
' . - _("Unknown response from IMAP server: ") . ' 1.' . - htmlspecialchars($read) . "

\n"; - break; + _("ERROR : Could not complete request.") . + '
' . + _("Unknown response from IMAP server: ") . ' 1.' . + htmlspecialchars($read) . "
\n"; + break; } $i = strpos($read,'(',$i_space+5); $read = substr($read,$i+1); @@ -682,34 +682,30 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false) /* non server sort stuff */ if (!$allow_server_sort) { - $from = parseAddress($from); - if ($from[0][1]) { - $from = decodeHeader($from[0][1]); - } else { - $from = $from[0][0]; - } - $messages[$msgi]['FROM-SORT'] = $from; - $subject_sort = strtolower(decodeHeader($subject)); - if (preg_match("/^(vedr|sv|re|aw):\s*(.*)$/si", $subject_sort, $matches)){ + $from = parseAddress($from); + if ($from[0][1]) { + $from = decodeHeader($from[0][1]); + } else { + $from = $from[0][0]; + } + $messages[$msgi]['FROM-SORT'] = $from; + $subject_sort = strtolower(decodeHeader($subject)); + if (preg_match("/^(vedr|sv|re|aw):\s*(.*)$/si", $subject_sort, $matches)){ $messages[$msgi]['SUBJECT-SORT'] = $matches[2]; - } else { - $messages[$msgi]['SUBJECT-SORT'] = $subject_sort; - } + } else { + $messages[$msgi]['SUBJECT-SORT'] = $subject_sort; + } } ++$msgi; } array_reverse($messages); -// $new_messages = array(); -// foreach ($messages as $i =>$message) { -// $new_messages[] = $message; -// } return $messages; } /** - * Returns a message array with all the information about a message. - * See the documentation folder for more information about this array. - */ +* Returns a message array with all the information about a message. +* See the documentation folder for more information about this array. +*/ function sqimap_get_message ($imap_stream, $id, $mailbox) { // typecast to int to prohibit 1:* msgs sets $id = (int) $id; @@ -726,7 +722,7 @@ function sqimap_get_message ($imap_stream, $id, $mailbox) { global $sort, $startMessage, $color; $errmessage = _("The server couldn't find the message you requested.") . - '

'._("Most probably your message list was out of date and the message has been moved away or deleted (perhaps by another program accessing the same mailbox)."); + '

'._("Most probably your message list was out of date and the message has been moved away or deleted (perhaps by another program accessing the same mailbox)."); /* this will include a link back to the message list */ error_message($errmessage, $mailbox, $sort, (int) $startMessage, $color); exit; diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index c38860db..da3224e1 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -1,17 +1,17 @@ 0) - $senderName = truncateWithEntities($senderName, $truncate_sender); + $senderName = truncateWithEntities($senderName, $truncate_sender); echo html_tag( 'tr','','','','VALIGN="top"') . "\n"; @@ -236,9 +229,9 @@ function printMessageInfo($imapConnection, $t, $last=false, $msg, $mailbox, switch ($index_order_part) { case 1: /* checkbox */ echo html_tag( 'td', - addCheckBox("msg[$t]", $checkall, $msg['ID']), - 'center', - $hlt_color ); + addCheckBox("msg[$t]", $checkall, $msg['ID']), + 'center', + $hlt_color ); break; case 2: /* from */ if ($senderAddress != $senderName) { @@ -248,10 +241,10 @@ function printMessageInfo($imapConnection, $t, $last=false, $msg, $mailbox, else $title = ''; echo html_tag( 'td', - $italic . $bold . $flag . $fontstr . $senderName . - $fontstr_end . $flag_end . $bold_end . $italic_end, - 'left', - $hlt_color, $title ); + $italic . $bold . $flag . $fontstr . $senderName . + $fontstr_end . $flag_end . $bold_end . $italic_end, + 'left', + $hlt_color, $title ); break; case 3: /* date */ $date_string = $msg['DATE_STRING'] . ''; @@ -259,11 +252,11 @@ function printMessageInfo($imapConnection, $t, $last=false, $msg, $mailbox, $date_string = _("Unknown date"); } echo html_tag( 'td', - $bold . $flag . $fontstr . $date_string . - $fontstr_end . $flag_end . $bold_end, - 'center', - $hlt_color, - 'nowrap' ); + $bold . $flag . $fontstr . $date_string . + $fontstr_end . $flag_end . $bold_end, + 'center', + $hlt_color, + 'nowrap' ); break; case 4: /* subject */ $td_str = $bold; @@ -302,38 +295,30 @@ function printMessageInfo($imapConnection, $t, $last=false, $msg, $mailbox, else if ($msg['PRIORITY'] == 5) { $td_str .= ' '; } - else - { + else { $td_str .= ' '; } } if ($msg['TYPE0'] == 'multipart') { $td_str .= ''; - } - else - { + } else { $td_str .= ''; } $msg_icon = ''; - if (!isset($msg['FLAG_SEEN']) || ($msg['FLAG_SEEN']) == false) - { + if (!isset($msg['FLAG_SEEN']) || ($msg['FLAG_SEEN']) == false) { $msg_alt = '(' . _("New") . ')'; $msg_title = '(' . _("New") . ')'; $msg_icon .= SM_PATH . 'images/themes/' . $icon_theme . '/msg_new'; - } - else - { + } else { $msg_alt = '(' . _("Read") . ')'; $msg_title = '(' . _("Read") . ')'; $msg_icon .= SM_PATH . 'images/themes/' . $icon_theme . '/msg_read'; } - if (isset($msg['FLAG_DELETED']) && ($msg['FLAG_DELETED']) == true) - { + if (isset($msg['FLAG_DELETED']) && ($msg['FLAG_DELETED']) == true) { $msg_icon .= '_deleted'; } - if (isset($msg['FLAG_ANSWERED']) && ($msg['FLAG_ANSWERED']) == true) - { + if (isset($msg['FLAG_ANSWERED']) && ($msg['FLAG_ANSWERED']) == true) { $msg_alt = '(' . _("Answered") . ')'; $msg_title = '(' . _("Answered") . ')'; $msg_icon .= '_reply'; @@ -341,10 +326,10 @@ function printMessageInfo($imapConnection, $t, $last=false, $msg, $mailbox, $td_str .= ''. $msg_alt . ''; $td_str .= ''; echo html_tag( 'td', - $td_str, - 'right', - $hlt_color, - 'nowrap' ); + $td_str, + 'right', + $hlt_color, + 'nowrap' ); } @@ -380,18 +365,18 @@ function printMessageInfo($imapConnection, $t, $last=false, $msg, $mailbox, } $td_str .= ''; echo html_tag( 'td', - $td_str, - 'center', - $hlt_color, - 'nowrap' ); + $td_str, + 'center', + $hlt_color, + 'nowrap' ); } break; case 6: /* size */ echo html_tag( 'td', - $bold . $fontstr . show_readable_size($msg['SIZE']) . - $fontstr_end . $bold_end, - 'right', - $hlt_color ); + $bold . $fontstr . show_readable_size($msg['SIZE']) . + $fontstr_end . $bold_end, + 'right', + $hlt_color ); break; } ++$col; @@ -401,20 +386,20 @@ function printMessageInfo($imapConnection, $t, $last=false, $msg, $mailbox, echo ''."\n"; } else { echo '' . "\n" . '' . "\n"; + $color[0] . '" height="1">' . "\n"; } } /** - * FIXME: Undocumented function - * - * @param mixed $imapConnection - * @param mixed $start_msg - * @param mixed $show_num - * @param mixed $num_msgs - * @param mixed $id - * @return array - */ +* FIXME: Undocumented function +* +* @param mixed $imapConnection +* @param mixed $start_msg +* @param mixed $show_num +* @param mixed $num_msgs +* @param mixed $id +* @return array +*/ function getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id) { if ($id != 'no') { $id = array_slice($id, ($start_msg-1), $show_num); @@ -433,32 +418,32 @@ function getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $i } /** - * FIXME: Undocumented function - * - * @param mixed $imapConnection - * @param mixed $start_msg - * @param mixed $show_num - * @param mixed $num_msgs - * @return array - */ +* FIXME: Undocumented function +* +* @param mixed $imapConnection +* @param mixed $start_msg +* @param mixed $show_num +* @param mixed $num_msgs +* @return array +*/ function getThreadMessages($imapConnection, $start_msg, $show_num, $num_msgs) { $id = get_thread_sort($imapConnection); return getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id); } /** - * FIXME: Undocumented function - * - * @param mixed $imapConnection - * @param mixed $start_msg - * @param mixed $show_num - * @param mixed $num_msgs - * @param mixed $server_sort_order - * @param mixed $mbxresponse - * @return array - */ +* FIXME: Undocumented function +* +* @param mixed $imapConnection +* @param mixed $start_msg +* @param mixed $show_num +* @param mixed $num_msgs +* @param mixed $server_sort_order +* @param mixed $mbxresponse +* @return array +*/ function getServerSortMessages($imapConnection, $start_msg, $show_num, - $num_msgs, $server_sort_order, $mbxresponse) { + $num_msgs, $server_sort_order, $mbxresponse) { if (isset($mbxresponse['SORT_ARRAY']) && is_array($mbxresponse['SORT_ARRAY'])) { $id = $mbxresponse['SORT_ARRAY']; } else { @@ -468,27 +453,27 @@ function getServerSortMessages($imapConnection, $start_msg, $show_num, } /** - * FIXME: Undocumented function - * - * @param mixed $imapConnection - * @param mixed $start_msg - * @param mixed $show_num - * @param mixed $num_msgs - * @param mixed $sort - * @param mixed $mbxresponse - * @return array - */ +* FIXME: Undocumented function +* +* @param mixed $imapConnection +* @param mixed $start_msg +* @param mixed $show_num +* @param mixed $num_msgs +* @param mixed $sort +* @param mixed $mbxresponse +* @return array +*/ function getSelfSortMessages($imapConnection, $start_msg, $show_num, - $num_msgs, $sort, $mbxresponse) { + $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; + /* 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) { @@ -520,24 +505,24 @@ function getSelfSortMessages($imapConnection, $start_msg, $show_num, /** - * This function loops through a group of messages in the mailbox - * and shows them to the user. - * - * @param mixed $imapConnection - * @param string $mailbox mail folder - * @param mixed $num_msgs - * @param mixed $start_msg - * @param mixed $sort - * @param mixed $color - * @param mixed $show_num - * @param mixed $use_cache - * @param mixed $mode - */ +* This function loops through a group of messages in the mailbox +* and shows them to the user. +* +* @param mixed $imapConnection +* @param string $mailbox mail folder +* @param mixed $num_msgs +* @param mixed $start_msg +* @param mixed $sort +* @param mixed $color +* @param mixed $show_num +* @param mixed $use_cache +* @param mixed $mode +*/ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, $start_msg, $sort, $color, $show_num, $use_cache, $mode='',$mbxresponse) { global $msgs, $msort, $auto_expunge, $thread_sort_messages, - $allow_server_sort, $server_sort_order; + $allow_server_sort, $server_sort_order; /* if there's no messages in this folder */ if ($mbxresponse['EXISTS'] == 0) { $string = '' . _("THIS FOLDER IS EMPTY") . ''; @@ -558,10 +543,10 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, /* - * For some reason, on PHP 4.3+, this being unset, and set in the session causes havoc - * so setting it to an empty array beforehand seems to clean up the issue, and stopping the - * "Your script possibly relies on a session side-effect which existed until PHP 4.2.3" error - */ + * For some reason, on PHP 4.3+, this being unset, and set in the session causes havoc + * so setting it to an empty array beforehand seems to clean up the issue, and stopping the + * "Your script possibly relies on a session side-effect which existed until PHP 4.2.3" error + */ if (!isset($msort)) { $msort = array(); @@ -584,8 +569,8 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, if ($mbxresponse['EXISTS'] > 0) { /* if $start_msg is lower than $num_msgs, we probably deleted all messages - * in the last page. We need to re-adjust the start_msg - */ + * in the last page. We need to re-adjust the start_msg + */ if($start_msg > $num_msgs) { $start_msg -= $show_num; @@ -595,10 +580,10 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, } /* This code and the next if() block check for - * server-side sorting methods. The $id array is - * formatted and $sort is set to 6 to disable - * SM internal sorting - */ + * server-side sorting methods. The $id array is + * formatted and $sort is set to 6 to disable + * SM internal sorting + */ if ($thread_sort_messages == 1) { $mode = 'thread'; @@ -608,20 +593,20 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, $mode = ''; } - if ($use_cache) { - sqgetGlobalVar('msgs', $msgs, SQ_SESSION); - sqgetGlobalVar('msort', $msort, SQ_SESSION); - } else { - sqsession_unregister('msort'); - sqsession_unregister('msgs'); } + if ($use_cache) { + sqgetGlobalVar('msgs', $msgs, SQ_SESSION); + sqgetGlobalVar('msort', $msort, SQ_SESSION); + } else { + sqsession_unregister('msort'); + sqsession_unregister('msgs'); } switch ($mode) { case 'thread': $msgs = getThreadMessages($imapConnection, $start_msg, $show_num, $num_msgs); if ($msgs === false) { echo '

' . - _("Thread sorting is not supported by your IMAP server.") . '
' . - _("Please report this to the system administrator."). - '
'; + _("Thread sorting is not supported by your IMAP server.") . '
' . + _("Please report this to the system administrator."). + ''; $thread_sort_messages = 0; $msort = $msgs = array(); } else { @@ -631,12 +616,12 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, break; case 'serversort': $msgs = getServerSortMessages($imapConnection, $start_msg, $show_num, - $num_msgs, $sort, $mbxresponse); + $num_msgs, $sort, $mbxresponse); if ($msgs === false) { echo '
' . - _( "Server-side sorting is not supported by your IMAP server.") . '
' . - _("Please report this to the system administrator."). - '
'; + _( "Server-side sorting is not supported by your IMAP server.") . '
' . + _("Please report this to the system administrator."). + ''; $sort = $server_sort_order; $allow_server_sort = FALSE; $msort = $msgs = array(); @@ -648,7 +633,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, break; default: $msgs = getSelfSortMessages($imapConnection, $start_msg, $show_num, - $num_msgs, $sort, $mbxresponse); + $num_msgs, $sort, $mbxresponse); $msort = calc_msort($msgs, $sort); break; } // switch @@ -662,44 +647,44 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, $end_msg = $res[1]; $paginator_str = get_paginator_str($mailbox, $start_msg, $end_msg, - $num_msgs, $show_num, $sort); + $num_msgs, $show_num, $sort); $msg_cnt_str = get_msgcnt_str($start_msg, $end_msg, $num_msgs); do_hook('mailbox_index_before'); ?> - + - - - + + + - +
- +
- +
- + -
+ - + - +
- + $msort, $mailbox, $sort, $color, $show_num,0,0); + ?>
-
- + + ?>
"; - * - * @param mixed $imapConnection - * @param array $mbxresponse the array with the results of SELECT against the current mailbox - * @param string $mailbox the current mailbox - * @param mixed $sort the current sorting method (-1 for no sorting available [searches]) - * @param mixed $msg_cnt_str - * @param mixed $paginator - * @param mixed $start_msg - */ +* Displays the standard message list header. +* +* To finish the table, you need to do a ""; +* +* @param mixed $imapConnection +* @param array $mbxresponse the array with the results of SELECT against the current mailbox +* @param string $mailbox the current mailbox +* @param mixed $sort the current sorting method (-1 for no sorting available [searches]) +* @param mixed $msg_cnt_str +* @param mixed $paginator +* @param mixed $start_msg +*/ function mail_message_listing_beginning ($imapConnection, - $mbxresponse, - $mailbox = '', $sort = -1, - $msg_cnt_str = '', - $paginator = ' ', - $start_msg = 1) { + $mbxresponse, + $mailbox = '', $sort = -1, + $msg_cnt_str = '', + $paginator = ' ', + $start_msg = 1) { global $color, $auto_expunge, $base_uri, $show_flag_buttons, - $allow_server_sort, $server_sort_order, - $PHP_SELF, $allow_thread_sort, $thread_sort_messages; + $allow_server_sort, $server_sort_order, + $PHP_SELF, $allow_thread_sort, $thread_sort_messages; $php_self = $PHP_SELF; /* fix for incorrect $PHP_SELF */ @@ -869,59 +847,59 @@ function mail_message_listing_beginning ($imapConnection, } $moveFields = addHidden('msg', $msg). - addHidden('mailbox', $mailbox). - addHidden('startMessage', $start_msg). - addHidden('location', $location); + addHidden('mailbox', $mailbox). + addHidden('startMessage', $start_msg). + addHidden('location', $location); /* build thread sorting links */ if ($allow_thread_sort == TRUE) { - if ($thread_sort_messages == 1 ) { + if ($thread_sort_messages == 1 ) { $set_thread = 2; $thread_name = _("Unthread View"); - } elseif ($thread_sort_messages == 0) { + } elseif ($thread_sort_messages == 0) { $set_thread = 1; $thread_name = _("Thread View"); - } - $thread_link_str = '[' . $thread_name - . ']'; + } + $thread_link_str = '[' . $thread_name + . ']'; } else $thread_link_str =''; /* - * This is the beginning of the message list table. - * It wraps around all messages - */ + * This is the beginning of the message list table. + * It wraps around all messages + */ $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $mailbox); $form_name = "FormMsgs" . $safe_name; echo '
' ."\n" - . $moveFields; + . $moveFields; ?> - +
- + - + -
+ - + - +
-
+ - + - '; + '; //echo $thread_link_str; //previous behaviour getMbxList($imapConnection); echo getButton('SUBMIT', 'moveButton',_("Move")) . "\n - "; + "; } ?> - +
- + ?>
-
+ - - + + - +
- + -
+ - + - +
-
+ - + 1,2=>25,3=>5,4=>0,5=>1,6=>5); $subjectwidth = 100; foreach($index_order as $item) { @@ -1045,10 +1023,10 @@ function printHeader($mailbox, $sort, $color, $showsort=true, $start_msg=1) { case 2: /* from */ if (handleAsSent($mailbox)) { echo html_tag( 'td' ,'' , 'left', '', 'width="25%"' ) - . '' . _("To") . ''; + . '' . _("To") . ''; } else { echo html_tag( 'td' ,'' , 'left', '', 'width="25%"' ) - . '' . _("From") . ''; + . '' . _("From") . ''; } if ($showsort) { ShowSortButton($sort, $mailbox, 2, 3); @@ -1057,7 +1035,7 @@ function printHeader($mailbox, $sort, $color, $showsort=true, $start_msg=1) { break; case 3: /* date */ echo html_tag( 'td' ,'' , 'left', '', 'width="5%" nowrap' ) - . '' . _("Date") . ''; + . '' . _("Date") . ''; if ($showsort) { ShowSortButton($sort, $mailbox, 0, 1); } @@ -1065,7 +1043,7 @@ function printHeader($mailbox, $sort, $color, $showsort=true, $start_msg=1) { break; case 4: /* subject */ echo html_tag( 'td' ,'' , 'left', '', 'width="'.$subjectwidth.'%"' ) - . '' . _("Subject") . ''; + . '' . _("Subject") . ''; if ($showsort) { ShowSortButton($sort, $mailbox, 4, 5); } @@ -1081,13 +1059,13 @@ function printHeader($mailbox, $sort, $color, $showsort=true, $start_msg=1) { /** - * This function shows the sort button. Isn't this a good comment? - * - * @param mixed $sort - * @param string $mailbox - * @param mixed $Down - * @param mixed $Up - */ +* This function shows the sort button. Isn't this a good comment? +* +* @param mixed $sort +* @param string $mailbox +* @param mixed $Down +* @param mixed $Up +*/ function ShowSortButton($sort, $mailbox, $Down, $Up ) { global $PHP_SELF; @@ -1111,19 +1089,19 @@ function ShowSortButton($sort, $mailbox, $Down, $Up ) { /* Now that we have everything figured out, show the actual button. */ echo ' sort'; + . '&startMessage=1&mailbox=' . urlencode($mailbox) + . '">sort'; } /** - * FIXME: Undocumented function - * - * @param mixed $start_msg - * @param mixed $sort - * @param string $mailbox - */ +* FIXME: Undocumented function +* +* @param mixed $start_msg +* @param mixed $sort +* @param string $mailbox +*/ function get_selectall_link($start_msg, $sort, $mailbox) { global $checkall, $what, $where, $javascript_on; global $PHP_SELF, $PG_SHOWNUM; @@ -1177,19 +1155,19 @@ function get_selectall_link($start_msg, $sort, $mailbox) { } /** - * This function computes the "Viewing Messages..." string. - * - * @param integer $start_msg first message number - * @param integer $end_msg last message number - * @param integer $num_msgs total number of message in folder - * @return string - */ +* This function computes the "Viewing Messages..." string. +* +* @param integer $start_msg first message number +* @param integer $end_msg last message number +* @param integer $num_msgs total number of message in folder +* @return string +*/ function get_msgcnt_str($start_msg, $end_msg, $num_msgs) { /* Compute the $msg_cnt_str. */ $result = ''; if ($start_msg < $end_msg) { $result = sprintf(_("Viewing Messages: %s to %s (%s total)"), - ''.$start_msg.'', ''.$end_msg.'', $num_msgs); + ''.$start_msg.'', ''.$end_msg.'', $num_msgs); } else if ($start_msg == $end_msg) { $result = sprintf(_("Viewing Message: %s (1 total)"), ''.$start_msg.''); } else { @@ -1200,14 +1178,14 @@ function get_msgcnt_str($start_msg, $end_msg, $num_msgs) { } /** - * Generate a paginator link. - * - * @param mixed $box - * @param mixed $start_msg - * @param mixed $use - * @param string $text text used for paginator link - * @return string - */ +* Generate a paginator link. +* +* @param mixed $box +* @param mixed $start_msg +* @param mixed $use +* @param string $text text used for paginator link +* @return string +*/ function get_paginator_link($box, $start_msg, $use, $text) { $result = "'; - */ + * I am leaving this debug code here, commented out, because + * it is a really nice way to see what the above code is doing. + * echo "qts = $q1_pgs/$q2_pgs/$q3_pgs/$q4_pgs = " + * . ($q1_pgs + $q2_pgs + $q3_pgs + $q4_pgs) . '
'; + */ /* Print out the page links from the compute page quarters. */ @@ -1395,21 +1373,21 @@ function get_paginator_str($box, $start_msg, $end_msg, $num_msgs, /* Put all the pieces of the paginator string together. */ /** - * Hairy code... But let's leave it like it is since I am not certain - * a different approach would be any easier to read. ;) - */ + * Hairy code... But let's leave it like it is since I am not certain + * a different approach would be any easier to read. ;) + */ $result = ''; if ( $prv_str != '' || $nxt_str != '' ) { - $result .= '['; - $result .= ($prv_str != '' ? $prv_str . $spc . $sep . $spc : ''); - $result .= ($nxt_str != '' ? $nxt_str : ''); - $result .= ']' . $spc ; - - /* Compute the 'show all' string. */ - $all_str = "
" . _("Show All") . ''; + $result .= '['; + $result .= ($prv_str != '' ? $prv_str . $spc . $sep . $spc : ''); + $result .= ($nxt_str != '' ? $nxt_str : ''); + $result .= ']' . $spc ; + + /* Compute the 'show all' string. */ + $all_str = "" . _("Show All") . ''; } $result .= ($pg_str != '' ? $spc . '['.$spc.$pg_str.']' . $spc : ''); @@ -1425,8 +1403,8 @@ function get_paginator_str($box, $start_msg, $end_msg, $num_msgs, } /** - * FIXME: Undocumented function - */ +* FIXME: Undocumented function +*/ function truncateWithEntities($subject, $trim_at) { $ent_strlen = strlen($subject); @@ -1436,11 +1414,11 @@ function truncateWithEntities($subject, $trim_at) global $languages, $squirrelmail_language; /* - * see if this is entities-encoded string - * If so, Iterate through the whole string, find out - * the real number of characters, and if more - * than $trim_at, substr with an updated trim value. - */ + * see if this is entities-encoded string + * If so, Iterate through the whole string, find out + * the real number of characters, and if more + * than $trim_at, substr with an updated trim value. + */ $trim_val = $trim_at; $ent_offset = 0; $ent_loc = 0; @@ -1468,8 +1446,8 @@ function truncateWithEntities($subject, $trim_at) } /** - * FIXME: Undocumented function - */ +* FIXME: Undocumented function +*/ function processSubject($subject, $threadlevel = 0) { /* Shouldn't ever happen -- caught too many times in the IMAP functions */ if ($subject == '') { @@ -1487,11 +1465,11 @@ function processSubject($subject, $threadlevel = 0) { } /** - * FIXME: Undocumented function - * - * @param mixed $imapConnection - * @param mixed $boxes - */ +* FIXME: Undocumented function +* +* @param mixed $imapConnection +* @param mixed $boxes +*/ function getMbxList($imapConnection, $boxes = 0) { global $lastTargetMailbox; echo '  '; } /** - * Puts string into cell, aligns it and adds tag - * - * @param string $string string - * @param string $align alignment - */ +* Puts string into cell, aligns it and adds tag +* +* @param string $string string +* @param string $align alignment +*/ function getSmallStringCell($string, $align) { return html_tag('td', '' . $string . ':  ', @@ -1534,12 +1512,12 @@ function getSmallStringCell($string, $align) { } /** - * FIXME: Undocumented function - * - * @param integer $start_msg - * @param integer $show_num - * @param integer $num_msgs - */ +* FIXME: Undocumented function +* +* @param integer $start_msg +* @param integer $show_num +* @param integer $num_msgs +*/ function getEndMessage($start_msg, $show_num, $num_msgs) { if ($start_msg + ($show_num - 1) < $num_msgs){ $end_msg = $start_msg + ($show_num - 1); @@ -1557,9 +1535,9 @@ function getEndMessage($start_msg, $show_num, $num_msgs) { } /** - * This should go in imap_mailbox.php - * @param string $mailbox - */ +* This should go in imap_mailbox.php +* @param string $mailbox +*/ function handleAsSent($mailbox) { global $handleAsSent_result; -- 2.25.1