* 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 dc9ccb9..d826533 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 62ad718..c51dd74 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 d299d3e..76260f6 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 dc45992..c23d3cb 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 9e3fb84..44335ba 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 c29b949..5c21403 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>";