refactor(admin): consolidate duplicate configuration
Remove duplicate comment, captcha, filing, and website-security configuration paths. Move front submission verification to the captcha scene matrix and retire obsolete admin routes and components.
This commit is contained in:
@@ -306,10 +306,10 @@ class SchemaProvider {
|
||||
}
|
||||
}
|
||||
|
||||
// Captcha: always surface normalized enabled_scenarios (legacy disabled list inverted).
|
||||
if ($option_key === 'aksrt_captcha_config' && function_exists('aksrt_get_captcha_config')) {
|
||||
$normalized = aksrt_get_captcha_config();
|
||||
foreach (['enabled', 'active_provider', 'enabled_scenarios', 'disabled_scenarios', 'tencent', 'aliyun', 'cloudflare', 'geetest', 'mode'] as $key) {
|
||||
// Captcha: always surface the normalized positive scene list.
|
||||
if ($option_key === 'aksrt_captcha_config' && function_exists('aksrt_get_captcha_config')) {
|
||||
$normalized = aksrt_get_captcha_config();
|
||||
foreach (['enabled', 'active_provider', 'enabled_scenarios', 'tencent', 'aliyun', 'cloudflare', 'geetest', 'mode'] as $key) {
|
||||
if (array_key_exists($key, $normalized)) {
|
||||
$data[$key] = $normalized[$key];
|
||||
}
|
||||
@@ -340,23 +340,12 @@ class SchemaProvider {
|
||||
unset($stored['pay_rebate_withdraw_text_details'], $stored['pay_balance_withdraw_lowest_money']);
|
||||
}
|
||||
|
||||
// Captcha: keep enabled_scenarios / disabled_scenarios mirrors in sync.
|
||||
if ($option_key === 'aksrt_captcha_config' && function_exists('aksrt_captcha_scenes')) {
|
||||
$all = array_keys(aksrt_captcha_scenes());
|
||||
if (array_key_exists('enabled_scenarios', $stored)) {
|
||||
$enabled = function_exists('aksrt_captcha_sanitize_scene_list')
|
||||
? aksrt_captcha_sanitize_scene_list($stored['enabled_scenarios'])
|
||||
: (array) $stored['enabled_scenarios'];
|
||||
$stored['enabled_scenarios'] = $enabled;
|
||||
$stored['disabled_scenarios'] = array_values(array_diff($all, $enabled));
|
||||
} elseif (array_key_exists('disabled_scenarios', $stored)) {
|
||||
$disabled = function_exists('aksrt_captcha_sanitize_scene_list')
|
||||
? aksrt_captcha_sanitize_scene_list($stored['disabled_scenarios'])
|
||||
: (array) $stored['disabled_scenarios'];
|
||||
$stored['disabled_scenarios'] = $disabled;
|
||||
$stored['enabled_scenarios'] = array_values(array_diff($all, $disabled));
|
||||
}
|
||||
}
|
||||
// Captcha stores a single positive scene list.
|
||||
if ($option_key === 'aksrt_captcha_config' && function_exists('aksrt_captcha_scenes')) {
|
||||
$stored['enabled_scenarios'] = function_exists('aksrt_captcha_sanitize_scene_list')
|
||||
? aksrt_captcha_sanitize_scene_list($stored['enabled_scenarios'] ?? [])
|
||||
: (array) ($stored['enabled_scenarios'] ?? []);
|
||||
}
|
||||
|
||||
$updated = update_option($option_key, $stored);
|
||||
\AKSRT\Settings\Settings::flush_settings_cache();
|
||||
|
||||
Reference in New Issue
Block a user