mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
Migrate Dark/light mode to a user settings instead of global setting, created new include called router.php to dynamically prepend ../../ to asset pathes based off currect directory depth
This commit is contained in:
@@ -3821,6 +3821,13 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.7'");
|
||||
}
|
||||
|
||||
if (CURRENT_DATABASE_VERSION == '2.2.7') {
|
||||
mysqli_query($mysqli, "ALTER TABLE `user_settings` ADD `user_config_theme_dark` TINYINT(1) NOT NULL DEFAULT 0 AFTER `user_config_signature`");
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` DROP `config_theme_dark`");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.8'");
|
||||
}
|
||||
|
||||
/* 2025-07-21 - JQ For next release Pauyment Provider Switch Over
|
||||
if (CURRENT_DATABASE_VERSION == '2.2.4') {
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
require_once "../config.php";
|
||||
require_once "../functions.php";
|
||||
require_once "../includes/router.php";
|
||||
require_once "../includes/check_login.php";
|
||||
require_once "../includes/page_title.php";
|
||||
if (!isset($session_is_admin) || !$session_is_admin) {
|
||||
|
||||
@@ -6,11 +6,9 @@ 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', config_theme_dark = $dark_mode WHERE company_id = 1");
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_theme = '$theme' WHERE company_id = 1");
|
||||
|
||||
logAction("Settings", "Edit", "$session_name edited theme settings $dark_mode");
|
||||
|
||||
|
||||
@@ -10,15 +10,6 @@ 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">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user