function testPost(ISblamPost $p) { if ($t = $p->getPostTime()) { $hour = date("G", $t); if ($hour >= 2 and $hour <= 5) { return array(0.15, self::CERTAINITY_LOW, "Late-night posting ({$hour}h)"); } if ($hour >= 1 and $hour <= 7) { return array(0.09, self::CERTAINITY_LOW, "Late-night posting ({$hour}h)"); } } }
function testPost(ISblamPost $p) { $res = $this->plonker->testIPs($p->getAuthorIPs(), sprintf('%u', $p->getPostTime())); if (!$res) { return NULL; } list($total, $count) = $res; if ($total < 0.1) { return NULL; } $rawtotal = round($total, 1); $total = sqrt($total) / 2 + $total / 800; $total = max(0, $total - 0.28); if ($total > 0.4) { $total = 0.4 + ($total - 0.4) / 2; } if ($total > 0.7) { $total = 0.7 + ($total - 0.7) / 2; } $total = min(7.5, $total + 0.15); return array($total, $total > 1.5 ? self::CERTAINITY_HIGH : self::CERTAINITY_NORMAL, "Automatically banned IPs/range ({$count} ips, {$rawtotal} R = " . round($total, 1) . ")"); }