mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-06-15 20:25:16 +02:00
Added in preferences light or dark theme (#539)
Added in the preferences option to change the light or dark theme, Now to change the theme will be in the preferences / settings area, along with other settings, and may even have other themes in the future.
This commit is contained in:
parent
c5d481c5cc
commit
db3f4c01ea
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
//Default Configuration
|
||||
$CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false}';
|
||||
$CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false,"theme":"light"}';
|
||||
|
||||
/**
|
||||
* H3K | Tiny File Manager V2.4.5
|
||||
|
@ -29,10 +29,6 @@ $auth_users = array(
|
|||
'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345
|
||||
);
|
||||
|
||||
//set application theme
|
||||
//options - 'light' and 'dark'
|
||||
$theme = 'light';
|
||||
|
||||
// Readonly users
|
||||
// e.g. array('users', 'guest', ...)
|
||||
$readonly_users = array(
|
||||
|
@ -141,8 +137,6 @@ if (is_readable($config_file)) {
|
|||
// max upload file size
|
||||
define('MAX_UPLOAD_SIZE', $max_upload_size_bytes);
|
||||
|
||||
define('FM_THEME', $theme);
|
||||
|
||||
// private key and session name to store to the session
|
||||
if ( !defined( 'FM_SESSION_ID')) {
|
||||
define('FM_SESSION_ID', 'filemanager');
|
||||
|
@ -166,6 +160,11 @@ $hide_Cols = isset($cfg->data['hide_Cols']) ? $cfg->data['hide_Cols'] : true;
|
|||
// Show directory size: true or speedup output: false
|
||||
$calc_folder = isset($cfg->data['calc_folder']) ? $cfg->data['calc_folder'] : true;
|
||||
|
||||
// Theme
|
||||
$theme = isset($cfg->data['theme']) ? $cfg->data['theme'] : 'light';
|
||||
|
||||
define('FM_THEME', $theme);
|
||||
|
||||
//available languages
|
||||
$lang_list = array(
|
||||
'en' => 'English'
|
||||
|
@ -473,7 +472,7 @@ if (isset($_POST['ajax']) && !FM_READONLY) {
|
|||
|
||||
// Save Config
|
||||
if (isset($_POST['type']) && $_POST['type'] == "settings") {
|
||||
global $cfg, $lang, $report_errors, $show_hidden_files, $lang_list, $hide_Cols, $calc_folder;
|
||||
global $cfg, $lang, $report_errors, $show_hidden_files, $lang_list, $hide_Cols, $calc_folder, $theme;
|
||||
$newLng = $_POST['js-language'];
|
||||
fm_get_translations([]);
|
||||
if (!array_key_exists($newLng, $lang_list)) {
|
||||
|
@ -484,6 +483,7 @@ if (isset($_POST['ajax']) && !FM_READONLY) {
|
|||
$shf = isset($_POST['js-show-hidden']) && $_POST['js-show-hidden'] == "true" ? true : false;
|
||||
$hco = isset($_POST['js-hide-cols']) && $_POST['js-hide-cols'] == "true" ? true : false;
|
||||
$caf = isset($_POST['js-calc-folder']) && $_POST['js-calc-folder'] == "true" ? true : false;
|
||||
$te3 = $_POST['js-theme-3'];
|
||||
|
||||
if ($cfg->data['lang'] != $newLng) {
|
||||
$cfg->data['lang'] = $newLng;
|
||||
|
@ -509,6 +509,10 @@ if (isset($_POST['ajax']) && !FM_READONLY) {
|
|||
$cfg->data['calc_folder'] = $caf;
|
||||
$calc_folder = $caf;
|
||||
}
|
||||
if ($cfg->data['theme'] != $te3) {
|
||||
$cfg->data['theme'] = $te3;
|
||||
$theme = $te3;
|
||||
}
|
||||
$cfg->save();
|
||||
echo true;
|
||||
}
|
||||
|
@ -1436,6 +1440,16 @@ if (isset($_GET['settings']) && !FM_READONLY) {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="js-3-1" class="col-sm-3 col-form-label"><?php echo lng('Theme') ?></label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control" id="js-3-0" name="js-theme-3" style="width:100px;">
|
||||
<option value='light' <?php if($theme == "light"){echo "selected";} ?>><?php echo lng('light') ?></option>
|
||||
<option value='dark' <?php if($theme == "dark"){echo "selected";} ?>><?php echo lng('dark') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-10">
|
||||
<button type="submit" class="btn btn-success"> <i class="fa fa-check-circle"></i> <?php echo lng('Save'); ?></button>
|
||||
|
|
Loading…
Reference in a new issue