mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Fix fatal error if CAPTCHA is configured but disabled
This commit is contained in:
parent
aaf3791a78
commit
04b158c544
2 changed files with 8 additions and 4 deletions
|
|
@ -337,8 +337,12 @@ class SpamfilterController extends Spamfilter
|
||||||
if (count($target_actions))
|
if (count($target_actions))
|
||||||
{
|
{
|
||||||
$captcha_class = 'Rhymix\\Modules\\Spamfilter\\Captcha\\' . $config->captcha->type;
|
$captcha_class = 'Rhymix\\Modules\\Spamfilter\\Captcha\\' . $config->captcha->type;
|
||||||
$captcha_class::init($config->captcha);
|
if (!class_exists($captcha_class))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$captcha_class::init($config->captcha);
|
||||||
if (strncasecmp('proc', $obj->act, 4) === 0)
|
if (strncasecmp('proc', $obj->act, 4) === 0)
|
||||||
{
|
{
|
||||||
$captcha_class::check();
|
$captcha_class::check();
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ class SpamfilterModel extends Spamfilter
|
||||||
{
|
{
|
||||||
$config = ModuleModel::getModuleConfig('spamfilter');
|
$config = ModuleModel::getModuleConfig('spamfilter');
|
||||||
$user = Context::get('logged_info');
|
$user = Context::get('logged_info');
|
||||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || $config->captcha->type === 'none' || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,7 @@ class SpamfilterModel extends Spamfilter
|
||||||
public static function getCaptcha($target_action = null)
|
public static function getCaptcha($target_action = null)
|
||||||
{
|
{
|
||||||
$config = ModuleModel::getModuleConfig('spamfilter');
|
$config = ModuleModel::getModuleConfig('spamfilter');
|
||||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || $config->captcha->type === 'none' || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -285,7 +285,7 @@ class SpamfilterModel extends Spamfilter
|
||||||
public static function checkCaptchaResponse(?string $response = null): void
|
public static function checkCaptchaResponse(?string $response = null): void
|
||||||
{
|
{
|
||||||
$config = ModuleModel::getModuleConfig('spamfilter');
|
$config = ModuleModel::getModuleConfig('spamfilter');
|
||||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || $config->captcha->type === 'none' || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||||
{
|
{
|
||||||
throw new Exception('msg_recaptcha_not_configured');
|
throw new Exception('msg_recaptcha_not_configured');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue