From 23fd3c8ebf96b73c2d4d09e80c04d5031fb8fc13 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Wed, 31 Jan 2001 03:59:49 +0000 Subject: [PATCH] added more bugfixes and warning squashes git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@999 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 2 +- functions/mailbox_display.php | 19 +++++++++---------- functions/strings.php | 6 +++++- src/compose.php | 4 ++-- src/move_messages.php | 8 ++++---- src/read_body.php | 6 +++++- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 5c6f851f..cb4237c6 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -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 } } diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 2151cf3e..988f708f 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -108,16 +108,15 @@ break; case 4: # subject echo " $bold"; - if (! isset($search_stuff)) - $search_stuff = ''; - echo "$flag"; - if (strlen($subject) > 55) - echo substr($subject, 0, 50) . '...'; - else - echo $subject; - echo "$flag_end$bold_end\n"; + if (! isset($search_stuff)) { $search_stuff = ''; } + echo "$flag"; + if (strlen($subject) > 55) + echo substr($subject, 0, 50) . '...'; + else + echo $subject; + echo "$flag_end$bold_end\n"; break; case 5: # flags $stuff = false; diff --git a/functions/strings.php b/functions/strings.php index c3299772..0a5699a8 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -54,7 +54,11 @@ 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; diff --git a/src/compose.php b/src/compose.php index 841d0c00..3a37f54f 100644 --- a/src/compose.php +++ b/src/compose.php @@ -385,7 +385,7 @@ } } - 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"); @@ -395,7 +395,7 @@ } } - if (($mailbox == "") || ($mailbox == "None")) + if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None")) $mailbox = "INBOX"; if(isset($send)) { diff --git a/src/move_messages.php b/src/move_messages.php index d23bf5f9..550213f8 100644 --- a/src/move_messages.php +++ b/src/move_messages.php @@ -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++; } @@ -107,7 +107,7 @@ 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)); @@ -124,7 +124,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])) { /** 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"); @@ -136,7 +136,7 @@ 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)); diff --git a/src/read_body.php b/src/read_body.php index d3302e3b..e0777db5 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -165,6 +165,8 @@ // 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); @@ -175,7 +177,9 @@ $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); -- 2.25.1