function delete_user_mail_references($uid) { global $dbh; // Delete recipient references to any mail items this user // might have. $select = "SELECT mail_id FROM maia_mail_recipients WHERE recipient_id = ?"; $sth = $dbh->query($select, array($uid)); sql_check($sth, "delete_user_mail_references", $select); while ($row = $sth->fetchRow()) { delete_mail_reference($uid, $row["mail_id"]); } $sth->free(); }
$select = "SELECT maia_mail.id " . "FROM maia_mail, maia_mail_recipients " . "WHERE maia_mail.id = maia_mail_recipients.mail_id " . "AND maia_mail.received_date <= ? " . "AND maia_mail_recipients.type = 'F' " . "AND maia_mail_recipients.recipient_id = ?"; $sth = $dbh->query($select, array($cutoff_date, $euid)); while ($row = $sth->fetchRow()) { $mail_id = $row["id"]; delete_mail_reference($euid, $mail_id); $deleted++; } $sth->free(); if ($deleted > 0) { $message .= sprintf($lang['text_attachments_deleted'], $deleted) . ".<br>"; } } if ($_GET["report_header"]) { # Invalid Headers $deleted = 0; $select = "SELECT maia_mail.id " . "FROM maia_mail, maia_mail_recipients " . "WHERE maia_mail.id = maia_mail_recipients.mail_id " . "AND maia_mail.received_date <= ? " . "AND maia_mail_recipients.type = 'B' " . "AND maia_mail_recipients.recipient_id = ?"; $sth = $dbh->query($select, array($cutoff_date, $euid)); while ($row = $sth->fetchRow()) { $mail_id = $row["id"]; delete_mail_reference($euid, $mail_id); $deleted++; } $sth->free(); if ($deleted > 0) { $message .= sprintf($lang['text_headers_deleted'], $deleted) . ".<br>"; } } $update = "DELETE from maia_tokens " . "WHERE token=? " . "AND data=? " . "AND token_system='digest'"; $sth = $dbh->query($update, array($token, $euid)); $_SESSION["message"] = $message; header("Location: welcome.php");
function delete_user_mail_references($uid) { global $dbh; // Delete recipient references to any mail items this user // might have. $sth = $dbh->prepare("SELECT mail_id FROM maia_mail_recipients WHERE recipient_id = ?"); $res = $sth->execute(array($uid)); if (PEAR::isError($sth)) { die($sth->getMessage()); } while ($row = $res->fetchRow()) { delete_mail_reference($uid, $row["mail_id"]); } $sth->free(); }
$id = $euid; } if (isset($_POST["maxitemid"])) { $maxitemid = $_POST["maxitemid"]; } else { $maxitemid = 0; } if (isset($_POST['delete_all_items'])) { $del_list = array(); $select = "SELECT mail_id FROM maia_mail_recipients " . "WHERE type IN ('S','P','V','F','B','H') " . "AND recipient_id = ? " . "AND mail_id <= ?"; $sth = $dbh->query($select, array($euid, $maxitemid)); while ($row = $sth->fetchRow()) { array_push($del_list, $row["mail_id"]); } $sth->free(); delete_mail_reference($euid, $del_list); } if (isset($_POST['change_protection']) && isset($_POST['protection_level'])) { $select = "SELECT policy_id FROM users WHERE maia_user_id = ?"; $sth = $dbh->query($select, $euid); $update = "UPDATE policy SET virus_lover = ?, " . "spam_lover = ?, " . "banned_files_lover = ?, " . "bad_header_lover = ?, " . "bypass_virus_checks = ?, " . "bypass_spam_checks = ?, " . "bypass_banned_checks = ?, " . "bypass_header_checks = ?, " . "discard_viruses = ?, " . "discard_spam = ?, " . "discard_banned_files = ?, " . "discard_bad_headers = ?, " . "spam_modifies_subj = ?, " . "spam_tag_level = ?, " . "spam_tag2_level = ?, " . "spam_kill_level = ? " . "WHERE id = ?"; $protection_level = $_POST["protection_level"]; while ($row = $sth->fetchrow()) { $dbh->query($update, array_merge($protection[$protection_level], array($row['policy_id']))); } $sth->free(); } update_mail_stats($id, "suspected_ham"); update_mail_stats($id, "suspected_spam"); $cache_count = count_cache_items($euid); if (array_key_exists('S', $cache_count)) {
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; }