* speed improvemnts in sorting
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 1 Feb 2001 02:53:12 +0000 (02:53 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 1 Feb 2001 02:53:12 +0000 (02:53 +0000)
* more warnings removed

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1026 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
functions/mailbox_display.php
functions/mime.php
functions/prefs.php
src/options_highlight.php
src/read_body.php

index dc9ccb967c351649cef25f1c1fee13d615199092..d826533cf0bd91f33e5d0ab0d6059fc7052d86ca 100644 (file)
--- 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
index 62ad7181a5b3b7754034a887f89034f19d34b013..c51dd746accf0d9d900c290cdad6db37abb257e1 100644 (file)
          $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']);
             $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;
                }
index d299d3ee0799e22a353c92005f962f53c5d27b75..76260f6e11de2850d80994b4f6963087a1f6aef4 100644 (file)
          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;
index dc4599263eb104feb89beda44fb3093c93e244f1..c23d3cb88dc2f7c0471d27e20e52a1d8dc287645 100644 (file)
             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);
    }
    
index 9e3fb84bf9a663dba33bd91d78afd2518c32f1b7..44335ba9493560d81939f630dc878b3e3a732a78 100644 (file)
       
       $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";
       echo "      </b></td>\n";
       echo "      <td width=75%>\n";
       echo "         <select name=match_type>\n";
-      if ($message_highlight_list[$theid]["match_type"] == "from")    echo "            <option value=\"from\" selected>From\n";
+      if (isset($message_highlight_list[$theid]["match_type"]) && $message_highlight_list[$theid]["match_type"] == "from")    echo "            <option value=\"from\" selected>From\n";
       else                                                         echo "            <option value=\"from\">From\n";
-      if ($message_highlight_list[$theid]["match_type"] == "to")      echo "            <option value=\"to\" selected>To\n";
+      if (isset($message_highlight_list[$theid]["match_type"]) && $message_highlight_list[$theid]["match_type"] == "to")      echo "            <option value=\"to\" selected>To\n";
       else                                                         echo "            <option value=\"to\">To\n";
-      if ($message_highlight_list[$theid]["match_type"] == "cc")      echo "            <option value=\"cc\" selected>Cc\n";
+      if (isset($message_highlight_list[$theid]["match_type"]) && $message_highlight_list[$theid]["match_type"] == "cc")      echo "            <option value=\"cc\" selected>Cc\n";
       else                                                         echo "            <option value=\"cc\">Cc\n";
-      if ($message_highlight_list[$theid]["match_type"] == "to_cc")   echo "            <option value=\"to_cc\" selected>To or Cc\n";
+      if (isset($message_highlight_list[$theid]["match_type"]) && $message_highlight_list[$theid]["match_type"] == "to_cc")   echo "            <option value=\"to_cc\" selected>To or Cc\n";
       else                                                         echo "            <option value=\"to_cc\">To or Cc\n";
-      if ($message_highlight_list[$theid]["match_type"] == "subject") echo "            <option value=\"subject\" selected>Subject\n";
+      if (isset($message_highlight_list[$theid]["match_type"]) && $message_highlight_list[$theid]["match_type"] == "subject") echo "            <option value=\"subject\" selected>Subject\n";
       else                                                         echo "            <option value=\"subject\">Subject\n";
       echo "         </select>\n";
       if (isset($message_highlight_list[$theid]["value"]))
index c29b9497b24a15e8c6bf237697bedea31db76e77..5c214037dceaac065f2c431353ecc7deb5e0a7e0 100644 (file)
@@ -41,7 +41,7 @@
       echo "<br>";
       echo "<table width=100% cellpadding=2 cellspacing=0 border=0 align=center>\n";
       echo "   <TR><TD BGCOLOR=\"$color[9]\" WIDTH=100%><center><b>" . _("Viewing full header") . "</b> - ";
-      if ($where && $what) {
+      if (isset($where) && isset($what)) {
          // Got here from a search
          echo "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$passed_id&where=".urlencode($where)."&what=".urlencode($what)."\">";
       } else {
@@ -51,6 +51,7 @@
       echo "<table width=99% cellpadding=2 cellspacing=0 border=0 align=center>\n";
       echo "<tr><td>";
 
+      $cnum = 0;
       for ($i=1; $i < count($read)-1; $i++) {
          $line = htmlspecialchars($read[$i]);
                        if (eregi("^&gt;", $line)) {
          }
                }
                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 .= "&nbsp;&nbsp;&nbsp;&nbsp;" . nl2br($second[$j]);
                                $j++;
                        }
                        parseEmail($s);
-                       echo "<nobr><tt><b>$f</b>$s</tt></nobr>";
+            if (isset($f)) echo "<nobr><tt><b>$f</b>$s</tt></nobr>";
       }
       echo "</td></tr></table>\n";
       echo "</body></html>";