+ /**
+ * This function computes the "Viewing Messages..." 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: <B>%s</B> to <B>%s</B> (%s total)"), $start_msg, $end_msg, $num_msgs);
+ } else if ($start_msg == $end_msg) {
+ $result = sprintf(_("Viewing Message: <B>%s</B> (1 total)"), $start_msg);
+ } else {
+ $result = '<br>';
+ }
+
+ /* Return our result string. */
+ return ($result);
+ }
+
+ /**
+ * This function computes the paginator string.
+ */
+ function get_paginator_str
+ ($urlMailbox, $start_msg, $end_msg, $num_msgs, $show_num) {
+ $nextGroup = $start_msg + $show_num;
+ $prevGroup = $start_msg - $show_num;
+
+ if ($sort == 6) {
+ $use = 0;
+ } else {
+ $use = 1;
+ }
+ $lMore = '';
+ $rMore = '';
+ if (($nextGroup <= $num_msgs) && ($prevGroup >= 0)) {
+ $lMore = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Previous") . '</A>';
+ $rMore = "<A HREF=\"right_main.php?use_mailbox_cache=$use&&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Next") ."</A>\n";
+ } else if (($nextGroup > $num_msgs) && ($prevGroup >= 0)) {
+ $lMore = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Previous") . '</A>';
+ $rMore = "<FONT COLOR=\"$color[9]\">"._("Next")."</FONT>\n";
+ } else if (($nextGroup <= $num_msgs) && ($prevGroup < 0)) {
+ $lMore = "<FONT COLOR=\"$color[9]\">"._("Previous") . '</FONT>';
+ $rMore = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Next") ."</A>\n";
+ }
+ if ($lMore <> '') {
+ $lMore .= ' | ';
+ }
+
+ /* Page selector block. Following code computes page links. */
+ $mMore = '';
+ 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;
+ $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> ";
+ $i += $k;
+ }
+ $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> ";
+ $i+=$k;
+ }
+ $mMore .= ' | ';
+ }
+
+ /* Return the resulting string. */
+ return ($lMore . $mMore . $rMore);
+ }
+
+ function processSubject($subject) {