[BS5] remove ui theme selector - add darkmode toggler

This commit is contained in:
FreddleSpl0it
2022-06-23 16:34:58 +02:00
parent 560df58bb4
commit 052959f435
38 changed files with 233 additions and 286379 deletions

View File

@@ -117,20 +117,6 @@ function customize($_action, $_item, $_data = null) {
$ui_announcement_type = (in_array($_data['ui_announcement_type'], array('info', 'warning', 'danger'))) ? $_data['ui_announcement_type'] : false;
$ui_announcement_active = (!empty($_data['ui_announcement_active']) ? 1 : 0);
// check theme
$theme = strtolower($_data['ui_theme']);
$themes = array_diff(scandir('/web/css/themes'), array('..', '.'));
$themes = array_filter((str_replace("-bootstrap.css", "", $themes)));
if (!in_array($theme, $themes)){
// err, theme not found
$_SESSION['return'][] = array(
'type' => 'danger',
'log' => array(__FUNCTION__, $_action, $_item, $_data),
'msg' => "Theme not found"
);
return false;
}
try {
$redis->set('TITLE_NAME', htmlspecialchars($title_name));
$redis->set('MAIN_NAME', htmlspecialchars($main_name));
@@ -140,7 +126,6 @@ function customize($_action, $_item, $_data = null) {
$redis->set('UI_ANNOUNCEMENT_TEXT', $ui_announcement_text);
$redis->set('UI_ANNOUNCEMENT_TYPE', $ui_announcement_type);
$redis->set('UI_ANNOUNCEMENT_ACTIVE', $ui_announcement_active);
$redis->set('UI_THEME', $theme);
}
catch (RedisException $e) {
$_SESSION['return'][] = array(
@@ -244,19 +229,6 @@ function customize($_action, $_item, $_data = null) {
return false;
}
break;
case 'ui_theme':
try {
return $redis->get('UI_THEME');
}
catch (RedisException $e) {
$_SESSION['return'][] = array(
'type' => 'danger',
'log' => array(__FUNCTION__, $_action, $_item, $_data),
'msg' => array('redis_error', $e)
);
return false;
}
break;
case 'main_logo_specs':
try {
$image = new Imagick();

View File

@@ -252,7 +252,8 @@ $css_minifier = new CSSminifierExtended();
$css_dir = array_diff(scandir('/web/css/build'), array('..', '.'));
// get customized ui data
$UI_TEXTS = customize('get', 'ui_texts');
$UI_THEME = customize('get', 'ui_theme');
// minify bootstrap theme
if (file_exists('/web/css/themes/'.$UI_THEME.'-bootstrap.css'))
$css_minifier->add('/web/css/themes/'.$UI_THEME.'-bootstrap.css');

View File

@@ -104,6 +104,11 @@ $AVAILABLE_LANGUAGES = array(
'zh' => '中文 (Chinese)'
);
// default theme is lumen
// additional themes can be found here: https://bootswatch.com/
// copy them to data/web/css/themes/{THEME-NAME}-bootstrap.css
$UI_THEME = "lumen";
// Show DKIM private keys - false by default
$SHOW_DKIM_PRIV_KEYS = false;