Browse Source

* speed improvemnts in sorting
* more warnings removed

Luke Ehresman 24 years ago
parent
commit
5301802ba0
6 changed files with 42 additions and 26 deletions
  1. 1 0
      ChangeLog
  2. 13 4
      functions/mailbox_display.php
  3. 1 1
      functions/mime.php
  4. 4 3
      functions/prefs.php
  5. 16 14
      src/options_highlight.php
  6. 7 4
      src/read_body.php

+ 1 - 0
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

+ 13 - 4
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;
                }

+ 1 - 1
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;

+ 4 - 3
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);
    }
    

+ 16 - 14
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 "      </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"]))

+ 7 - 4
src/read_body.php

@@ -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)) {
@@ -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 .= "&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>";