function antispam_get_counter in AntiSpam 6
Same name and namespace in other branches
- 7 antispam.module \antispam_get_counter()
Get today's counter value for the specified counter type
1 call to antispam_get_counter()
- antispam_increase_counter in ./
antispam.module - Increase today's counter value for the specified counter type by 1
File
- ./
antispam.module, line 312
Code
function antispam_get_counter($counter_type) {
// for today
$rec = db_fetch_object(db_query("SELECT * FROM {antispam_counter} WHERE date = '%s'", date('Y-m-d 00:00:00')));
if (!$rec) {
return 0;
// no counter record for today
}
switch ($counter_type) {
case ANTISPAM_COUNT_ALL:
return $rec->spam_detected + $rec->ham_detected;
case ANTISPAM_COUNT_SPAM_DETECTED:
return $rec->spam_detected;
case ANTISPAM_COUNT_HAM_DETECTED:
return $rec->ham_detected;
case ANTISPAM_COUNT_FALSE_NEGATIVE:
return $rec->false_negative;
case ANTISPAM_COUNT_FALSE_POSITIVE:
return $rec->false_positive;
default:
return 0;
}
}