CMS MADE SIMPLE FORGE

Captcha

 

[#9145] Request to include my updates to allow Captcha to read captcha libraries from module_custom

avatar
Created By: Wayne ONeil (wishbone)
Date Submitted: 2013-04-14 23:07

Assigned To: Nuno Costa (nuno)
Resolution: None
State: Open
Summary:
Request to include my updates to allow Captcha to read captcha libraries from module_custom
Detailed Description:
A client of mine requested that I create a new captcha module that asked
questions, like "What color is the sun", etc, randomly from a list. Since they
wanted this module to be compatible with modules that used Captcha, the only way
would be to add this functionality to Captcha itself. I was very pleased how
modular this module is and how easy it was to add my feature, even though the
requested feature didn't use images.

However, for upgradability, I would rather drop my new captchalib class into
module_custom/Captcha/libs/classes/captchalibs, so that an upgrade wouldn't
overwrite the class I added. I have made a simple change to loadLibs() to scan
module_custom as well. I also added a 'textarea' option type, so that the site
owner can manage his own list of questions/answers. Modified files:

lib/classes/module/class.captcha.php    (for module_custom and textarea
creation)
action.save_captcha_options.php (for saving textarea)

my updated XML: http://teamwishbone.com/Captcha-0.4.6.xml

test install with working demo: http://castiron.teamwishbone.com/

On a side note, I have another copy of Captcha that I modified to read captcha
libraries from other modules. This way module developers can develop captcha
modules that users can download from the module manager, and be compatible with
Captcha. I modified the code to test all modules for $module->IsCaptcha() ==
true (including the Captcha module) .. The loadLibs() code reads all 'captcha'
module's lib/classes/captchalibs directories for all available captcha
libraries. The only sticking point is that I'm trying to make the code use the
other module's preferences (GetPreferences/SavePreferences), so that if the
module is removed, you won't have their options sticking around. Let me know if
you're interested.

Wayne

History