function antispam_get_max_counter in AntiSpam 6
Same name and namespace in other branches
- 7 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 254
Code
function antispam_get_max_counter($counter_type = '') {
$rec = db_fetch_object(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}"));
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;
}
if (empty($counter_type)) {
// returns an array of all totals
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;
default:
return 0;
}
}