function display_spam_report($mail_id) { global $dbh; $rows = array(); $select = "SELECT rule_name, rule_description, maia_sa_rules_triggered.rule_score " . "FROM maia_sa_rules, maia_sa_rules_triggered " . "WHERE maia_sa_rules.id = maia_sa_rules_triggered.rule_id " . "AND maia_sa_rules_triggered.mail_id = ? " . "ORDER BY maia_sa_rules_triggered.rule_score DESC"; $sth = $dbh->query($select, array($mail_id)); if ($sth->numrows() > 0) { while ($row = $sth->fetchrow()) { $rows[] = array('rule_score' => sprintf("%.3f", $row["rule_score"]), 'rule_name' => $row["rule_name"], 'description' => add_links_to_text($row["rule_description"])); } $sth->free(); } return $rows; }
function display_spam_report($mail_id) { global $dbh; $rows = array(); if (PEAR::isError($dbh)) { return $dbh; } $sth = $dbh->prepare("SELECT rule_name, rule_description, maia_sa_rules_triggered.rule_score " . "FROM maia_sa_rules, maia_sa_rules_triggered " . "WHERE maia_sa_rules.id = maia_sa_rules_triggered.rule_id " . "AND maia_sa_rules_triggered.mail_id = ? " . "ORDER BY maia_sa_rules_triggered.rule_score DESC"); if (PEAR::isError($sth)) { die($sth . "and " . $mail_id); } $res = $sth->execute(array($mail_id)); if (PEAR::isError($res)) { return $res; } if ($res->numrows() > 0) { while ($row = $res->fetchrow()) { $rows[] = array('rule_score' => sprintf("%.3f", $row["rule_score"]), 'rule_name' => $row["rule_name"], 'description' => add_links_to_text($row["rule_description"])); } } $sth->free(); return $rows; }
require_once "smarty.php"; $select = "SELECT enable_charts " . "FROM maia_config WHERE id = 0"; $sth = $dbh->query($select); if ($row = $sth->fetchrow()) { $enable_charts = $row["enable_charts"] == 'Y'; } $sth->free(); if ($enable_charts) { $select = "SELECT charts FROM maia_users WHERE id=?"; $sth = $dbh->query($select, $euid); if ($row = $sth->fetchrow()) { $enable_charts = $row["charts"] == 'Y'; } $sth->free(); } $smarty->assign("enable_charts", $enable_charts); $select = "SELECT SUM(rule_count) AS total, COUNT(rule_count) AS rcount FROM maia_sa_rules WHERE rule_count > 0"; $sth = $dbh->query($select); $data = array(); if (($row = $sth->fetchrow()) && ($total = $row["total"]) > 0) { $smarty->assign('rcount', $row["rcount"]); $smarty->assign('total', $row["total"]); $select = "SELECT rule_name, rule_description, rule_score_3 AS rule_score, rule_count " . "FROM maia_sa_rules WHERE rule_count > 0 ORDER BY rule_count DESC, rule_name ASC"; $sth2 = $dbh->query($select); while ($row2 = $sth2->fetchrow()) { $data[] = array('rule_name' => $row2['rule_name'], 'rule_description' => add_links_to_text($row2['rule_description']), 'rule_score' => $row2['rule_score'], 'rule_count' => $row2['rule_count']); } } $smarty->assign("lang", $lang); $smarty->assign("data", $data); $smarty->display("rulestats.tpl");