From f357e68495b8624d9cfe383b55e681a0c35cc18f Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 21 Mar 2008 15:14:41 +0100 Subject: =?UTF-8?q?FunnyDot-Verbesserungen=20von=20LL=20=C3=BCbernommen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/FunnyDot.php | 64 ++++++++++++++++++++++++++++++++----------- skins/ArchLinux.php | 8 +----- skins/archlinux/archlinux.css | 4 +++ 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/extensions/FunnyDot.php b/extensions/FunnyDot.php index df81129e..db62b148 100644 --- a/extensions/FunnyDot.php +++ b/extensions/FunnyDot.php @@ -1,6 +1,7 @@ 'FunnyDot', @@ -11,34 +12,65 @@ $wgExtensionCredits['other'][] = array( class FunnyDot { -public static function checkAntiSpamHash() +public static function addAntiSpamCheck($editpage, $outputpage) { - global $wgAntiSpamHash, $wgAntiSpamTimeout, $wgAntiSpamWait; + global $wgAntiSpamHash, $wgUser; - $now = time(); - - if (!empty($_COOKIE['AntiSpamTime']) && !empty($_COOKIE['AntiSpamHash'])) + if (!$wgUser->isLoggedIn()) { - $time = intval($_COOKIE['AntiSpamTime']); + $outputpage->addHTML('
 
'); + + $time = time(); + $hash = sha1($time.$wgAntiSpamHash); + setCookie('AlternateAntiSpamTime', $time); + setCookie('AlternateAntiSpamHashTail', substr($hash, 4)); + + $outputpage->addHTML('
 
'); + } + + return true; + } - if ($_COOKIE['AntiSpamHash'] != sha1($time.$wgAntiSpamHash)) +public static function checkAntiSpamHash($editpage, $text, $section, $error) + { + global $wgAntiSpamHash, $wgAntiSpamTimeout, $wgAntiSpamWait, $wgUser; + + if (!$wgUser->isLoggedIn()) + { + if (!empty($_COOKIE['AntiSpamTime']) && !empty($_COOKIE['AntiSpamHash'])) { - return false; + $time = $_COOKIE['AntiSpamTime']; + $hash = $_COOKIE['AntiSpamHash']; } + elseif (!empty($_COOKIE['AlternateAntiSpamTime']) && !empty($_COOKIE['AlternateAntiSpamHashTail']) && !empty($_POST['AlternateAntiSpamHashHead'])) + { + $time = $_COOKIE['AlternateAntiSpamTime']; + $hash = $_POST['AlternateAntiSpamHashHead'].$_COOKIE['AlternateAntiSpamHashTail']; + } + else + { + sleep($wgAntiSpamWait); + $error = '
Ungültige Formulardaten empfangen. Stelle sicher, daß Cookies für diese Domain angenommen werden.
'; + return true; + } + + $now = time(); - if ($now - $time > $wgAntiSpamTimeout) + if ($hash != sha1($time.$wgAntiSpamHash)) { - return false; + sleep($wgAntiSpamWait); + $error = '
Fehlerhafte Formulardaten empfangen. Überprüfe den Sicherheitscode!
'; + } + elseif ($now - $time > $wgAntiSpamTimeout) + { + $error = '
Deine Zeit ist abgelaufen. Schicke das Formular bitte erneut ab, und zwar innherlab der nächsten '.$wgAntiSpamTimeout.' Sekunden.
'; } elseif ($now - $time < $wgAntiSpamWait) { - return false; + sleep($wgAntiSpamWait); + $error = '
Du warst zu schnell. Schicke das Formular bitte erneut ab. Laße Dir diesmal mindestens '.$wgAntiSpamWait.' Sekunden Zeit.
'; } } - else - { - return false; - } return true; } diff --git a/skins/ArchLinux.php b/skins/ArchLinux.php index c16c2b7d..dcc6d8d3 100644 --- a/skins/ArchLinux.php +++ b/skins/ArchLinux.php @@ -124,13 +124,7 @@ class ArchLinuxTemplate extends QuickTemplate { - - -
 
- -
 
- +
diff --git a/skins/archlinux/archlinux.css b/skins/archlinux/archlinux.css index e34e8926..a1a11909 100644 --- a/skins/archlinux/archlinux.css +++ b/skins/archlinux/archlinux.css @@ -95,6 +95,10 @@ a:hover { /* MediaWiki: */ +#globalWrapper { + padding-top: 13px; +} + #content { background-color: #F0F0F0; border-right: 1px solid; -- cgit v1.2.2