aboutsummaryrefslogtreecommitdiff
path: root/mod/captcha/start.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-05-11 08:41:26 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-05-11 08:41:26 +0000
commit8bdc2c56d1b1ef6234e44ad941b25bdaa1979793 (patch)
tree2d679e3f6c837200523e83cb1e54974b81253bef /mod/captcha/start.php
parent7152b2616eace9c125f088304a901370fb6ce438 (diff)
downloadelgg-8bdc2c56d1b1ef6234e44ad941b25bdaa1979793.tar.gz
elgg-8bdc2c56d1b1ef6234e44ad941b25bdaa1979793.tar.bz2
Captcha list can now be extended by other plugins
git-svn-id: https://code.elgg.org/elgg/trunk@3273 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/captcha/start.php')
-rw-r--r--mod/captcha/start.php35
1 files changed, 32 insertions, 3 deletions
diff --git a/mod/captcha/start.php b/mod/captcha/start.php
index 26e8671d2..982a01c2c 100644
--- a/mod/captcha/start.php
+++ b/mod/captcha/start.php
@@ -25,9 +25,18 @@
// Default length
$CONFIG->captcha_length = 5;
- // Right, these actions require captcha validation TODO: Put this in config somehow
- register_plugin_hook("action", "register", "captcha_verify_action_hook");
- register_plugin_hook("action", "user/requestnewpassword", "captcha_verify_action_hook");
+ // Register a function that provides some default override actions
+ register_plugin_hook('actionlist', 'captcha', 'captcha_actionlist_hook');
+
+ // Register actions to intercept
+ $actions = array();
+ $actions = trigger_plugin_hook('actionlist', 'captcha', null, $actions);
+
+ if (($actions) && (is_array($actions)))
+ {
+ foreach ($actions as $action)
+ register_plugin_hook("action", $action, "captcha_verify_action_hook");
+ }
}
function captcha_page_handler($page)
@@ -108,5 +117,25 @@
return false;
}
+ /**
+ * This function returns an array of actions the captcha will expect a captcha for, other plugins may
+ * add their own to this list thereby extending the use.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ */
+ function captcha_actionlist_hook($hook, $entity_type, $returnvalue, $params)
+ {
+ if (!is_array($returnvalue))
+ $returnvalue = array();
+
+ $returnvalue[] = 'register';
+ $returnvalue[] = 'user/requestnewpassword';
+
+ return $returnvalue;
+ }
+
register_elgg_event_handler('init','system','captcha_init');
?> \ No newline at end of file