mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 23:03:25 +09:00
Reorganize CAPTCHA handling classes #2112
This commit is contained in:
parent
eb79a5c66f
commit
ef77af5a39
6 changed files with 94 additions and 84 deletions
|
|
@ -225,7 +225,7 @@ class spamfilterController extends spamfilter
|
|||
function triggerCheckCaptcha(&$obj)
|
||||
{
|
||||
$config = ModuleModel::getModuleConfig('spamfilter');
|
||||
if (!isset($config) || !isset($config->captcha) || !in_array($config->captcha->type, ['recaptcha','turnstile']) || !$config->captcha->site_key || !$config->captcha->secret_key)
|
||||
if (!isset($config) || !isset($config->captcha) || !in_array($config->captcha->type, ['recaptcha', 'turnstile']) || !$config->captcha->site_key || !$config->captcha->secret_key)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -260,16 +260,16 @@ class spamfilterController extends spamfilter
|
|||
|
||||
if (count($target_actions))
|
||||
{
|
||||
include_once __DIR__ . '/captcha/' . $config->captcha->type . '.php';
|
||||
spamfilter_captcha::init($config->captcha);
|
||||
$captcha_class = 'Rhymix\\Modules\\Spamfilter\\Captcha\\' . $config->captcha->type;
|
||||
$captcha_class::init($config->captcha);
|
||||
|
||||
if (strncasecmp('proc', $obj->act, 4) === 0)
|
||||
{
|
||||
spamfilter_captcha::check();
|
||||
$captcha_class::check();
|
||||
}
|
||||
else
|
||||
{
|
||||
$captcha = new spamfilter_captcha();
|
||||
$captcha = new $captcha_class();
|
||||
$captcha->setTargetActions($target_actions);
|
||||
$captcha->addScripts();
|
||||
Context::set('captcha', $captcha);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue