$message .= "<br>"; } rescue_item($euid, $mail_id); $rescued++; } $sth->free(); if ($rescued > 0) { $message .= sprintf($lang['text_attachments_rescued'], $rescued) . ".<br>"; } break; case "header": $rescued = 0; $select = "SELECT maia_mail.id, maia_mail.sender_email " . "FROM maia_mail, maia_mail_recipients " . "WHERE maia_mail.id = maia_mail_recipients.mail_id " . "AND maia_mail_recipients.type = 'B' " . "AND maia_mail_recipients.token = ? " . "AND SUBSTRING(maia_mail_recipients.token FROM 1 FOR 7) <> 'expired' " . "AND maia_mail_recipients.recipient_id = ?"; $sth = $dbh->query($select, array($token, $euid)); while ($row = $sth->fetchRow()) { $mail_id = $row["id"]; $sender = $row["sender_email"]; if (array_key_exists('wblist', $_GET)) { $message .= $lang[add_address_to_wb_list($euid, $sender, "W")]; $message .= "<br>"; } rescue_item($euid, $mail_id); $rescued++; } $sth->free(); if ($rescued > 0) { $message .= sprintf($lang['text_headers_rescued'], $rescued) . ".<br>"; } } $_SESSION["message"] = $message; header("Location: welcome.php");
function resend_message($user_id, $mail_ids) { $message = ""; foreach ($mail_ids as $mail_id) { $message .= rescue_item($user_id, $mail_id, true); } }
function confirm_cache($euid) { $message = ""; $ham_list = array(); $spam_list = array(); $delete_list = array(); $resend_list = array(); global $_POST, $lang, $logger; if (isset($_POST['cache_item'])) { $items = $_POST['cache_item']; } else { $items = array(); } foreach ($items as $type => $mail_item) { foreach ($mail_item as $mail_id => $value) { if ($type == "generic") { $newtype = $_POST['submit']; } else { $newtype = $value; } // report item if ($newtype == "spam") { switch ($this->type) { case 'ham': // Mark the item as false negative. It will also be marked as confirmed. record_mail_stats($euid, $mail_id, "fn"); $this->reported++; break; default: $this->confirmed++; } array_push($spam_list, $mail_id); //send item } elseif ($newtype == "ham") { switch ($this->type) { case 'ham': array_push($ham_list, $mail_id); $this->confirmed++; break; default: $result = rescue_item($euid, $mail_id); // done individually because of mail delivery if (strncmp($result, "2", 1) == 0) { $this->rescued++; } else { $message .= $result . "\n"; } } //delete item. } elseif ($newtype == "delete") { array_push($delete_list, $mail_id); $this->deleted++; // resend the item and leave it in the cache } elseif ($newtype == "resend") { array_push($resend_list, $mail_id); $this->resent++; } } } if (count($ham_list) > 0) { confirm_ham($euid, $ham_list); } if (count($spam_list) > 0) { confirm_spam($euid, $spam_list); } if (count($delete_list) > 0) { delete_mail_reference($euid, $delete_list); } if (count($resend_list) > 0) { resend_message($euid, $resend_list); } update_mail_stats($euid, "suspected_ham"); if ($this->confirmed > 0) { switch ($this->type) { case "ham": $message .= sprintf($lang['text_ham_confirmed'], $this->confirmed) . ".<br>"; break; case "spam": $message .= sprintf($lang['text_spam_confirmed'], $this->confirmed) . ".<br>"; break; default: $message .= sprintf($lang['text_messages_confirmed'], $this->confirmed) . ".<br>"; } } if ($this->reported > 0) { $message .= sprintf($lang['text_spam_reported'], $this->reported) . ".<br>"; } if ($this->deleted > 0) { switch ($this->type) { case 'ham': $message .= sprintf($lang['text_ham_deleted'], $this->deleted) . ".<br>"; break; case 'spam': $message .= sprintf($lang['text_spam_deleted'], $this->deleted) . ".<br>"; break; case 'virus': $message .= sprintf($lang['text_viruses_deleted'], $this->deleted) . ".<br>"; break; case 'attachment': $message .= sprintf($lang['text_attachments_deleted'], $this->deleted) . ".<br>"; break; case 'header': $message .= sprintf($lang['text_headers_deleted'], $this->deleted) . ".<br>"; break; } } if ($this->rescued > 0) { switch ($this->type) { case 'spam': $message .= sprintf($lang['text_spam_rescued'], $this->rescued) . ".<br>"; break; case 'virus': $message .= sprintf($lang['text_viruses_rescued'], $this->rescued) . ".<br>"; break; case 'attachment': $message .= sprintf($lang['text_attachments_rescued'], $this->rescued) . ".<br>"; break; case 'header': $message .= sprintf($lang['text_headers_rescued'], $this->rescued) . ".<br>"; break; } } if ($this->resent > 0) { $message .= sprintf($lang['text_message_resent'], $this->resent) . ".<br>"; } return $message; }