Blegs for help

by Henry Farrell on August 20, 2007

Two requests for help:

(1) Academic blogs wiki. I’ve grown tired of dealing with google spammers, and have upgraded to Mediawiki 1.68 which should allow me to use “ConfirmEdit”:, a basic captcha tool. Unfortunately, it doesn’t work – when I try to implement it I get the following error message

Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ‘(‘ in /home/farrell/public_html/wiki/extensions/ConfirmEdit/ConfirmEdit.php on line 363

It looks from the extension’s “talk page”: as though I am not the only person experiencing this problem (someone suggests a modification to the php file which doesn’t seem to work for me). Anyone have any idea of what the problem is? (fwiw my server uses php 4.4.6 – hence my inability to upgrade to a more recent version of MediaWiki). For the moment I have implemented a temporary kludge to deter spambots by protecting the relevant directory with a password easily visible to Real Humans, but this isn’t a happy or elegant long term solution. UPDATE – problem solved – a directory screw-up on my part.

(2) when messing around with my server a few months ago, I deleted the rtf and PDF files for the Yochai Benkler seminar that we ran here a while back, and can’t find any copies on my hard drive or on the Wayback Machine. Anyone who downloaded a copy and is willing to send me it will have my eternal gratitude …



norbizness 08.20.07 at 7:18 pm

Do what now?


bi 08.20.07 at 7:39 pm

What is inside ConfirmEdit.php around line 363?


Aaron Swartz 08.20.07 at 7:57 pm

It appears you can make this problem go away by replacing the two instances of LoginForm::WRONG_PASS with LoginForm::WRONG_PASS() (i.e. add a () on the end. This worked for me in PHP 4.4.4


Henry 08.20.07 at 8:16 pm

Hi Aaron – I tried that (someone else suggests it in the Talk page) but it doesn’t seem to work for me for some reason. Perhaps something stupid I am doing (my knowledge of PHP is at the cargo-cult level).

bi – line 363 looks to be a comment line in my editor- I enclose the code for the 50-60 lines around it in case there is something obvious wrong.

function triggerUserLogin( $user, $password, $retval ) {
global $wgCaptchaTriggers, $wgCaptchaBadLoginExpiration, $wgMemc;
if( $retval == LoginForm::WRONG_PASS() && $wgCaptchaTriggers[‘badlogin’] ) {
$key = $this->badLoginKey();
$count = $wgMemc->get( $key );
if( !$count ) {
$wgMemc->add( $key, 0, $wgCaptchaBadLoginExpiration );
$count = $wgMemc->incr( $key );
return true;

* Check if a bad login has already been registered for this
* IP address. If so, require a captcha.
* @return bool
* @access private
function isBadLoginTriggered() {
global $wgMemc;
return intval( $wgMemc->get( $this->badLoginKey() ) ) > 0;

* Internal cache key for badlogin checks.
* @return string
* @access private
function badLoginKey() {
return wfMemcKey( ‘captcha’, ‘badlogin’, ‘ip’, wfGetIP() );

* Check if the submitted form matches the captcha session data provided
* by the plugin when the form was generated.
* Override this!
* @param WebRequest $request
* @param array $info
* @return bool
function keyMatch( $request, $info ) {
return $request->getVal( ‘wpCaptchaWord’ ) == $info[‘answer’];

// ———————————-

* @param EditPage $editPage
* @param string $action (edit/create/addurl…)
* @return bool true if action triggers captcha on editPage’s namespace
function captchaTriggers( &$editPage, $action) {
global $wgCaptchaTriggers, $wgCaptchaTriggersOnNamespace;
//Special config for this NS?
if (isset( $wgCaptchaTriggersOnNamespace[$editPage->mTitle->getNamespace()][$action] ) )
return $wgCaptchaTriggersOnNamespace[$editPage->mTitle->getNamespace()][$action];

return ( !empty( $wgCaptchaTriggers[$action] ) ); //Default


Henry 08.20.07 at 8:35 pm

update – problem solved (a directory screwup on my part …)


grackle 08.21.07 at 1:58 am

I am confused. If I click on the Yochai Benkler book event in the CT left margin, I am transported to the series of posts on that event. What else did you lose?


buermann 08.21.07 at 3:27 am

It should be




Assuming that isn’t something introduced by the blog software…


buermann 08.21.07 at 3:32 am

Interesting. If that “#038;” (which is encoding of an ampersand, &) is actually in your code and not just what you posted that’s the problem.

Comments on this entry are closed.