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
}
}
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;
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;
}
}
- 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)) {
// 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));
// 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);