Captcha Mediawiki 1.3

From Fxp Wiki

Jump to: navigation, search

Mediawiki 1.3 captcha hack

For version 1.5+ see: Mediawiki Captcha 1.5

Captcha

Installed a captcha system (veriword: used on Wordpress and Drupal)

This code works on this mediawiki1.3 version. A working code was developped by miEro at wiki.matfyz.cz tuning. The draft of the code for mediawiki 1.5 is to be found at Captcha15.

Installed the extension, and the authimage.php (correcting the address with "extension/authimage-inc/...", and of course, declare it in LocalSettings.php


Modified the function submit() of includes/EditPage.php:

 
function submit()
	{
    global $wgUser;
		if( !$this->preview ) $this->save = true;
/* Modified FXP */
$comment_code         = $_POST['code'];  // AuthImage
if ( !checkAICode($comment_code) && !$wgUser->isSysop() ) die( 'Error: please enter the valid authorization code.');
 
		$this->edit();
	}
 

Note that the sysop doesn't want to enter the code each time he wants to correct something:-)


And a part of the form, again in includes/EditPage.php:

$wgOut->addHTML( "
{$toolbar}
<form id=\"editform\" name=\"editform\" method=\"post\" action=\"$action\"
enctype=\"multipart/form-data\" onSubmit=\"return testValues(this)\">
{$commentsubject}
<textarea tabindex='1' accesskey=\",\" name=\"wpTextbox1\" rows='{$rows}'
cols='{$cols}'{$ew}>" .
htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) .
"
</textarea>
 
<p>
          <input type=\"text\" name=\"code\" id=\"code\" value=\"\" size=\"20\" tabindex=\"4\" />
          <label for=\"code\">Enter this code: </label>
          <img src=\"{$authimage}\" width=\"155\" height=\"50\" alt=\"authimage\" />
</p>
<br />{$editsummary}
{$checkboxhtml}
<input tabindex='5' id='wpSave' type='submit' value=\"{$save}\" name=\"wpSave\" accesskey=\"".wfMsg('accesskey-save')."\"".
" title=\"".wfMsg('tooltip-save')."\"/>
<input tabindex='6' id='wpPreview' type='submit' value=\"{$prev}\" name=\"wpPreview\" accesskey=\"".wfMsg('accesskey-preview')."\"".
" title=\"".wfMsg('tooltip-preview')."\"/>
<em>{$cancel}</em> | <em>{$edithelp}</em>{$templates}
<br /><div id=\"editpage-copywarn\">{$copywarn}</div>
<input type='hidden' value=\"" . htmlspecialchars( $this->section ) . "\" name=\"wpSection\" />
<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n" );

Personal tools