Opened 12 years ago

#466 new enhancement

Filter for the quarantine page

Reported by: anonymous Owned by: dmorton
Priority: normal Milestone:
Component: PHP scripts Version: 1.0.2
Severity: normal Keywords: filter field
Cc:

Description

There are sometime quite many mails in the quarantine section, a filter

would be nice to search for relevant mails.

I changed some files to include such a filter field. It basically modifies the SQL statement and it is quite simple:

//prevent sql injection
if ($filter != "") {
 $filter = mysql_real_escape_string($filter);
}
$this->select_stmt = "SELECT maia_mail.id, maia_mail.received_date,
maia_mail.score, " .
"maia_mail.sender_email, maia_mail.subject, maia_mail.envelope_to " .
$extra_select .
"FROM maia_mail_recipients " .
"LEFT JOIN maia_mail " .
"ON maia_mail.id = maia_mail_recipients.mail_id " .
$extra_join .
"WHERE maia_mail_recipients.type = '". $this->get_sort_abbrev() ."' " .
"AND maia_mail_recipients.recipient_id = ? ";

if ($filter != "") {
        $this->select_stmt .= "AND (maia_mail.subject LIKE '%$filter%' OR
maia_mail.envelope_to LIKE '%$filter%')";
        }
$this->select_stmt .= " ORDER BY maia_mail." . $this->sortby['column'] . "
" . $this->sort_order;

I can post the changed files or submit a diff. But there are probably better solutions. It would be nice to supply the $filter as a prepared statement link the maia_mail_recipients.recipient_id in the SQL string.

regards Peter

Change History (0)

Note: See TracTickets for help on using tickets.