Hello,
I know for this question I should ask the extensions programmer, but he is not anzwering, so I am asking here, because maybe someone has a solution for this:
It is all about: http://www.mediawiki.org/wiki/Extension:ArticleComments
I got it to work properly on my Mediawiki Installation, but it gets spammed massive. That is why i would like to install the reCAPTCHA Plugin, announced here: www.mediawiki.org/wiki/Extension_talk:ArticleComments#Captcha_support
I wrote "Jaroslav Tulach" and he is sending me some article-comments.diff file which has the following code (see below).
Is someone able to read this code and knows what to do so that reCAPTCHA could be installed in that wonderful Article Comments Extension?
Your Help is highly appreciated Isabell
~~~~~~~~~~~~~~~~~~~~~~~~ diff -r 5ab5e1459c4f -r 761476165c97 httpdocs/extensions/ArticleComments.php --- a/httpdocs/extensions/ArticleComments.php Tue May 12 21:42:16 2009 +0200 +++ b/httpdocs/extensions/ArticleComments.php Wed May 13 09:50:06 2009 +0200 @@ -69,6 +69,8 @@ # Confirm MW environment if (!defined('MEDIAWIKI')) die();
+require_once 'EditPage.php'; + # Credits $wgExtensionCredits['other'][] = array( 'name'=>'ArticleComments', @@ -138,7 +140,7 @@ */ function wfArticleCommentForm( $title = null, $params = array() ) {
- global $wgScript, $wgArticleCommentDefaults, $wgContentLang, $wgContLang; + global $wgScript, $wgArticleCommentDefaults, $wgContentLang, $wgContLang, $wgCaptcha; $wcl = ($wgContentLang ? $wgContentLang : $wgContLang);
# Merge in global defaults if specified @@ -177,6 +179,7 @@ '<p>'.wfMsgForContent($ac.'comment-field').'<br />'. '<textarea id="comment" name="comment" style="width:30em" rows="5">'. '</textarea></p>'. + $wgCaptcha->getForm(). '<p><input id="submit" type="submit" '. 'value="'.wfMsgForContent($ac.'submit-button').'" /></p>'. '</form></div>'; @@ -292,6 +295,7 @@ $wgMessageCache->addMessage('article-comments-submission-view-all', 'You may view all comments on that article [[$1|here]]'); $wgMessageCache->addMessage('article-comments-prefilled-comment-text', ''); $wgMessageCache->addMessage('article-comments-user-is-blocked', 'Your user account is currently blocked from editing [[$1]].'); + $wgMessageCache->addMessage('article-comments-no-captcha', 'Your response to captcha was not correct. Go back and try again.'); $wgMessageCache->addMessage('article-comments-new-comment', "\n== $1 ==\n\n<div class='commentBlock'>\n$2\n\n--$3 $4\n</div>\n"); $wgMessageCache->addMessage('article-comments-no-spam', "At least one of the submitted fields was flagged as spam."); $wgMessageCache->addMessage('processcomment', 'Process Article Comment'); @@ -302,7 +306,7 @@ */ function specialProcessComment() {
- global $wgOut, $wgParser, $wgUser, $wgContentLang, $wgContLang; + global $wgOut, $wgParser, $wgUser, $wgContentLang, $wgContLang, $wgCaptcha; $wcl = ($wgContentLang ? $wgContentLang : $wgContLang);
# Retrieve submitted values @@ -352,6 +356,18 @@ return; }
+ # Captcha & Recaptcha + if ($wgCaptcha->passCaptcha()) { + $article->purge(); + } else { + $wgOut->setPageTitle(wfMsgForContent($ac.'submission-failed')); + $wikiText = "<div class='errorbox'>"; + $wikiText .= wfMsgForContent($ac.'failure-reasons')."\n\n"; + $wikiText .= '* '.wfMsgForContent($ac.'no-captcha', $talkTitle->getPrefixedText())."\n"; + $wgOut->addWikiText($wikiText . "</div>"); + return; + } + # Retrieve article content $articleContent = ''; if ( $article->exists() ) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~