diff --git a/includes/themes.php b/includes/themes.php index ffeb203f..82de4aed 100755 --- a/includes/themes.php +++ b/includes/themes.php @@ -5,22 +5,17 @@ */ function DisplayThemeConfig() { + $themes = [ + "default" => "RaspAP (default)", + "hackernews" => "HackerNews", + "terminal" => "Terminal" + ]; + $themeFiles = [ + "default" => "custom.css", + "hackernews" => "hackernews.css", + "terminal" => "terminal.css" + ]; + $selectedTheme = array_search($_COOKIE['theme'], $themeFiles); - $cselected = ''; - $hselected = ''; - $tselected = ''; - - switch ($_COOKIE['theme']) { - case "custom.css": - $cselected = ' selected="selected"'; - break; - case "hackernews.css": - $hselected = ' selected="selected"'; - break; - case "terminal.css": - $tselected = ' selected="selected"'; - break; - } - - echo renderTemplate("themes", compact("cselected", "hselected", "tselected")); + echo renderTemplate("themes", compact("themes", "selectedTheme")); } diff --git a/templates/themes.php b/templates/themes.php index ab0b090c..1a4d41a8 100644 --- a/templates/themes.php +++ b/templates/themes.php @@ -9,11 +9,7 @@
- +