Pārlūkot izejas kodu

fixed more warnings

Luke Ehresman 24 gadi atpakaļ
vecāks
revīzija
6f10a0740a
7 mainītis faili ar 30 papildinājumiem un 23 dzēšanām
  1. 2 0
      ChangeLog
  2. 5 4
      functions/imap_search.php
  3. 5 4
      functions/mime.php
  4. 3 3
      src/download.php
  5. 3 3
      src/options_folder.php
  6. 5 2
      src/options_order.php
  7. 7 7
      src/search.php

+ 2 - 0
ChangeLog

@@ -1,5 +1,7 @@
 Version 1.0.1 -- DEVELOPMENT
 ----------------------------
+- Removed unnecessary echo statements by breaking out of PHP
+- Changed evaluation method from using " to ' for speed improvements
 - If no plugin array set in config.php, now handled correctly
 - If subject is > 55 chars, trims it and puts "..." in message list
 - Hundreds of minor changes to remove all verbose PHP warning messages

+ 5 - 4
functions/imap_search.php

@@ -22,7 +22,7 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo
    
    # Construct the Search QuERY
    
-   if ($languages[$squirrelmail_language]["CHARSET"]) {
+   if (isset($languages[$squirrelmail_language]["CHARSET"]) && $languages[$squirrelmail_language]["CHARSET"]) {
       $ss = "a001 SEARCH CHARSET ".$languages[$squirrelmail_language]["CHARSET"]." ALL $search_where \"$search_what\"\r\n";
    } else {
       $ss = "a001 SEARCH ALL $search_where \"$search_what\"\r\n";
@@ -45,10 +45,10 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo
    }
 
    #If nothing is found * SEARCH should be the first error else echo errors
-   if (strstr($errors,"* SEARCH")) {
+   if (isset($errors) && strstr($errors,"* SEARCH")) {
       echo "<br><CENTER>No Messages Found</CENTER>";
       return;
-   } else {
+   } else if (isset($errors)) {
       echo "<!-- ".$errors." -->";
    }
 
@@ -117,7 +117,7 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo
       $i = 0;
       $j = 0;
       while ($j < count($messagelist)) {
-         if ($messages[$j]["FLAG_DELETED"] == true) {
+         if (isset($messages[$j]["FLAG_DELETED"]) && $messages[$j]["FLAG_DELETED"] == true) {
             $j++;
             continue;
          }
@@ -132,6 +132,7 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo
 
       if (count($messagelist) > 0) {
          $j=0;
+		 if (!isset ($msg)) { $msg = ""; }
          mail_message_listing_beginning($imapConnection, 
             "move_messages.php?msg=$msg&mailbox=$urlMailbox&where=".urlencode($search_where)."&what=".urlencode($search_what),
              '', -1, '<b>' . _("Found") . ' ' . count($messagelist) . ' ' . _("messages") . '</b>',

+ 5 - 4
functions/mime.php

@@ -27,7 +27,7 @@
       var $type0 = '', $type1 = '', $boundary = '', $charset = '';
       var $encoding = '', $size = 0, $to = '', $from = '', $date = '';
       var $cc = '', $bcc = '', $reply_to = '', $subject = '';
-      var $id = 0, $mailbox = '', $description = '';
+      var $id = 0, $mailbox = '', $description = '', $filename = '';
       var $entity_id = 0, $message_id = 0;
    }
    
@@ -37,11 +37,11 @@
           more objects of type message.  See documentation in mime.txt for
           a better description of how this works.
        **/   
-      var $header;
-      var $entities;
+      var $header = '';
+      var $entities = '';
       
       function addEntity ($msg) {
-         $this->entities[count($this->entities)] = $msg;
+         $this->entities[] = $msg;
       }
    }
 
@@ -537,6 +537,7 @@
       global $startMessage, $color;
       static $ShownHTML;
       
+	  $body = "";
       if ($ShownHTML == 0)
       {
             $ShownHTML = 1;

+ 3 - 3
src/download.php

@@ -11,10 +11,10 @@
     **  $Id$
     **/
 
-   if (!isset($config_php))
-      include("../config/config.php");
    if (!isset($strings_php))
       include("../functions/strings.php");
+   if (!isset($config_php))
+      include("../config/config.php");
    if (!isset($imap_php))
       include("../functions/imap.php");
    if (!isset($mime_php))
@@ -110,7 +110,7 @@
 
    header("Pragma: ");
    header("Content-Description: SquirrelMail Attachment");
-   if ($absolute_dl == "true") {
+   if (isset($absolute_dl) && $absolute_dl == "true") {
       switch($type0) {
          case "text":
             $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);

+ 3 - 3
src/options_folder.php

@@ -12,10 +12,10 @@
 
    session_start();
 
-   if (!isset($config_php))
-      include("../config/config.php");
    if (!isset($strings_php))
       include("../functions/strings.php");
+   if (!isset($config_php))
+      include("../config/config.php");
    if (!isset($page_header_php))
       include("../functions/page_header.php");
    if (!isset($display_messages_php))
@@ -33,7 +33,7 @@
    displayPageHeader($color, "None");
 
    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
-   $boxes = sqimap_mailbox_list($imapConnection, $boxes);
+   $boxes = sqimap_mailbox_list($imapConnection, $boxes="");
    sqimap_logout($imapConnection);
 ?>
    <br>

+ 5 - 2
src/options_order.php

@@ -12,10 +12,10 @@
 
    session_start();
 
-   if (!isset($config_php))
-      include("../config/config.php");
    if (!isset($strings_php))
       include("../functions/strings.php");
+   if (!isset($config_php))
+      include("../config/config.php");
    if (!isset($page_header_php))
       include("../functions/page_header.php");
    if (!isset($display_messages_php))
@@ -30,6 +30,7 @@
       include("../functions/plugin.php");
 
 
+   if (! isset($action)) { $action = ""; }
    if ($action == "delete" && isset($theid)) {
       removePref($data_dir, $username, "highlight$theid");
    } else if ($action == "save") {
@@ -52,6 +53,8 @@
    $available[5] = _("Flags");
    $available[6] = _("Size");
    
+   if (! isset($method)) { $method = ""; }
+
    if ($method == "up" && $num > 1) {
       $prev = $num-1;
       $tmp = $index_order[$prev];

+ 7 - 7
src/search.php

@@ -57,7 +57,7 @@
 
    $boxes = sqimap_mailbox_list($imapConnection);
    for ($i = 0; $i < count($boxes); $i++) {
-      if ($boxes[$i]["flags"][0] != "noselect" && $boxes[$i]["flags"][1] != "noselect" && $boxes[$i]["flags"][2] != "noselect") {
+	  if (!in_array("noselect", $boxes[$i]["flags"])) {
          $box = $boxes[$i]["unformatted"];
          $box2 = replace_spaces($boxes[$i]["formatted"]);
          if ($mailbox == $box)
@@ -80,22 +80,22 @@
    echo "       <TD ALIGN=\"RIGHT\" WIDTH=33%>\n";
    echo "         <SELECT NAME=\"where\">";
    
-   if ($where == "BODY") echo "           <OPTION VALUE=\"BODY\" SELECTED>"._("Body")."\n";
+   if (isset($where) && $where == "BODY") echo "           <OPTION VALUE=\"BODY\" SELECTED>"._("Body")."\n";
    else echo "           <OPTION VALUE=\"BODY\">"._("Body")."\n";
    
-   if ($where == "TEXT") echo "           <OPTION VALUE=\"TEXT\" SELECTED>"._("Everywhere")."\n";
+   if (isset($where) && $where == "TEXT") echo "           <OPTION VALUE=\"TEXT\" SELECTED>"._("Everywhere")."\n";
    else echo "           <OPTION VALUE=\"TEXT\">"._("Everywhere")."\n";
    
-   if ($where == "SUBJECT") echo "           <OPTION VALUE=\"SUBJECT\" SELECTED>"._("Subject")."\n";
+   if (isset($where) && $where == "SUBJECT") echo "           <OPTION VALUE=\"SUBJECT\" SELECTED>"._("Subject")."\n";
    else echo "           <OPTION VALUE=\"SUBJECT\">"._("Subject")."\n";
    
-   if ($where == "FROM") echo "           <OPTION VALUE=\"FROM\" SELECTED>"._("From")."\n";
+   if (isset($where) && $where == "FROM") echo "           <OPTION VALUE=\"FROM\" SELECTED>"._("From")."\n";
    else echo "           <OPTION VALUE=\"FROM\">"._("From")."\n";
    
-   if ($where == "CC") echo "           <OPTION VALUE=\"Cc\" SELECTED>"._("Cc")."\n";
+   if (isset($where) && $where == "CC") echo "           <OPTION VALUE=\"Cc\" SELECTED>"._("Cc")."\n";
    else echo "           <OPTION VALUE=\"CC\">"._("Cc")."\n";
    
-   if ($where == "TO") echo "           <OPTION VALUE=\"TO\" SELECTED>"._("To")."\n";
+   if (isset($where) && $where == "TO") echo "           <OPTION VALUE=\"TO\" SELECTED>"._("To")."\n";
    else echo "           <OPTION VALUE=\"TO\">"._("To")."\n";
    
    echo "         </SELECT>\n";