function antispam_get_max_counter in AntiSpam 7
Same name and namespace in other branches
- 6 antispam.module \antispam_get_max_counter()
Get max counter value for the specified counter type.
1 call to antispam_get_max_counter()
- antispam_generate_statistics_graph in ./
antispam.admin.inc - Generate a graph of service statistics using Google Chart API
File
- ./
antispam.module, line 199 - Primary hook implementations for the Antispam module.
Code
function antispam_get_max_counter($counter_type = '') {
$rec = db_query("SELECT MAX(spam_detected) AS max_spam, MAX(ham_detected) AS max_ham, MAX(false_negative) AS max_fnegative, MAX(false_positive) AS max_fpositive FROM {antispam_counter}")
->fetchObject();
if ($rec->max_spam == '') {
$rec->max_spam = 0;
}
if ($rec->max_ham == '') {
$rec->max_ham = 0;
}
if ($rec->max_fnegative == '') {
$rec->max_fnegative = 0;
}
if ($rec->max_fpositive == '') {
$rec->max_fpositive = 0;
}
// Returns an array of all totals.
if (empty($counter_type)) {
return array(
'max_spam' => $rec->max_spam,
'max_ham' => $rec->max_ham,
'max_fnegative' => $rec->max_fnegative,
'max_fpositive' => $rec->max_fpositive,
);
}
switch ($counter_type) {
case ANTISPAM_COUNT_ALL:
return $rec->max_spam + $rec->max_ham;
case ANTISPAM_COUNT_SPAM_DETECTED:
return $rec->max_spam;
case ANTISPAM_COUNT_HAM_DETECTED:
return $rec->max_ham;
case ANTISPAM_COUNT_FALSE_NEGATIVE:
return $rec->max_fnegative;
case ANTISPAM_COUNT_FALSE_POSITIVE:
return $rec->max_fpositive;
// Just in case.
default:
return 0;
}
}