mirror of https://github.com/itflow-org/itflow
Beta Support for Dark Mode has been added to the theme options
This commit is contained in:
parent
4d71eb5de0
commit
e014e516e6
|
|
@ -10,6 +10,15 @@ require_once "includes/inc_all_admin.php";
|
|||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<h5>Dark Mode</h5>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" name="dark_mode" <?php if ($config_theme_dark == 1) { echo "checked"; } ?> value="1" onchange="this.form.submit()" id="darkModeSwitch">
|
||||
<label class="custom-control-label" for="darkModeSwitch">Enable Dark Mode</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Select a Theme</label>
|
||||
<div class="form-row">
|
||||
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
||||
|
|
|
|||
3
db.sql
3
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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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']);
|
||||
|
|
|
|||
|
|
@ -46,5 +46,9 @@ header("X-Frame-Options: DENY");
|
|||
<script src="plugins/toastr/toastr.min.js"></script>
|
||||
|
||||
</head>
|
||||
<body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed dark-moe accent-<?php if (isset($_GET['client_id'])) { echo "blue"; } else { echo nullable_htmlentities($config_theme); } ?>">
|
||||
<body class="
|
||||
hold-transition sidebar-mini layout-fixed layout-navbar-fixed
|
||||
accent-<?php if (isset($_GET['client_id'])) { echo "blue"; } else { echo nullable_htmlentities($config_theme); } ?>
|
||||
<?php if ($config_theme_dark) { echo "dark-mode"; } ?>
|
||||
">
|
||||
<div class="wrapper text-sm">
|
||||
|
|
|
|||
|
|
@ -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 <strong>$theme</strong>";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue