Enable customizing target users and frequency

This commit is contained in:
Kijin Sung 2016-06-08 01:05:38 +09:00
parent d13bf13bc9
commit a2e54ed759
2 changed files with 15 additions and 5 deletions

View file

@ -6,8 +6,21 @@ if (!defined('RX_BASEDIR') || !$addon_info->site_key || !$addon_info->secret_key
} }
$current_action = Context::get('act'); $current_action = Context::get('act');
$current_member = Context::get('logged_info');
if ($addon_info->use_signup === 'Y' && preg_match('/^(?:disp|proc)Member(?:SignUp|Insert)/i', $current_action)) if ($current_member->is_admin === 'Y')
{
$enable_captcha = false;
}
elseif ($addon_info->target_users !== 'everyone' && $current_member->member_srl)
{
$enable_captcha = false;
}
elseif ($addon_info->target_frequency !== 'every_time' && isset($_SESSION['recaptcha_authenticated']) && $_SESSION['recaptcha_authenticated'])
{
$enable_captcha = false;
}
elseif ($addon_info->use_signup === 'Y' && preg_match('/^(?:disp|proc)Member(?:SignUp|Insert)/i', $current_action))
{ {
$enable_captcha = true; $enable_captcha = true;
} }
@ -42,7 +55,3 @@ if ($enable_captcha)
Context::set('captcha', new reCAPTCHA()); Context::set('captcha', new reCAPTCHA());
} }
} }
else
{
return;
}

View file

@ -38,6 +38,7 @@ class reCAPTCHA
} }
else else
{ {
$_SESSION['recaptcha_authenticated'] = true;
return true; return true;
} }
} }