blob: df81129e244f7c7b56d1f4a6fd8ae5b7801bbb78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
$wgHooks['ArticleSave'][] = 'FunnyDot::checkAntiSpamHash';
$wgExtensionCredits['other'][] = array(
'name' => 'FunnyDot',
'description' => 'Schutz vor Spam-Bots',
'author' => 'Pierre Schmitz',
'url' => 'http://www.archlinux.de',
);
class FunnyDot {
public static function checkAntiSpamHash()
{
global $wgAntiSpamHash, $wgAntiSpamTimeout, $wgAntiSpamWait;
$now = time();
if (!empty($_COOKIE['AntiSpamTime']) && !empty($_COOKIE['AntiSpamHash']))
{
$time = intval($_COOKIE['AntiSpamTime']);
if ($_COOKIE['AntiSpamHash'] != sha1($time.$wgAntiSpamHash))
{
return false;
}
if ($now - $time > $wgAntiSpamTimeout)
{
return false;
}
elseif ($now - $time < $wgAntiSpamWait)
{
return false;
}
}
else
{
return false;
}
return true;
}
}
?>
|