disable_registration = true; } else { if (botblockr_recaptcha_set()) { // Override registration form set_view_location('account/forms/register', $CONFIG->path . 'mod/botblockr/views/'); // Override registration action register_action("register", true, $CONFIG->pluginspath . 'botblockr/actions/recaptcha_register.php'); // Unregister captcha hook unregister_plugin_hook('action', 'register', 'captcha_verify_action_hook'); } } } function botblockr_do_fallback() { if (botblockr_recaptcha_set()) { return false; } return true; } function botblockr_recaptcha_set() { if (botblockr_get_public_key() && botblockr_get_private_key()) { return true; } return false; } function botblockr_get_public_key() { return get_plugin_setting('recaptcha_key_public', 'botblockr'); } function botblockr_get_private_key() { return get_plugin_setting('recaptcha_key_private', 'botblockr'); } function botblockr_handle_recaptcha_error($code) { /*translation:Something is wrong with CAPTCHA. Please contact site administrator.*/ $answer = elgg_echo('botblockr:recaptcha_unknown_error'); switch($code) { case "invalid-site-public-key": /*translation:CAPTCHA public key seems to be invalid. Please contact site administrator.*/ $answer = elgg_echo('botblockr:recaptcha_invalid_public_key'); break; case "invalid-site-private-key": /*translation:CAPTCHA private key seems to be invalid. Please contact site administrator.*/ $answer = elgg_echo('botblockr:recaptcha_invalid_private_key'); break; case "invalid-request-cookie": /*translation:CAPTCHA challenge parameter of the verify script was incorrect. Please contact site administrator.*/ $answer = elgg_echo('botblockr:recaptcha_invalid_request_cookie'); break; case "incorrect-captcha-sol": /*translation:Sorry, the text that you entered did not match the text in the image.*/ $answer = elgg_echo('botblockr:recaptcha_incorrect_captcha_sol'); break; case "verify-params-incorrect": /*translation:CAPTCHA parameters to verify were incorrect. Please contact site administrator.*/ $answer = elgg_echo('botblockr:recaptcha_verify_params_incorrect'); break; case "invalid-referrer": /*translation:CAPTCHA keys provided do not belong to a domain of usage. Please contact site administrator.*/ $answer = elgg_echo('botblockr:recaptcha_invalid_referrer'); break; case "recaptcha-not-reachable": /*translation:CAPTCHA verify server unreachable. Please contact site administrator.*/ $answer = elgg_echo('botblockr:recaptcha_not_reachable'); break; default: /*translation:Something is wrong with CAPTCHA. Please contact site administrator.*/ $answer = elgg_echo('botblockr:recaptcha_unknown_error'); break; } return $answer; } function botblockr_fake_set() { if (botblockr_get_fake_name()) { return true; } return false; } function botblockr_get_fake_name() { return get_plugin_setting('fake_field_name', 'botblockr'); } function botblockr_site_password_set() { if (botblockr_get_site_password()) { return true; } return false; } function botblockr_get_site_password() { return get_plugin_setting('site_password', 'botblockr'); } function botblockr_get_split_names() { return get_plugin_setting('split_names', 'botblockr'); } function botblockr_split_names_set() { if (botblockr_get_split_names() == 1) { return true; } return false; } // Initialize register_elgg_event_handler('init', 'system', 'botblockr_init'); ?>