* http://www.mediawiki.org/ * Copyright (C) 2012, Gregor Herrmann , Philipp Spitzer * http://www.toastfreeware.priv.at/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * * @file * @ingroup Extensions */ /* Ideas for improved versions: * Use cookie prefix to define the cookie name * Use timestamp in cookie * Without apache * Provide sample image */ /* The idea of this "captcha" is to let the browser download an image that sets a cookie. Research showed that spam bots don't load images. You have to setup the cookie e.g. in the apache2 configuration file. Here is an example where an image that's uploaded with mediawiki is used: Header append Set-Cookie "mediawiki_token=%t; Path=/; HttpOnly" ExpiresActive On ExpiresDefault "access plus 5 second" Required settings in LocalSettings.php: require_once("$IP/extensions/CookieCaptcha/ConfirmEdit.php"); require_once("$IP/extensions/CookieCaptcha/CookieCaptcha.php"); $wgCaptchaClass = 'CookieCaptcha'; $wgCaptchaTriggers['createaccount'] = true; */ if ( !defined( 'MEDIAWIKI' ) ) { exit; } $dir = __DIR__; require_once $dir . '/ConfirmEdit.php'; $wgCaptchaClass = 'CookieCaptcha'; $wgCaptchaCookieName = 'mediawiki_token'; // make it look "realistic". Idea: use $wgCookiePrefix . '_token' $wgCaptchaCookieImage = '/mediawiki/images/d/d0/MyImage.png'; // You _have_ to specify an existing image $wgCaptchaCookieAlt = ''; // alt attribute for the image $wgCaptchaCookieStyle = 'display:none;'; // CSS inline style applied to the image $wgAutoloadClasses['CookieCaptcha'] = $dir . '/CookieCaptcha.class.php';