diff --git a/admin_settings_theme.php b/admin_settings_theme.php index c15bd49f..b3f70c9c 100644 --- a/admin_settings_theme.php +++ b/admin_settings_theme.php @@ -10,6 +10,15 @@ require_once "includes/inc_all_admin.php";
+
Dark Mode
+ +
+
+ value="1" onchange="this.form.submit()" id="darkModeSwitch"> + +
+
+
diff --git a/database_updates.php b/database_updates.php index 990e6993..0a23409c 100644 --- a/database_updates.php +++ b/database_updates.php @@ -3799,6 +3799,11 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.4'"); } + if (CURRENT_DATABASE_VERSION == '2.2.4') { + mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_theme_dark` TINYINT(1) NOT NULL DEFAULT 0 AFTER `config_theme`"); + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.5'"); + } + /* 2025-07-21 - JQ For next release Pauyment Provider Switch Over if (CURRENT_DATABASE_VERSION == '2.2.4') { diff --git a/db.sql b/db.sql index 3e8e88d4..bc7f3677 100644 --- a/db.sql +++ b/db.sql @@ -2051,6 +2051,7 @@ CREATE TABLE `settings` ( `config_log_retention` int(11) NOT NULL DEFAULT 90, `config_module_enable_ticketing` tinyint(1) NOT NULL DEFAULT 1, `config_theme` varchar(200) DEFAULT 'blue', + `config_theme_dark` tinyint(1) NOT NULL DEFAULT 0, `config_telemetry` tinyint(1) DEFAULT 0, `config_timezone` varchar(200) NOT NULL DEFAULT 'America/New_York', `config_destructive_deletes_enable` tinyint(1) NOT NULL DEFAULT 0, @@ -2759,4 +2760,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-07-24 11:29:27 +-- Dump completed on 2025-07-24 14:57:42 diff --git a/includes/database_version.php b/includes/database_version.php index e2bfd96b..0e45ae58 100644 --- a/includes/database_version.php +++ b/includes/database_version.php @@ -5,4 +5,4 @@ * It is used in conjunction with database_updates.php */ -DEFINE("LATEST_DATABASE_VERSION", "2.2.4"); +DEFINE("LATEST_DATABASE_VERSION", "2.2.5"); diff --git a/includes/get_settings.php b/includes/get_settings.php index e4b31087..8593d760 100644 --- a/includes/get_settings.php +++ b/includes/get_settings.php @@ -128,7 +128,7 @@ $config_time_format = "H:i"; // Theme $config_theme = $row['config_theme']; -$config_theme_mode = "dark_mode"; +$config_theme_dark = intval($row['config_theme_dark']); // Telemetry $config_telemetry = intval($row['config_telemetry']); diff --git a/includes/header.php b/includes/header.php index 402a2c20..565a0df1 100644 --- a/includes/header.php +++ b/includes/header.php @@ -46,5 +46,9 @@ header("X-Frame-Options: DENY"); -"> + + +">
diff --git a/post/admin/admin_settings_theme.php b/post/admin/admin_settings_theme.php index a539bed3..1af45c7a 100644 --- a/post/admin/admin_settings_theme.php +++ b/post/admin/admin_settings_theme.php @@ -6,12 +6,14 @@ if (isset($_POST['edit_theme_settings'])) { validateCSRFToken($_POST['csrf_token']); + $dark_mode = intval($_POST['dark_mode'] ?? 0); + $theme = preg_replace("/[^0-9a-zA-Z-]/", "", sanitizeInput($_POST['edit_theme_settings'])); - mysqli_query($mysqli,"UPDATE settings SET config_theme = '$theme' WHERE company_id = 1"); + mysqli_query($mysqli,"UPDATE settings SET config_theme = '$theme', config_theme_dark = $dark_mode WHERE company_id = 1"); // Logging - logAction("Settings", "Edit", "$session_name edited theme settings"); + logAction("Settings", "Edit", "$session_name edited theme settings $dark_mode"); $_SESSION['alert_message'] = "Changed theme to $theme";