mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 17:22:20 +09:00
Enable reCAPTCHA in document and comment write forms, and auto-insert reCAPTCHA if the form does not contain a placeholder
This commit is contained in:
parent
fe63f24617
commit
ae27414230
3 changed files with 63 additions and 23 deletions
|
|
@ -5,11 +5,21 @@ if (!defined('RX_BASEDIR') || !$addon_info->site_key || !$addon_info->secret_key
|
|||
return;
|
||||
}
|
||||
|
||||
if ($addon_info->use_signup === 'Y' && preg_match('/^(?:disp|proc)Member(?:SignUp|Insert)/i', Context::get('act')))
|
||||
$current_action = Context::get('act');
|
||||
|
||||
if ($addon_info->use_signup === 'Y' && preg_match('/^(?:disp|proc)Member(?:SignUp|Insert)/i', $current_action))
|
||||
{
|
||||
$enable_captcha = true;
|
||||
}
|
||||
elseif ($addon_info->use_recovery === 'Y' && preg_match('/^(?:disp|proc)Member(?:FindAccount|ResendAuthMail)/i', Context::get('act')))
|
||||
elseif ($addon_info->use_recovery === 'Y' && preg_match('/^(?:disp|proc)Member(?:FindAccount|ResendAuthMail)/i', $current_action))
|
||||
{
|
||||
$enable_captcha = true;
|
||||
}
|
||||
elseif ($addon_info->use_document === 'Y' && preg_match('/^(?:disp|proc)Board(Write|InsertDocument)/i', $current_action))
|
||||
{
|
||||
$enable_captcha = true;
|
||||
}
|
||||
elseif ($addon_info->use_comment === 'Y' && (preg_match('/^(?:disp|proc)Board(Content|InsertComment)/i', $current_action) || (!$current_action && Context::get('document_srl'))))
|
||||
{
|
||||
$enable_captcha = true;
|
||||
}
|
||||
|
|
@ -23,7 +33,7 @@ if ($enable_captcha)
|
|||
include_once __DIR__ . '/recaptcha.class.php';
|
||||
reCAPTCHA::init($addon_info);
|
||||
|
||||
if (strncasecmp('proc', Context::get('act'), 4) === 0)
|
||||
if (strncasecmp('proc', $current_action, 4) === 0)
|
||||
{
|
||||
getController('module')->addTriggerFunction('moduleObject.proc', 'before', 'reCAPTCHA::check');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue