<?php
- /**
- * mailbox_display.php
- *
- * Copyright (c) 1999-2001 The Squirrelmail Development Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
- * This contains functions that display mailbox information, such as the
- * table row that has sender, date, subject, etc...
- *
- * $Id$
- */
- if (defined('mailbox_display_php'))
- return;
- define('mailbox_display_php', true);
+ /**
+ ** mailbox_display.php
+ **
+ ** Copyright (c) 1999-2001 The Squirrelmail Development Team
+ ** Licensed under the GNU GPL. For full terms see the file COPYING.
+ **
+ ** This contains functions that display mailbox information, such as the
+ ** table row that has sender, date, subject, etc...
+ **
+ ** $Id$
+ **/
define('PG_SEL_MAX', 10); /* Default value for page_selector_max. */
}
$msg = $msgs[$key];
- $senderName = htmlentities(sqimap_find_displayable_name($msg['FROM']));
- if( $mailbox == _("None") ) {
+ $senderName = htmlspecialchars(sqimap_find_displayable_name($msg['FROM']));
+ if( $mailbox == 'None' ) {
// $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imapConnection);
// sqimap_logout($imapConnection);
echo "+\n";
$stuff = true;
}
- if ($default_use_priority) {
+ if ($default_use_priority) {
if (ereg('(1|2)',substr($msg['PRIORITY'],0,1))) {
echo "<font color=$color[1]>!</font>\n";
$stuff = true;
do_hook('mailbox_index_before');
$msg_cnt_str = get_msgcnt_str($start_msg, $end_msg, $num_msgs);
- $paginator_str = get_paginator_str($urlMailbox, $start_msg, $end_msg, $num_msgs, $show_num);
+ $paginator_str = get_paginator_str($urlMailbox, $start_msg, $end_msg, $num_msgs, $show_num, $sort);
if (! isset($msg)) {
$msg = '';
/* Loop through and display the info for each message. */
$t = 0; // $t is used for the checkbox number
if ($num_msgs == 0) { // if there's no messages in this folder
- echo "<TR><TD BGCOLOR=\"$color[4]\" COLSPAN=" . count($index_order) . ">\n";
- echo " <CENTER><BR><B>". _("THIS FOLDER IS EMPTY") ."</B><BR> </CENTER>\n";
- echo "</TD></TR>";
+ echo "<TR><TD BGCOLOR=\"$color[4]\" COLSPAN=" . count($index_order) . ">\n".
+ " <CENTER><BR><B>". _("THIS FOLDER IS EMPTY") ."</B><BR> </CENTER>\n".
+ "</TD></TR>";
} else if ($start_msg == $end_msg) {
/* If there's only one message in the box, handle it differently. */
if ($sort != 6) {
} while ($i && $i < $endVar);
}
- echo '</table>';
- echo "<table bgcolor=\"$color[9]\" width=100% border=0 cellpadding=1 cellspacing=1>" .
+ echo '</table>'.
+ "<table bgcolor=\"$color[9]\" width=100% border=0 cellpadding=1 cellspacing=1>" .
"<tr BGCOLOR=\"$color[4]\">" .
"<table width=100% BGCOLOR=\"$color[4]\" border=0 cellpadding=1 cellspacing=0><tr><td>$paginator_str</td>".
"<td align=right>$msg_cnt_str</td></tr></table>".
*/
function mail_message_listing_beginning
($imapConnection, $moveURL, $mailbox = '', $sort = -1,
- $msg_cnt_str = '', $paginator = '', $start_msg = 1) {
+ $msg_cnt_str = '', $paginator = ' ', $start_msg = 1) {
global $color, $index_order, $auto_expunge, $move_to_trash;
global $checkall, $sent_folder, $draft_folder;
$urlMailbox = urlencode($mailbox);
* This is the beginning of the message list table. *
* It wraps around all messages *
****************************************************/
- echo "<TABLE WIDTH=\"100%\" BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"0\">\n";
-
- echo "<TR BGCOLOR=\"$color[0]\"><TD>";
- echo " <TABLE BGCOLOR=\"$color[4]\" width=\"100%\" CELLPADDING=\"2\" CELLSPACING=\"0\" BORDER=\"0\"><TR>\n";
- echo " <TD ALIGN=LEFT>$paginator</TD>\n";
- echo ' <TD ALIGN=CENTER>' . get_selectall_link($start_msg, $sort) . "</TD>\n";
- echo " <TD ALIGN=RIGHT>$msg_cnt_str</TD>\n";
- echo " </TR></TABLE>\n";
- echo "</TD></TR>";
-
- /** The delete and move options */
- echo "<TR><TD BGCOLOR=\"$color[0]\">";
-
- echo "\n<FORM name=messageList method=post action=\"$moveURL\">\n";
- echo "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0 cellpadding=0 cellspacing=0 width=100%>\n";
-
- echo " <TR>\n" .
+ echo "<TABLE WIDTH=\"100%\" BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"0\">\n".
+ "<TR BGCOLOR=\"$color[0]\"><TD>".
+ "<TABLE BGCOLOR=\"$color[4]\" width=\"100%\" CELLPADDING=\"2\" CELLSPACING=\"0\" BORDER=\"0\"><TR>\n".
+ " <TD ALIGN=LEFT>$paginator</TD>\n".
+ ' <TD ALIGN=CENTER>' . get_selectall_link($start_msg, $sort) . "</TD>\n".
+ " <TD ALIGN=RIGHT>$msg_cnt_str</TD>\n".
+ " </TR></TABLE>\n".
+ '</TD></TR>'.
+ "<TR><TD BGCOLOR=\"$color[0]\">\n".
+ "<FORM name=messageList method=post action=\"$moveURL\">\n".
+ "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0 cellpadding=0 cellspacing=0 width=100%>\n".
+ " <TR>\n" .
" <TD ALIGN=LEFT VALIGN=CENTER NOWRAP>\n" .
' <SMALL> ' . _("Move selected to:") . "</SMALL>\n" .
" </TD>\n" .
for ($i = 0; $i < count($boxes); $i++) {
if (!in_array("noselect", $boxes[$i]['flags'])) {
$box = $boxes[$i]['unformatted'];
- $box2 = str_replace(' ', ' ', $boxes[$i]['formatted']);
+ $box2 = str_replace(' ', ' ', $boxes[$i]['unformatted-disp']);
echo " <OPTION VALUE=\"$box\">$box2</option>\n";
}
}
- echo ' </SELECT></TT></SMALL>';
- echo " <SMALL><INPUT TYPE=SUBMIT NAME=\"moveButton\" VALUE=\"" . _("Move") . "\"></SMALL>\n";
- echo " </TD>\n";
- echo " <TD ALIGN=RIGHT NOWRAP> \n";
+ echo ' </SELECT></TT></SMALL>'.
+ "<SMALL><INPUT TYPE=SUBMIT NAME=\"moveButton\" VALUE=\"" . _("Move") . "\"></SMALL>\n".
+ " </TD>\n".
+ " <TD ALIGN=RIGHT NOWRAP> \n";
if (!$auto_expunge) {
echo ' <INPUT TYPE=SUBMIT NAME="expungeButton" VALUE="'. _("Expunge") .'"> '. _("mailbox") ." \n";
}
- echo " <INPUT TYPE=SUBMIT NAME=\"markRead\" VALUE=\"". _("Read")."\">\n";
- echo " <INPUT TYPE=SUBMIT NAME=\"markUnread\" VALUE=\"". _("Unread")."\">\n";
- echo " <INPUT TYPE=SUBMIT VALUE=\"". _("Delete") . "\"> \n";
- echo " </TD>\n";
- echo " </TR>\n";
- echo "</TABLE>\n";
+ echo " <INPUT TYPE=SUBMIT NAME=\"markRead\" VALUE=\"". _("Read")."\">\n".
+ " <INPUT TYPE=SUBMIT NAME=\"markUnread\" VALUE=\"". _("Unread")."\">\n".
+ " <INPUT TYPE=SUBMIT VALUE=\"". _("Delete") . "\"> \n".
+ " </TD>\n".
+ " </TR>\n".
+ "</TABLE>\n";
do_hook('mailbox_form_before');
- echo '</TD></TR>';
+ echo '</TD></TR>'.
- echo "<TR><TD BGCOLOR=\"$color[0]\">";
- echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=";
+ "<TR><TD BGCOLOR=\"$color[0]\">".
+ "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=";
if ($GLOBALS['alt_index_colors']) {
echo "0";
} else {
echo "1";
}
- echo " BGCOLOR=\"$color[0]\">";
- echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
+ echo " BGCOLOR=\"$color[0]\">".
+ "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
/* Print the headers. */
for ($i=1; $i <= count($index_order); $i++) {
echo ' <TD WIDTH="25%"><B>'. _("From") .'</B>';
}
- ShowSortButton($sort, $mailbox, 2, 3);
+ ShowSortButton($sort, $mailbox, 2, 3);
echo "</TD>\n";
break;
* This function computes the paginator string.
*/
function get_paginator_str
- ($urlMailbox, $start_msg, $end_msg, $num_msgs, $show_num) {
+ ($urlMailbox, $start_msg, $end_msg, $num_msgs, $show_num, $sort) {
+ global $username, $data_dir, $use_mailbox_cache, $color;
+
$nextGroup = $start_msg + $show_num;
$prevGroup = $start_msg - $show_num;
$rMore = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Next") ."</A>\n";
}
if ($lMore <> '') {
- $lMore .= ' | ';
+ $lMore .= ' | ';
}
/* Page selector block. Following code computes page links. */
$mMore = '';
- if (!getPref($data_dir, $username, 'page_selector')
+ if (getPref($data_dir, $username, 'page_selector')
&& ($num_msgs > $show_num)) {
$j = intval( $num_msgs / $show_num ); // Max pages
$k = max( 1, $j / getPref($data_dir, $username, 'page_selector_max', PG_SEL_MAX ) );
if ($num_msgs % $show_num <> 0 ) {
$j++;
}
- $start_msgs = min( $start_msgs, $num_msgs );
- $p = intval( $start_msgs / $show_num ) + 1;
+ $start_msg = min( $start_msg, $num_msgs );
+ $p = intval( $start_msg / $show_num ) + 1;
$i = 1;
while( $i < $p ) {
$pg = intval( $i );
$start = ( ($pg-1) * $show_num ) + 1;
$mMore .= "<a href=\"right_main.php?use_mailbox_cache=$use_mailbox_cache&startMessage=$start" .
- "&mailbox=$urlMailbox\" TARGET=\"right\">$pg</a> ";
+ "&mailbox=$urlMailbox\" TARGET=\"right\">$pg</a> ";
$i += $k;
}
- $mMore .= "<b>$p</b> ";
+ $mMore .= "<B>$p</B> ";
$i += $k;
while( $i <= $j ) {
$pg = intval( $i );
$start = ( ($pg-1) * $show_num ) + 1;
$mMore .= "<a href=\"right_main.php?use_mailbox_cache=$use_mailbox_cache&startMessage=$start"
- . "&mailbox=$urlMailbox\" TARGET=\"right\">$pg</a> ";
+ . "&mailbox=$urlMailbox\" TARGET=\"right\">$pg</a> ";
$i+=$k;
}
- $mMore .= ' | ';
+ $mMore .= ' | ';
}
/* Return the resulting string. */
+ if( $lMore . $mMore . $rMore == '' ) {
+ $lMore = ' ';
+ }
return ($lMore . $mMore . $rMore);
}
return substr($subject, 0, $trim_val) . '...';
}
-?>
+?>
\ No newline at end of file