From 40a3b93d4be1bb6ed27b8790a1ddf8da9a1161e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20G=C3=BCnther?=
Date: Tue, 27 Feb 2024 11:33:24 +0100
Subject: [PATCH] Created setup environment
---
bdp-kompass.php | 14 ++--
modules/firstusage/classes/Security.class.php | 84 -------------------
modules/firstusage/internal/index.php | 22 -----
modules/firstusage/security.php | 3 -
modules/security/classes/Security.class.php | 18 +++-
modules/security/includes/settings_writer.php | 6 +-
6 files changed, 25 insertions(+), 122 deletions(-)
delete mode 100644 modules/firstusage/classes/Security.class.php
delete mode 100644 modules/firstusage/internal/index.php
delete mode 100644 modules/firstusage/security.php
diff --git a/bdp-kompass.php b/bdp-kompass.php
index fd253ce..e29e533 100644
--- a/bdp-kompass.php
+++ b/bdp-kompass.php
@@ -19,10 +19,7 @@ use Bdp\Modules\Seo\Seo;
require_once dirname(__FILE__) . '/includes/setup.php';
function bdp_plugin_install() {
- Seo::setup();
- Calendar::setup();
- Security::setup();
- update_option('kompass_installation', true);
+
}
@@ -30,11 +27,14 @@ function bdp_plugin_init() {
Security::ProhibitBots();
Security::SetPageFilters();
- remove_menu_page( 'admin.php?page=limit-login-attempts&tab=dashboard' );
- if ( get_option( 'kompass_installation' ) == true ) {
- delete_option( 'kompass_installation' );
+ if (null == get_option('kompass_already_installed', null)) {
+ Seo::setup();
+ Calendar::setup();
+ Security::setup();
+ update_option('kompass_already_installed', true);
wp_redirect( 'site-health.php?tab=bdp_enhanced_security');
}
+
}
add_action('admin_menu', function () {
diff --git a/modules/firstusage/classes/Security.class.php b/modules/firstusage/classes/Security.class.php
deleted file mode 100644
index da7af89..0000000
--- a/modules/firstusage/classes/Security.class.php
+++ /dev/null
@@ -1,84 +0,0 @@
- $pluginData) {
- if (!is_dir(WP_PLUGIN_DIR . '/' . $pluginSlug)) {
- self::installSecurityPlugin($pluginSlug, $pluginData['downloadUrl']);
- }
- }
-
- $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();
-
- }
-
- public static function deletePlugins() {
- deactivate_plugins(self::delete_plugins);
- delete_plugins(self::delete_plugins);
- }
-
-
- public static function installSecurityPlugin(string $pluginSlug, string $downloadUrl) : bool
- {
- $ch = curl_init();
- $source = $downloadUrl;
- curl_setopt($ch, CURLOPT_URL, $source);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $data = curl_exec ($ch);
- curl_close ($ch);
-
- $destination = WP_PLUGIN_DIR . '/' . $pluginSlug . '.zip';
- $file = fopen($destination, "w+");
- fputs($file, $data);
- fclose($file);
-
- $zip = new ZipArchive();
- $zip->open($destination);
- $zip->extractTo(WP_PLUGIN_DIR);
- $zip->close();
- unlink($destination);
-
- $pluginInfos = get_plugins( '/'.$pluginSlug );
- $installfile = $pluginSlug . '/';
- if( ! empty( $pluginInfos ) ) {
- foreach ($pluginInfos as $file => $info) :
- $installfile .= $file;
- endforeach;
- }
-
-
-
- $result = activate_plugin($installfile);
-
- return $result === null;
- }
-}
\ No newline at end of file
diff --git a/modules/firstusage/internal/index.php b/modules/firstusage/internal/index.php
deleted file mode 100644
index 731ff16..0000000
--- a/modules/firstusage/internal/index.php
+++ /dev/null
@@ -1,22 +0,0 @@
-';
-echo 'Installation erfolgreich!
';
-
-?>
-
-
-
diff --git a/modules/firstusage/security.php b/modules/firstusage/security.php
deleted file mode 100644
index 455ff9a..0000000
--- a/modules/firstusage/security.php
+++ /dev/null
@@ -1,3 +0,0 @@
-