From eb18294ec25919b9afa819f887fcda6767f90a9d Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 13 Dec 2024 10:05:28 +0100 Subject: [PATCH] allow passwordless db setup --- install/includes/core/core_class.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/install/includes/core/core_class.php b/install/includes/core/core_class.php index a9c80a215..ad5505845 100644 --- a/install/includes/core/core_class.php +++ b/install/includes/core/core_class.php @@ -24,13 +24,6 @@ class Core $errors[] = "DB Username is missing."; } - // Validate the password - if (isset($data['db_password']) and !empty($data['db_password'])) { - $counter++; - } else { - $errors[] = "DB Password is missing."; - } - // Validate the database if (isset($data['db_name']) and !empty($data['db_name'])) { $counter++; @@ -119,7 +112,7 @@ class Core } // Check if all the required fields have been entered - if ($counter == '14') { + if ($counter == 13) { log_message('info', 'Data validation passed.'); return true; } else { @@ -157,8 +150,8 @@ class Core log_message('info', 'database.php template file read successfully.'); // Sanitize DB Password from single quotes - $sanitized_db_pwd = preg_replace("/\\\\/i",'\\\\\\\\',$data['db_password']); // Escape the Escape char ( '\' becomes '\\' ) - $sanitized_db_pwd = preg_replace("/\'/i",'\\\\\'',$sanitized_db_pwd); // Escape the ' ( ' becomes \' ) + $sanitized_db_pwd = preg_replace("/\\\\/i",'\\\\\\\\',$data['db_password'] ?? ''); // Escape the Escape char ( '\' becomes '\\' ) + $sanitized_db_pwd = preg_replace("/\'/i",'\\\\\'',$sanitized_db_pwd); // Escape the ' ( ' becomes \' ) $new = str_replace("%HOSTNAME%", $data['db_hostname'], $database_file); $new = str_replace("%USERNAME%", $data['db_username'], $new);