Extension talk:ConfirmEdit/LQT Archive 1

Broken download link
Currently when you try to download this extension you get the error:

svn: Working copy '/mnt/upload6/private/ExtensionDistributor/mw-snapshot/branches/REL1_16/extensions' locked

svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)

Restricting $wgCaptchaTriggers to certain user groups
I'd like to restrict the 'edit' and 'create' triggers to anonymous users, while registered users should only have to solve the CAPTCHA if they add new external links. Any idea how I could accomplish this? -Wormbo 18:50, 9 January 2009 (UTC)

Mediawiki version 13.4
With the latest Mediawiki version on my site under construction Eco-Diving.Org I get the following Fatal error: Cannot redeclare class SimpleCaptcha in /home1/twofouap/public_html/eco-diving/extensions/ConfirmEdit/ConfirmEdit_body.php on line 66

....Anybody any idea what might be wrong? Thanks in advance --Horst Salzwedel 23:08, 16 February 2009 (UTC)
 * Are you certain you're using the 1.13 version? At Special:ExtensionDistributor/ConfirmEdit, select "1.13.x" from the drop-down and install that instead of whatever you're using now. —Simetrical (talk • contribs) 00:04, 17 February 2009 (UTC)

I use mediawiki 1.16 and I have the same error message, i have corrected the line 66 with the solution taken on Redeclaration error / on MediaWiki 1.12.0 - including solution (up in the posts) I have changed

class SimpleCaptcha { function SimpleCaptcha { global $wgCaptchaStorageClass; $this->storage = new $wgCaptchaStorageClass; }

with

if(!class_exists("SimpleCaptcha")) { class SimpleCaptcha {

But I don't anderstand where put the command confirmEditMerged and witch code put with it... I think the code is

function confirmEditMerged( $editPage, $newtext ) { }

now the website ask me :

Fatal error: Call to undefined method SimpleCaptcha::confirmEditMerged in /my_website/wiki/extensions/ConfirmEdit/ConfirmEdit_body.php on line 23

I had this same error with ConfirmEdit. I think it was caused by an incompatibility with ReCaptcha. I commented out ReCaptcha's line in LocalSettings.php and the error went away.--TheAlmightyGuru 22:42, 19 November 2010 (UTC)

MediaWiki version 1.14.0
I get the following error when I install this: Fatal error: Cannot redeclare class SimpleCaptcha in /home/content/w/a/t/watc1/html/extensions/ConfirmEdit/ConfirmEdit_body.php on line 66

Any idea why? I am using the correct version.

I've been getting a lot of bot/spams and the recaptcha just isn't working like it should. I need something that works! Help!

MediaWiki 1.15.0 and PHP 5.3.0
The extension doesn't seem to work on the newest MediaWiki Version (1.15.0) and the newest PHP Version (5.3.0) - this is the error I get: Parameter 1 to ConfirmEditHooks::confirmEditMerged expected to be a reference

Please fix that. --Regexpert 23:30, 9 July 2009 (UTC)


 * Use the 1.15.x version of the extension. —Emufarmers(T 13:02, 11 July 2009 (UTC)


 * Choosing the 1.15.x release results in the svn error: "Working copy '/mnt/upload5/private/ExtensionDistributor/mw-snapshot/branches/REL1_15/extensions' locked". Cannot proceed :( 66.162.32.234 18:16, 21 July 2009 (UTC)


 * I can confirm that this extension doesn't work with MediaWiki 1.15 and PHP 5.3.0. When I want to edit an article I get an internal error:

''Detected bug in an extension! Hook ConfirmEditHooks::confirmEditMerged failed to return a value; should return true to continue hook processing or false to abort. Backtrace:
 * 1) 0 /users/mydomain/www/wiki/includes/EditPage.php(956): wfRunHooks('EditFilterMerge...', Array)
 * 2) 1 /users/mydomain/www/wiki/includes/EditPage.php(2483): EditPage->internalAttemptSave(false, false)
 * 3) 2 /users/mydomain/www/wiki/includes/EditPage.php(449): EditPage->attemptSave
 * 4) 3 /users/mydomain/www/wiki/includes/EditPage.php(340): EditPage->edit
 * 5) 4 /users/mydomain/www/wiki/includes/Wiki.php(510): EditPage->submit
 * 6) 5 /users/mydomain/www/wiki/includes/Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
 * 7) 6 /users/mydomain/www/wiki/index.php(116): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
 * 8) 7 {main}''

Can that be fixed? --Plati123 20:23, 30 July 2009 (UTC)
 * I have the same problem. Is there anything that can be done with this? Happy Joe 16:41, 20 August 2009 (UTC)
 * I also have the problem! I think it is a ConfirmEdit bug!
 * same here, mediawiki 1.13.0 and I think php 5.3.0 :/ 195.240.173.128 14:08, 1 February 2010 (UTC)


 * You are using an old version of the extension. Use the version appropiate for your mediawiki version. Special:ExtensionDistributor/ConfirmEdit. And if you have an old 1.13 wiki, update it. - Platonides 21:18, 3 February 2010 (UTC)
 * upgraded to MediaWiki 1.15.1 and the latest ConfirmEdit release. Special:Version. Still the same problem. 195.240.173.128 10:05, 4 February 2010 (UTC)


 * Ok. I have replicated it. ConfirmEdit r36959 is broken. Use the trunk one. That works fine for me. Platonides 22:47, 4 February 2010 (UTC)
 * Thanks a lot, it works now! 195.240.173.128 09:51, 5 February 2010 (UTC)

Page blanking
It seems StrategyWiki was hit by a wave of page-blanking bots that replace entire sections with a single line of text. I suggest adding a new captcha trigger based on excessive shrinkage of a page (e.g. 10+ lines removed), since this will stop most of these bots that operate on open proxies. This is useful for sites that don't explicitly block Tor nodes or other open proxies, while catching any bots that try exploiting them. The catch is that it may snag a few legitimate edits... --Sigma 7 14:29, 15 September 2009 (UTC)
 * You can captcha all edits. 212.179.134.33 16:10, 15 September 2009 (UTC)


 * Use AbuseFilter (see bug 18110). —Emufarmers(T 15:57, 16 September 2009 (UTC)

Doesn't work
Hi, i installed confirmedit on my debian lenny server. But it doesn't work for me. No captcha showed. My wiki version: MediaWiki 	1.15.1 PHP 	5.2.6-1+lenny3 (apache2handler) MySQL 	5.0.51a-24+lenny1-log In version special page, i don't find any ConfirmEdit entry.
 * Have you read the installation instructions? If you don't see it on Special:Version, it's not installed properly. Max Semenik 09:06, 30 November 2009 (UTC)

A note about php.ini
Captcha works great for us at the Venciclopedia. Spam has been reduced to zero since we installed it.

Today, however, we changed our php.ini settings and set the session.save_path to a path that produced the following error.

''PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0''

Captcha didn't work until this was fixed. It kept asking for yet another addition. Hope this info is good for something.--Mark 10:09, 24 December 2009 (UTC)

ConfirmEdit confirmed bot error
I'm having problem while trying to edit with a registered bot (with bot flag) on a site run by MediaWiki engine. I'm getting the error "hookaborted, the modification you tried to make was aborted by an extension hook". Without the Catpcha extension, the bot works properly and no problems occur. I suppose the problem lies in the settings, however, all the settings are these:

$wgGroupPermissions['*'           ]['skipcaptcha'] = false; $wgGroupPermissions['user'        ]['skipcaptcha'] = true; $wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true; $wgGroupPermissions['bot'         ]['skipcaptcha'] = true; // registered bots $wgGroupPermissions['sysop'       ]['skipcaptcha'] = true; $wgCaptchaTriggers['edit']         = true; $wgCaptchaTriggers['create']       = true; $wgCaptchaTriggers['createaccount'] = true;

So having the $wgGroupPermissions['bot']['skipcaptcha'] = true, it shouldn't behave like this. Any idea what I should change to solve this problem? Thanks ahead. --Pavel Dusek 08:31, 18 April 2010 (UTC)

Kurdish Sorani Translation
I've QuestyCaptcha.i18n.php for kurdish sorani (ckb_arab) translated, i hope help the next User :)

/** Kurdish Sorani in Arabic-indic Script calles ckb_arab */ $messages['ckb_arab'] = array(	'questycaptcha-desc' => 'پرسیاری قەدەغەکردنی ئامێری سپام بۆ دەستکاری و دروستکردنی پەڕە و هەژمار',	'questycaptcha-addurl' => 'دەستکاریەکەت بۆ زۆرکردنی بەستەری نوێ. بۆ ڕێگەگرتن لەئامێری سپام، تکایە وەڵامی پرسیارەکە لەنێو خانەکەدا بنوسە. (زانیاری زیاتر):',	'questycaptcha-badlogin' => 'بۆ ڕێگرتن لەئامێری شکاندی تێپەڕەوشە، تکایە وەڵامی پرسیارەکە لەنێو خانەکەدا بنوسە. (زانیاری زیاتر):',	'questycaptcha-createaccount' => 'بۆ ڕێگەگرتن لەئامێری تۆمارکردنی خۆکار، تکایە وەڵامی پرسیارەکە لەنێو خانەکەدا بنوسەوە. (زانیاری زیاتر):',	'questycaptcha-create' => 'بۆ ڕێگرتن لەئامێری دروستکردنی پەڕە, تکایە وەڵامی پرسیارەکە لەنێو خانەکەدا بنوسە.(زانیاری زیاتر):',	'questycaptcha-edit' => 'بۆ  ڕێگرتن لەئامێری دەستکاری پەڕە, تکایە وەڵامی پرسیارەکە لەنێو خانەکەدا بنوسە.(زانیاری زیاتر):', 'questycaptcha-sendemail' => 'بۆ ڕێگرتن لەئامێری سپامی دروستکردنی هەژماری خۆکار, تکایە وەڵامی پرسیارەکە لەنێو خانەکەدا بنوسە.(زانیاری زیاتر):', 'questycaptchahelp-text' => "ویکیەکەمان هیچ یاسایەکی تێدا نییە، کەڕێگە لەبەڕێزت بگرێت بۆ دەستکاری و نوسین و پەیڤین، بەڵام ئەم ڕێگایانە گیراوەتەبەر بۆ نەهێشتنی یان قەدەغەکردنی ئامێرەکانی سپام و جیاکردنەوەی ئادەمیزاد لەئامێر. ئەگەر کێشەی وەڵامدانەوەی پرسیارەکەت هەیە؟ تکایە پەیوەندی بەبەڕێوبەرانەوە بگرە . زۆر زۆر سوپاس  |بەڕێوبەران

کرتەی گەڕانەوە بکە لەوێبگەڕەکەت بۆ پەڕەی پێشووتان.", ); --Sia Neriman 21:26, 18 April 2010 (UTC)

MediaWiki:Captcha-addurl-whitelist doesnt work
# t-dialin\.net #
 * Iam using Version 1.15.x with MediaWiki 1.15.4
 * $wgCaptchaWhitelistIP works well but the "MediaWiki:Captcha-addurl-whitelist" page doesnt work.
 * Ive got the following lines in it:
 * 1)  Syntax:
 * 2)   * Alles von einem #-Zeichen bis zum Ende der Zeile ist ein Kommentar
 * 3)   * Jede nicht-leere Zeile ist ein Regex-Fragment, das gegenüber den Hostnamen einer URL geprüft wird

--RudolfH2 11:01, 12 July 2010 (UTC)
 * I want to whitelist Hostnames which ends with t-dialin.net
 * Iam using the basic math-version (no graphical captcha) of ConfirmEdit what is wrong?

Failed To Parse Message
This works fine for the calculation but fails for the mathcaptcha

I get the error:

Failed to parse (Missing texvc executable; please see math/README to configure.)

There must be more to this than what's written. I have googled around and see a lot of other suggestions to making parse errors works. I'm not sure which ones apply and which don't.

Does this assume TeX is already turned on? If it does then more documentatin needs to be put in to tell people how to activate it 99.184.221.103 06:03, 2 August 2010 (UTC)vera lynn

If Math (LaTeX rendering) on your wiki isn't enabled (or allowed on your webserver) then this wont work. Most shared servers wont let you do it so you need to find some work arounds (search "mediawiki texvc alternatives" in google) -daniel

Confirm Edit doesn't work on default settings
Hi ! All. I have downloaded and installed Confirm Edit. I have left default settings and it doesn't work.

My Localsettings.php looks like this.

require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" ); $wgCaptchaClass = 'SimpleCaptcha';
 * 1) Capcha

I would like to have all groups to be confirmet except sysops. And I think I have configure it right

Using ConfirmEdit for file uploads
Hi ,

Thanks for such a great extension. Has definitely improved the security on my site.

I was wondering if I could configure this extension for a Captcha for file uploads. I wanted to enable use of some SWF sites on my wiki, but would like to strictly validate the files as real before having them on the website.

Thanks Veryhuman 17:15, 4 September 2010 (UTC)

ConfirmEdit Blanking Page
I've installed the extetension on 1.16.0 and it appears to work without error messages. However, when a user edits or creates page and clicks save, the page refreshes with the captcha, but the user's text disappears. How do I fix this?

Captcha-desc
Hi, so far it says "Simple captcha implementation". Now that this extension is even a better goodie it should perhaps say "Allows CAPTCHA implementations" or something like it. Cheers --&#91;&#91;kgh&#93;&#93; 15:03, 2 February 2011 (UTC)
 * Cool, thank you. :) --&#91;&#91;kgh&#93;&#93; 10:56, 5 February 2011 (UTC)


 * Thanks for the suggestion! By the time I made the change, I had forgotten where I read the idea, but now I remember. :) Yaron Koren 06:31, 6 February 2011 (UTC)

Class 'SimpleCaptcha' not found
Hi, after trying to install this extension (r81364) with reCAPTCHA I got the following error message: "Fatal error: Class 'SimpleCaptcha' not found in /.../extensions/ConfirmEdit/ReCaptcha.php on line 54". I am using MW 1.16.2 Additionally it stopped displaying the description of the extension on Special:Version. Cheers --&#91;&#91;kgh&#93;&#93; 15:35, 2 February 2011 (UTC)


 * Hi - you need to have both "ConfirmEdit.php" and "ReCaptcha.php" included in LocalSettings.php. Maybe the documentation should be clearer about that. Yaron Koren 16:10, 2 February 2011 (UTC)


 * Hi Yaron, the documentation is ok since I have done so. I included both in my LocalSettings.php. For some reason I have added ReCaptche before and not below ConfirmEdit. This must be the reason. I do not know why I have done this and this must be the reason. I will try again later this evening. Thank you anyway for helping. Cheers --&#91;&#91;kgh&#93;&#93; 16:37, 2 February 2011 (UTC) Edit: I just tried it. It works out perfectly. It always helps reading the instructions correctly. --&#91;&#91;kgh&#93;&#93; 20:35, 2 February 2011 (UTC)

Where is ReCaptcha.php
There is no file named ReCaptcha.php in the download require_once( "$IP/extensions/ConfirmEdit/ReCaptcha.php"); Which version did you download? Reach Out to the Truth 17:43, 9 February 2011 (UTC)


 * Hi, I downloaded r81364 (trunk) from the extension distributor. This file should be part of it. Cheers --&#91;&#91;kgh&#93;&#93; 19:41, 9 February 2011 (UTC)


 * It doesn't even work, only for new user registrations. On editing pages it doesnt ask to confirm!


 * Most probably the group permissions and captcha triggers are not set up as desired. See here to sort things out. Cheers --&#91;&#91;kgh&#93;&#93; 15:00, 10 February 2011 (UTC)

another version of captcha.py
Just dumping it, only new features: Live in a pool of normal and colored images at clubpenguinwiki.info. Works very well.
 * generates colored captchas
 * can blur the image more
 * can generate single word-images


 * 1) !/usr/bin/python
 * 2) Script to generate distorted text images for a captcha system.
 * 3) Copyright (C) 2005 Neil Harris
 * 4) This program is free software; you can redistribute it and/or modify
 * 5) it under the terms of the GNU General Public License as published by
 * 6) the Free Software Foundation; either version 2 of the License, or
 * 7) (at your option) any later version.
 * 8) This program is distributed in the hope that it will be useful,
 * 9) but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 10) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * 11) GNU General Public License for more details.
 * 12) You should have received a copy of the GNU General Public License along
 * 13) with this program; if not, write to the Free Software Foundation, Inc.,
 * 14) 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * 15) http://www.gnu.org/copyleft/gpl.html
 * 16) Further tweaks by Brion Vibber :
 * 17) 2006-01-26: Add command-line options for the various parameters
 * 18) 2007-02-19: Add --dirs param for hash subdirectory splits
 * 19) Tweaks by Greg Sabino Mullane :
 * 20) 2008-01-06: Add regex check to skip words containing other than a-z
 * 21) Tweaks by Frozen Wind:
 * 22) 2011-02-10: Allow generation of single word captchas like on wikia
 * 23) 2011-02-10: Add colorized captchas and extra blurring
 * 1) 2007-02-19: Add --dirs param for hash subdirectory splits
 * 2) Tweaks by Greg Sabino Mullane :
 * 3) 2008-01-06: Add regex check to skip words containing other than a-z
 * 4) Tweaks by Frozen Wind:
 * 5) 2011-02-10: Allow generation of single word captchas like on wikia
 * 6) 2011-02-10: Add colorized captchas and extra blurring

import random import math import hashlib from optparse import OptionParser import os import sys import re

try: import Image import ImageFont import ImageDraw import ImageEnhance import ImageOps except: sys.exit("This script requires the Python Imaging Library - http://www.pythonware.com/products/pil/")

nonalpha = re.compile('[^a-z]') # regex to test for suitability of words

def wobbly_copy(src, wob, col, scale, ang): x, y = src.size f = random.uniform(4*scale, 5*scale) p = random.uniform(0, math.pi*2) rr = ang+random.uniform(-30, 30) # vary, but not too much int_d = Image.new('RGB', src.size, 0) # a black rectangle rot = src.rotate(rr, Image.BILINEAR) # Do a cheap bounding-box op here to try to limit work below bbx = rot.getbbox if bbx == None: return src else: l, t, r, b= bbx # and only do lines with content on       for i in range(t, b+1): # Drop a scan line in               xoff = int(math.sin(p+(i*f/y))*wob) xoff += int(random.uniform(-wob*0.5, wob*0.5)) int_d.paste(rot.crop((0, i, x, i+1)), (xoff, i)) # try to stop blurring from building up       int_d = int_d.rotate(-rr, Image.BILINEAR) enh = ImageEnhance.Sharpness(int_d) return enh.enhance(2)
 * 1) Does X-axis wobbly copy, sandwiched between two rotates

def gen_captcha(text, fontname, fontsize, file_name): """Generate a captcha image""" # colored text on a black background bgcolor = 0x0 fgcolor = random.randint(0x10,0xffffff) # create a font object font = ImageFont.truetype(fontname,fontsize) font2 = ImageFont.truetype(fontname,8) # determine dimensions of the text dim = font.getsize(text) # create a new image significantly larger that the text edge = max(dim[0], dim[1]) + 2*min(dim[0], dim[1]) im = Image.new('RGB', (edge, edge), bgcolor) d = ImageDraw.Draw(im) x, y = im.size # add the text to the image d.text((x/2-dim[0]/2, y/2-dim[1]/2), text, font=font, fill=fgcolor) k = random.randint(3,6) wob = 0.20*dim[1]/k rot = 45 # Apply lots of small stirring operations, rather than a few large ones # in order to get some uniformity of treatment, whilst # maintaining randomness for i in range(k): im = wobbly_copy(im, wob, bgcolor, i*2+random.randint(3, 6), rot+0) im = wobbly_copy(im, wob, bgcolor, i*2+1, rot+45) im = wobbly_copy(im, wob, bgcolor, i*2+2, rot+90) rot += 30

# now get the bounding box of the nonzero parts of the image bbox = im.getbbox bord = min(dim[0], dim[1])/4 # a bit of a border im = im.crop((bbox[0]-bord, bbox[1]-bord, bbox[2]+bord, bbox[3]+bord)) # and turn into black on white im = ImageOps.invert(im)

# save the image, in format determined from filename im.save(file_name)

def gen_subdir(basedir, md5hash, levels): """Generate a subdirectory path out of the first _levels_       characters of _hash_, and ensure the directories exist        under _basedir_.""" subdir = None for i in range(0, levels): char = md5hash[i] if subdir: subdir = os.path.join(subdir, char) else: subdir = char fulldir = os.path.join(basedir, subdir) if not os.path.exists(fulldir): os.mkdir(fulldir) return subdir

def try_pick_word(words, blacklist, verbose): word = words[random.randint(0,len(words)-1)] if random.random > 0.5: word += words[random.randint(0,len(words)-1)] if verbose: print "word is %s" % word if nonalpha.search(word): if verbose: print "skipping word '%s' because it contains non-alphabetic characters" % word return None

for naughty in blacklist: if naughty in word: if verbose: print "skipping word '%s' because it contains blacklisted word '%s'" % (word, naughty) return None return word

def pick_word(words, blacklist, verbose): for x in range(1000): # If we can't find a valid word in 1000 tries, just give up               word = try_pick_word(words, blacklist, verbose) if word: return word sys.exit("Unable to find valid word combinations")

def read_wordlist(filename): return [x.strip.lower for x in open(wordlist).readlines]

if __name__ == '__main__': """This grabs random words from the dictionary 'words' (one       word per line) and generates a captcha image for each one,        with a keyed salted hash of the correct answer in the filename.

To check a reply, hash it in the same way with the same salt and secret key, then compare with the hash value given. """       parser = OptionParser        parser.add_option("--wordlist", help="A list of words (required)", metavar="WORDS.txt")        parser.add_option("--key", help="The passphrase set as $wgCaptchaSecret (required)", metavar="KEY")        parser.add_option("--output", help="The directory to put the images in - $wgCaptchaDirectory (required)", metavar="DIR")        parser.add_option("--font", help="The font to use (required)", metavar="FONT.ttf")        parser.add_option("--font-size", help="The font size (default 40)", metavar="N", type='int', default=40)        parser.add_option("--count", help="The maximum number of images to make (default 20)", metavar="N", type='int', default=20)        parser.add_option("--blacklist", help="A blacklist of words that should not be used", metavar="FILE")        parser.add_option("--fill", help="Fill the output directory to contain N files, overrides count, cannot be used with --dirs", metavar="N", type='int') parser.add_option("--dirs", help="Put the images into subdirectories N levels deep - $wgCaptchaDirectoryLevels", metavar="N", type='int') parser.add_option("--verbose", "-v", help="Show debugging information", action='store_true')

opts, args = parser.parse_args

if opts.wordlist: wordlist = opts.wordlist else: sys.exit("Need to specify a wordlist") if opts.key: key = opts.key else: sys.exit("Need to specify a key") if opts.output: output = opts.output else: sys.exit("Need to specify an output directory") if opts.font and os.path.exists(opts.font): font = opts.font else: sys.exit("Need to specify the location of a font")

blacklistfile = opts.blacklist count = opts.count fill = opts.fill dirs = opts.dirs verbose = opts.verbose fontsize = opts.font_size

if fill: count = max(0, fill - len(os.listdir(output)))

words = read_wordlist(wordlist) words = [x for x in words if len(x) in (4,5) and x[0] != "f" and x[0] != x[1] and x[-1] != x[-2]]

if blacklistfile: blacklist = read_wordlist(blacklistfile) else: blacklist = []

for i in range(count): word = pick_word(words, blacklist, verbose) salt = "%08x" % random.randrange(2**32) # 64 bits of hash is plenty for this purpose md5hash = hashlib.md5(key+salt+word+key+salt).hexdigest[:16] filename = "image_%s_%s.png" % (salt, md5hash) if dirs: subdir = gen_subdir(output, md5hash, dirs) filename = os.path.join(subdir, filename) if verbose: print filename gen_captcha(word, font, fontsize, os.path.join(output, filename)) Frozen Wind 18:10, 12 February 2011 (UTC)