added more bugfixes and warning squashes
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 31 Jan 2001 03:59:49 +0000 (03:59 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 31 Jan 2001 03:59:49 +0000 (03:59 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@999 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php
functions/mailbox_display.php
functions/strings.php
src/compose.php
src/move_messages.php
src/read_body.php

index 5c6f851..cb4237c 100755 (executable)
@@ -23,7 +23,7 @@
    function sqimap_mailbox_exists ($imap_stream, $mailbox) {
       fputs ($imap_stream, "a001 LIST \"\" \"$mailbox\"\r\n");
       $mbx = sqimap_read_data($imap_stream, "a001", true, $response, $message);
-      if ($mailbox) {
+      if (isset($mailbox) && isset($mbx[0])) {
          return !!(ereg ("$mailbox", $mbx[0]));  // To force into true/false
       }
    }
index 2151cf3..988f708 100644 (file)
                break;
             case 4: # subject
                echo "   <td bgcolor=$hlt_color>$bold";
-              if (! isset($search_stuff))
-                  $search_stuff = '';
-              echo "<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0$search_stuff\"";
-              do_hook("subject_link");
-              echo ">$flag";
-              if (strlen($subject) > 55)
-                  echo substr($subject, 0, 50) . '...';
-              else
-                  echo $subject;
-              echo "$flag_end</a>$bold_end</td>\n";
+                  if (! isset($search_stuff)) { $search_stuff = ''; }
+               echo "<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0$search_stuff\"";
+               do_hook("subject_link");
+               echo ">$flag";
+               if (strlen($subject) > 55)
+                   echo substr($subject, 0, 50) . '...';
+               else
+                      echo $subject;
+               echo "$flag_end</a>$bold_end</td>\n";
                break;
             case 5: # flags
                $stuff = false;
index c329977..0a5699a 100644 (file)
    function sqWordWrap(&$line, $wrap) {
       preg_match("/^([\s>]*)([^\s>].*)?$/", $line, $regs);
       $beginning_spaces = $regs[1];
-      $words = explode(' ', $regs[2]);
+         if (isset($regs[2])) {
+         $words = explode(' ', $regs[2]);
+      } else {
+         $words = "";
+         }
 
       $i = 0;
       $line = $beginning_spaces;
index 841d0c0..3a37f54 100644 (file)
          }
       }
       
-      if (!$failed) {
+      if (!isset($failed) || !$failed) {
          // Write information about the file
          $fp = fopen ($attachment_dir.$localfilename.".info", "w");
          fputs ($fp, $HTTP_POST_FILES['attachfile']['type']."\n".$HTTP_POST_FILES['attachfile']['name']."\n");
       }
     }
 
-   if (($mailbox == "") || ($mailbox == "None"))
+   if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
       $mailbox = "INBOX";
 
    if(isset($send)) {
index d23bf5f..550213f 100644 (file)
@@ -97,7 +97,7 @@
          // If they have selected nothing msg is size one still, but will be an infinite
          //    loop because we never increment j.  so check to see if msg[0] is set or not to fix this.
          while ($j < count($msg)) {
-            if ($msg[$i]) {
+            if (isset($msg[$i])) {
                sqimap_messages_delete($imapConnection, $msg[$i], $msg[$i], $mailbox);
                $j++;
             }
             sqimap_mailbox_expunge($imapConnection, $mailbox, true);
          }
          $location = get_location();
-         if ($where && $what)
+         if (isset($where) && isset($what))
             header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where));
          else   
             header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox));
          // If they have selected nothing msg is size one still, but will be an infinite
          //    loop because we never increment j.  so check to see if msg[0] is set or not to fix this.
          while ($j < count($msg)) {
-            if ($msg[$i]) {
+            if (isset($msg[$i])) {
                /** check if they would like to move it to the trash folder or not */
                sqimap_messages_copy($imapConnection, $msg[$i], $msg[$i], $targetMailbox);
                sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Deleted");
             sqimap_mailbox_expunge($imapConnection, $mailbox, true);
 
          $location = get_location();
-         if ($where && $what)
+         if (isset($where) && isset($what))
             header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where));
          else   
             header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox));
index d3302e3..e0777db 100644 (file)
    // add them to the list.  Remove duplicates.
    // This is somewhat messy, so I'll explain:
    // 1) Take all addresses (from, to, cc) (avoid nasty join errors here)
+   if (!is_array($message->header->to)) { $message->header->cc = array($message->header->to); }
+   if (!is_array($message->header->cc)) { $message->header->cc = array($message->header->cc); }
    $url_replytoall_extra_addrs = array_merge(array($message->header->from),
       $message->header->to, $message->header->cc);
 
    $url_replytoall_extra_addrs = parseAddrs($url_replytoall_extra_addrs);
    
    // 4) Make them unique -- weed out duplicates
-   $url_replytoall_extra_addrs = array_unique($url_replytoall_extra_addrs);
+   if (function_exists("array_unique")) {
+      $url_replytoall_extra_addrs = array_unique($url_replytoall_extra_addrs);
+   }
    
    // 5) Remove the addresses we'll be sending the message 'to'
    $url_replytoall_avoid_addrs = parseAddrs($message->header->replyto);