Exemplo n.º 1
0
require_once "./locale/{$display_language}/quarantine.php";
require_once "./locale/{$display_language}/reportspam.php";
if ($_GET['manage'] == 'true') {
    header("Location: welcome.php");
    exit;
}
$cutoff_date = $timestamp;
$message = "";
# Ham
if ($_GET["report_ham"]) {
    $confirmed = 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 = 'H' " . "AND maia_mail_recipients.recipient_id = ?";
    $sth = $dbh->query($select, array($cutoff_date, $euid));
    while ($row = $sth->fetchRow()) {
        $mail_id = $row["id"];
        confirm_ham($euid, $mail_id);
        $confirmed++;
    }
    $sth->free();
    update_mail_stats($euid, "suspected_ham");
    if ($confirmed > 0) {
        $message .= sprintf($lang['text_ham_confirmed'], $confirmed) . ".<br>";
    }
}
if ($_GET["report_spam"]) {
    # Spam
    $confirmed = 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 IN ('S','P') " . "AND maia_mail_recipients.recipient_id = ?";
    $sth = $dbh->query($select, array($cutoff_date, $euid));
    while ($row = $sth->fetchRow()) {
        $mail_id = $row["id"];
Exemplo n.º 2
0
 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;
 }