Jump to content

Extension talk:KeyCAPTCHA

About this board

KeyCaptcha is still calling functions which were deprecated in MW1.21

1
Carlb (talkcontribs)

The code for this extension was written for MW 1.16-1.18; because of the lack of a consistent interface between the various versions of core MW code and extensions, many of the functions it was calling no longer exist. In addition to the issues documented at Extension:KeyCAPTCHA#MediaWiki_1.27+ there are a few more functions which no longer exist in MW 1.31: wfMsgForContent() has joined wfEmptyMsg() on the scrap heap and Revision::getText() is also gone as of Jan 2017.

In an attempt to keep this extension running on existing sites, I've had to make these changes to extensions/keyCaptcha/keyCaptcha.php (around lines 81-100) to disable the captcha-addurl-whitelist setting and replace $rev->getText() with functions that are available in the current MW releases:

                function filterLink( $url ) {
                        global $wgCaptchaWhitelist;
#                       $source = wfMsgForContent( 'captcha-addurl-whitelist' );

#                       $whitelist = wfEmptyMsg( 'captcha-addurl-whitelist', $source )
#                               ? false
#                               : $this->buildRegexes( explode( "\n", $source ) );
                        $whitelist = false;

                        $cwl = $wgCaptchaWhitelist !== false ? preg_match( $wgCaptchaWhitelist, $url ) : false;
                        $wl  = $whitelist          !== false ? preg_match( $whitelist, $url )          : false;
                        return !( $cwl || $wl );
                }

                function loadText( $editPage, $section ) {
                        $rev = Revision::newFromTitle( $editPage->mTitle );
                        if ( is_null( $rev ) ) {
                                return "";
                        } else {
#                               replace "$text = $rev->getText();" with these two due to deprecation:
                                $content = $rev->getContent(Revision::FOR_PUBLIC, null );
                                $text =  ContentHandler::getContentText( $content );    

                                if ( $section != '' ) {
                                        global $wgParser;
                                        return $wgParser->getSection( $text, $section );
                                } else {
                                        return $text;
                                }
                        }
                }

where the comment # marker indicates code I've had to disable, with the replacement "kludged" in directly below.

Of course, this is no insurance against other pieces of this extension breaking or against keycaptcha.com going away someday (and, without the proprietary external server, the extension will presumably be completely useless some day). The original creator of this extension has been silent for years, which is unfortunate as this looks to be a strong CAPTCHA which has kept a lot of spam off my sites. ~~~~

Reply to "KeyCaptcha is still calling functions which were deprecated in MW1.21"

KeyCaptcha not Working on Reg Page

4
Jason1234h (talkcontribs)

The registration page has keycaptcha at the top (formatting problem). Also, no matter how many times my test users create accounts, it constantly gives an error. Perhaps I have the permissions set to no user registrations in localsettings.php? Not sure what to do.

The KeyCaptcha will not let any users register. Also, it was working perfectly on another site. It must be a setting on this site only.

SCREENSHOT: http://i.imgur.com/OsowrlR.png

NOTE: The screenshot shows the error message with a brand new uncompleted captcha after completing the previous captcha image.

212.164.228.132 (talkcontribs)

Hi Gori! May be at your server outgoing requests are foridden. in this case keycaptcha cannot connet to server to check answer.
You should create kc-gettime.php file with
<?php
echo (gmdate("Y/m/d H:i:s",time()));
?>
content and specify it's path in keycaptcha.com>site list>settings>additional>allow outgoing requests.


I guess the fastest solution will be opening ticket at keycaptcha.com site
Regards, Andrey

This post was posted by 212.164.228.132, but signed as 123.23.21.32.

212.164.228.132 (talkcontribs)
197.89.4.103 (talkcontribs)
the key captcha is not appearing in the new registration process of my site, ONLY in the forgot password/username options. How do i fix this in order to stop dummy/fake registrations?
Reply to "KeyCaptcha not Working on Reg Page"
There are no older topics