From cd9281577d4b1042f586808bbd12369ced6b183f Mon Sep 17 00:00:00 2001 From: lkehresman Date: Thu, 1 Feb 2001 02:53:12 +0000 Subject: [PATCH] * speed improvemnts in sorting * more warnings removed git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1026 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + functions/mailbox_display.php | 17 +++++++++++++---- functions/mime.php | 2 +- functions/prefs.php | 7 ++++--- src/options_highlight.php | 30 ++++++++++++++++-------------- src/read_body.php | 11 +++++++---- 6 files changed, 42 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc9ccb96..d826533c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ Version 1.0.1 -- DEVELOPMENT ---------------------------- +- Sped up "no sorting" even more - Fixed problems with sending messages - Fixed some pass-by-reference calls that caused problems with newer PHP versions - Fixed bug that didn't display last folder subscribed to diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 62ad7181..c51dd746 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -230,13 +230,22 @@ $j = 0; if ($sort == 6) { $end = $startMessage + $show_num - 1; + if ($numMessages < $show_num) + $end_loop = $numMessages; + else + $end_loop = $show_num; } else { $end = $numMessages; + $end_loop = $end; } if ($end > $numMessages) $end = $numMessages; - while ($j < $end) { - $date[$j] = ereg_replace(' ', ' ', $date[$j]); - $tmpdate = explode(' ', trim($date[$j])); + while ($j < $end_loop) { + if (isset($date[$j])) { + $date[$j] = ereg_replace(' ', ' ', $date[$j]); + $tmpdate = explode(' ', trim($date[$j])); + } else { + $tmpdate = $date = array("","","","","",""); + } $messages[$j]['TIME_STAMP'] = getTimeStamp($tmpdate); $messages[$j]['DATE_STRING'] = getDateString($messages[$j]['TIME_STAMP']); @@ -286,7 +295,7 @@ $i = 0; $j = 0; while ($j < $numMessages) { - if ($messages[$j]['FLAG_DELETED'] == true) { + if (isset($messages[$j]['FLAG_DELETED']) && $messages[$j]['FLAG_DELETED'] == true) { $j++; continue; } diff --git a/functions/mime.php b/functions/mime.php index d299d3ee..76260f6e 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -460,7 +460,7 @@ if ($message->header->entity_id == $ent_id && strlen($ent_id) == strlen($message->header->entity_id)) { return $message; } else { - for ($i = 0; $message->entities[$i]; $i++) { + for ($i = 0; isset($message->entities[$i]); $i++) { $msg = getEntity ($message->entities[$i], $ent_id); if ($msg) return $msg; diff --git a/functions/prefs.php b/functions/prefs.php index dc459926..c23d3cb8 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -62,10 +62,11 @@ fwrite($file, "$pref[$i]", 1024); } } - for ($i=0; $i < count($hlt); $i++) { - fwrite($file, "highlight$i=$hlt[$i]"); + if (isset($htl)) { + for ($i=0; $i < count($hlt); $i++) { + fwrite($file, "highlight$i=$hlt[$i]"); + } } - fclose($file); } diff --git a/src/options_highlight.php b/src/options_highlight.php index 9e3fb84b..44335ba9 100644 --- a/src/options_highlight.php +++ b/src/options_highlight.php @@ -112,15 +112,17 @@ $selected_input = ""; - if (isset($message_highlight_list[$theid]["color"])) - { - for ($i=0; $i < 14; $i++) { - if ($color_list[$i] == $message_highlight_list[$theid]["color"]) { - $selected_choose = " checked"; - ${"selected".$i} = " selected"; - continue; - } - } + for ($i=0; $i < 14; $i++) { + ${"selected".$i} = ""; + } + if (isset($message_highlight_list[$theid]["color"])) { + for ($i=0; $i < 14; $i++) { + if ($color_list[$i] == $message_highlight_list[$theid]["color"]) { + $selected_choose = " checked"; + ${"selected".$i} = " selected"; + continue; + } + } } if (!isset($message_highlight_list[$theid]["color"])) $selected_choose = " checked"; @@ -180,15 +182,15 @@ echo " \n"; echo " \n"; echo " \n"; if (isset($message_highlight_list[$theid]["value"])) diff --git a/src/read_body.php b/src/read_body.php index c29b9497..5c214037 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -41,7 +41,7 @@ echo "
"; echo "\n"; echo "
" . _("Viewing full header") . " - "; - if ($where && $what) { + if (isset($where) && isset($what)) { // Got here from a search echo ""; } else { @@ -51,6 +51,7 @@ echo "\n"; echo "
"; + $cnum = 0; for ($i=1; $i < count($read)-1; $i++) { $line = htmlspecialchars($read[$i]); if (eregi("^>", $line)) { @@ -70,15 +71,17 @@ } } for ($i=0; $i < count($second); $i = $j) { - $f = $first[$i]; - $s = nl2br($second[$i]); + if (isset($first[$i])) + $f = $first[$i]; + if (isset($second[$i])) + $s = nl2br($second[$i]); $j = $i + 1; while ($first[$j] == "" && $j < count($first)) { $s .= "    " . nl2br($second[$j]); $j++; } parseEmail($s); - echo "$f$s"; + if (isset($f)) echo "$f$s"; } echo "
\n"; echo ""; -- 2.25.1