diff --git a/action.php b/action.php index 7fd4d04..a539035 100644 --- a/action.php +++ b/action.php @@ -30,6 +30,35 @@ function returnToSender($msg, $arg = "") { } switch ($VARS['action']) { + case "sitesettings": + if (!$database->has("sites", ["siteid" => $VARS['siteid']])) { + returnToSender("invalid_parameters"); + } + if (is_empty($VARS['name'])) { + returnToSender("invalid_parameters"); + } + if (is_empty($VARS['url'])) { + returnToSender("invalid_parameters"); + } + if (is_empty($VARS['theme'])) { + returnToSender("invalid_parameters"); + } + if (is_empty($VARS['color'])) { + returnToSender("invalid_parameters"); + } + $theme = preg_replace("/[^A-Za-z0-9]/", '', $VARS['theme']); + $color = preg_replace("/[^A-Za-z0-9]/", '', $VARS['color']); + if (!file_exists(__DIR__ . "/public/themes/$theme/theme.json")) { + returnToSender("invalid_parameters"); + } + if ($color != "default" && !file_exists(__DIR__ . "/public/themes/$theme/colors/$color")) { + returnToSender("invalid_parameters"); + } + $database->update('sites', + ["sitename" => $VARS['name'], "url" => $VARS['url'], "theme" => $theme, "color" => $color], + ["siteid" => $VARS['siteid']]); + returnToSender("settings_saved"); + break; case "saveedits": header("Content-Type: application/json"); $slug = $VARS['slug']; diff --git a/lang/en_us.php b/lang/en_us.php index 6b0116c..5eadb88 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -46,6 +46,7 @@ define("STRINGS", [ "save" => "Save", "edit" => "Edit", "view" => "View", + "preview" => "Preview", "cancel" => "Cancel", "save needed" => "Press Save to see recent changes.", "saved" => "Saved", @@ -53,5 +54,6 @@ define("STRINGS", [ "link" => "Link", "text" => "Text", "select page or enter url" => "Select a page or enter URL", - "edit component" => "Edit component" + "edit component" => "Edit component", + "default" => "Default" ]); \ No newline at end of file diff --git a/pages/sitesettings.php b/pages/sitesettings.php index 92ef9df..63c708d 100644 --- a/pages/sitesettings.php +++ b/pages/sitesettings.php @@ -44,7 +44,7 @@ if (!is_empty($VARS['siteid'])) {
- +
@@ -86,7 +125,7 @@ if (!is_empty($VARS['siteid'])) {
- + diff --git a/static/css/themeselector.css b/static/css/themeselector.css index f6e06d6..f2ae16a 100644 --- a/static/css/themeselector.css +++ b/static/css/themeselector.css @@ -4,7 +4,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ .theme_bin { - max-height: 300px; + max-height: 75vh; overflow-y: scroll; padding: 5px; } @@ -14,6 +14,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. position: absolute; } +.theme_bin label input[type=radio].form-check-input { + visibility: visible; + position: inherit; +} + .theme_bin label input[type=radio] + .theme { cursor: pointer; border: 3px solid white; @@ -22,4 +27,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. .theme_bin label input[type=radio]:checked + .theme { border: 3px solid rgba(0,0,0,.8); +} + +.theme_bin label { + max-width: 250px; +} + +.colorSelector { + max-height: 50vh; + overflow-y: scroll; } \ No newline at end of file