From 44d134481c94c0b67665e1868c9120ed1b0dcd0d Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 17 Oct 2010 12:02:09 +0200 Subject: remove unneeded plugins --- extensions/FunnyDot.php | 151 ------------------------------------------------ 1 file changed, 151 deletions(-) delete mode 100644 extensions/FunnyDot.php (limited to 'extensions/FunnyDot.php') diff --git a/extensions/FunnyDot.php b/extensions/FunnyDot.php deleted file mode 100644 index 320889ac..00000000 --- a/extensions/FunnyDot.php +++ /dev/null @@ -1,151 +0,0 @@ - 'FunnyDot', - 'version' => '2.1', - 'description' => 'Automated CAPTCHA', - 'author' => 'Pierre Schmitz', - 'url' => 'https://www.archlinux.de' -); - -if ($wgGroupPermissions['*']['edit']) { - $wgHooks['EditPage::showEditForm:fields'][] = 'FunnyDot::addFunnyDotToEditPage'; - $wgHooks['EditFilter'][] = 'FunnyDot::checkFunnyDotOnEditPage'; -} - -if (empty($wgAuth)) { - $wgHooks['UserLoginForm'][] = 'FunnyDot::addFunnyDotToUserLoginForm'; - $wgHooks['AbortLogin'][] = 'FunnyDot::checkFunnyDotOnAbortLogin'; -} - -if ($wgGroupPermissions['*']['createaccount'] && (empty($wgAuth) || $wgAuth->canCreateAccounts())) { - $wgHooks['UserCreateForm'][] = 'FunnyDot::addFunnyDotToUserCreateForm'; - $wgHooks['AbortNewAccount'][] = 'FunnyDot::checkFunnyDotOnAbortNewAccount'; -} - -$wgSpecialPages['FunnyDotImage'] = 'SpecialFunnyDotImage'; - - -class FunnyDot { - -private static function getFunnyDot() { - global $IP, $wgFunnyDotHash, $wgScript; - - !isset($wgFunnyDotHash) && $wgFunnyDotHash = $IP; - $time = time(); - $hash = substr(sha1($time.$wgFunnyDotHash), 0, 4); - - return '
- - - -
'; -} - -private static function checkFunnyDot() { - global $IP, $wgFunnyDotHash, $wgFunnyDotTimeout, $wgFunnyDotWait; - - # set some sane defaults - # can be overridden in LocalSettings.php - !isset($wgFunnyDotHash) && $wgFunnyDotHash = $IP; - !isset($wgFunnyDotTimeout) && $wgFunnyDotTimeout = 3600; - !isset($wgFunnyDotWait) && $wgFunnyDotWait = 2; - - if (!empty($_POST['FunnyDotTime']) && (!empty($_COOKIE['FunnyDotHash']) || !empty($_POST['FunnyDotHash']))) { - $now = time(); - $time = $_POST['FunnyDotTime']; - $hash = !empty($_POST['FunnyDotHash']) ? $_POST['FunnyDotHash'] : $_COOKIE['FunnyDotHash']; - } else { - return false; - } - - if ($hash != substr(sha1($time.$wgFunnyDotHash), 0, 4)) { - return false; - } elseif ($now - $time > $wgFunnyDotTimeout) { - return false; - } elseif ($now - $time < $wgFunnyDotWait) { - return false; - } else { - return true; - } -} - - -public static function addFunnyDotToEditPage($editpage, $output) { - global $wgUser; - - if (!$wgUser->isLoggedIn()) { - $editpage->editFormTextAfterWarn .= self::getFunnyDot(); - } - return true; -} - -public static function checkFunnyDotOnEditPage($editpage, $text, $section, $error) { - global $wgUser; - - if (!$wgUser->isLoggedIn() && !self::checkFunnyDot()) { - $error = '
Please type in the correct code!

'; - } - return true; -} - - -public static function addFunnyDotToUserLoginForm($template) { - $template->set('header', self::getFunnyDot()); - return true; -} - -public static function checkFunnyDotOnAbortLogin($user, $password, $retval) { - # LoginForm::ABBORT is not yet supported by MediaWiki - $retval = LoginForm::ILLEGAL; - return self::checkFunnyDot(); -} - - -public static function addFunnyDotToUserCreateForm($template) { - $template->set('header', self::getFunnyDot()); - return true; -} - -public static function checkFunnyDotOnAbortNewAccount($user, $message) { - if (!self::checkFunnyDot()) { - $message = '
Please type in the correct code!

'; - return false; - } else { - return true; - } -} - -} - - -class SpecialFunnyDotImage extends UnlistedSpecialPage { - -function __construct() { - parent::__construct('FunnyDotImage'); -} - -function execute($par) { - global $wgFunnyDotHash, $wgOut; - - # I will handle the output myself - $wgOut->disable(); - - !isset($wgFunnyDotHash) && $wgFunnyDotHash = ''; - - if (!empty($_GET['FunnyDotTime'])) { - setCookie('FunnyDotHash', substr(sha1($_GET['FunnyDotTime'].$wgFunnyDotHash), 0, 4), 0, '/', null, isset($_SERVER['HTTPS']), true); - } - - header('HTTP/1.1 200 OK'); - header("Cache-Control: no-cache, must-revalidate, no-store"); - header('Content-Type: image/png'); - header('Content-Length: 135'); - - # transparent png (1px*1px) - echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gLFxMRGNZyzLoAAAACYktHRAD/h4/MvwAAAAtJREFUCB1j+M8AAAIBAQDFXxteAAAAAElFTkSuQmCC'); -} - -} - -?> -- cgit v1.2.3-54-g00ecf