From bb741539f6b99734c8a247dbc23cd0b1520ae529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?= Date: Wed, 21 Feb 2024 21:41:11 +0100 Subject: [PATCH] Update in code structure --- includes/filters.php | 2 +- modules/firstusage/classes/Security.class.php | 32 ++++++++++++------- modules/security/classes/Security.class.php | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/includes/filters.php b/includes/filters.php index dce19a7..42b1702 100644 --- a/includes/filters.php +++ b/includes/filters.php @@ -2,7 +2,7 @@ add_action( 'plugins_loaded', 'bdp_kompass_load_plugin_textdomain' ); -register_activation_hook(__FILE__, 'bdp_plugin_install'); +register_activation_hook(BDP_LV_STARTUP_FILE, 'bdp_plugin_install'); add_action('init', 'bdp_plugin_init'); diff --git a/modules/firstusage/classes/Security.class.php b/modules/firstusage/classes/Security.class.php index 9735d4b..da7af89 100644 --- a/modules/firstusage/classes/Security.class.php +++ b/modules/firstusage/classes/Security.class.php @@ -8,28 +8,36 @@ use ZipArchive; class Security { - public const required_security_plugins = [ - 'wps_hide_login' => ['downloadUrl' => 'https://downloads.wordpress.org/plugin/wps-hide-login.1.9.10.zip'], - ]; + public const required_security_plugins = []; public const delete_plugins = [ 'akismet/akismet.php', 'hello.php', - 'limit-login-attempts-reloaded' + 'limit-login-attempts-reloaded', + 'wps-hide-login/wps-hide-login.php' ]; public static function setup() { - self::deletePlugins(); - foreach (self::required_security_plugins as $pluginSlug => $pluginData) { - if (!is_dir(WP_PLUGIN_DIR . '/' . $pluginSlug)) { - self::installSecurityPlugin($pluginSlug, $pluginData['downloadUrl']); - } - } + self::deletePlugins(); + foreach (self::required_security_plugins as $pluginSlug => $pluginData) { + if (!is_dir(WP_PLUGIN_DIR . '/' . $pluginSlug)) { + self::installSecurityPlugin($pluginSlug, $pluginData['downloadUrl']); + } + } - $loginUrl = get_option('whl_page', 'bdp_login'); - update_option('whl_page', $loginUrl); + $loginUrl = get_option('whl_page', null) ?? 'bdp-login'; + enable_option_rewrite_url($loginUrl); + enable_option_disable_xmlrpc(); + enable_option_block_authorscan(); + enable_option_block_execution_in_uploads(); + enable_option_prohibit_special_files(); + enable_option_file_editor(); + enable_option_disable_conatenation(); + enable_option_secure_include_dir(); + enable_option_prohibit_bot_access(); + enable_option_block_directory_listing(); } diff --git a/modules/security/classes/Security.class.php b/modules/security/classes/Security.class.php index 60d38e6..a16acfb 100644 --- a/modules/security/classes/Security.class.php +++ b/modules/security/classes/Security.class.php @@ -11,7 +11,7 @@ class Security public const delete_plugins = [ 'akismet/akismet.php', 'hello.php', - 'wps_hide_login', + 'wps-hide-login/wps-hide-login.php', 'limit-login-attempts-reloaded' ];