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 5c6f851ffa8f0f7bbfb1865a13510b261055de61..cb4237c653e5d127a5098bd0ca018d2e943343e8 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 2151cf3ee79edbd3c8758eccd76c6ea7fa133e65..988f708fc9bfe8cb14d46bb516f0b2bfaad85779 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 c3299772ae9a85becaadb358b9a28e4d938a82fd..0a5699a8ed9870f755609426923e2645b4969dc8 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 841d0c007e007c7ed3f0c5cc3b0e2832e971b92d..3a37f54f958a10e2f2958ebd1efb589e1c6846d6 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 d23bf5f91dfdfae069eed729d4c00d311ddf1606..550213f8e42bd2200f107aa0209ee541dc15a482 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 d3302e3b7296158f29bbbf2c9b1f045c897b35b2..e0777db5f625cb72a169aee92d16958866e18872 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);