diff --git a/app/css/custom.php b/app/css/custom.php
index 6f4db818..9113ef39 100644
--- a/app/css/custom.php
+++ b/app/css/custom.php
@@ -14,9 +14,9 @@ License: GNU General Public License v3.0
@import url('all.css');
:root {
- --raspap-theme-color: ;
- --raspap-theme-lighter: ;
- --raspap-theme-darker: ;
+ --raspap-theme-color: ;
+ --raspap-theme-lighter: ;
+ --raspap-theme-darker: ;
}
body {
diff --git a/app/img/devices/compute.php b/app/img/devices/compute.php
index bf744a3a..63ddeb44 100644
--- a/app/img/devices/compute.php
+++ b/app/img/devices/compute.php
@@ -8,78 +8,78 @@ $color = getColorOpt();
viewBox="0 0 291.5 203.2" style="enable-background:new 0 0 291.5 203.2;" xml:space="preserve">
diff --git a/app/img/devices/default.php b/app/img/devices/default.php
index 9311b504..71ea0703 100644
--- a/app/img/devices/default.php
+++ b/app/img/devices/default.php
@@ -7,9 +7,9 @@ $color = getColorOpt();
viewBox="0 0 431 321" style="enable-background:new 0 0 431 321;" xml:space="preserve">
diff --git a/app/img/devices/zero.php b/app/img/devices/zero.php
index 68c17007..4e688ad7 100644
--- a/app/img/devices/zero.php
+++ b/app/img/devices/zero.php
@@ -7,7 +7,7 @@ $color = getColorOpt();
diff --git a/app/img/solid.php b/app/img/solid.php
index 9952e7fa..23bd418a 100644
--- a/app/img/solid.php
+++ b/app/img/solid.php
@@ -42,24 +42,24 @@ if ($showJoint) {
for ($i = 1; $i < count($activeYs); $i++) {
$y1 = $activeYs[$i-1];
$y2 = $activeYs[$i];
- echo "";
+ echo "";
}
}
?>
-
+
-
+
-
+
-
+
-
+
diff --git a/includes/functions.php b/includes/functions.php
index f1b90b9e..9541e307 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -664,6 +664,21 @@ function getColorOpt()
} else {
$color = $_COOKIE['color'];
}
+
+ // Define the regex pattern for valid CSS color formats
+ $colorPattern = "/^(" .
+ "#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})" . "|" . // Hex colors (#RGB or #RRGGBB)
+ "rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)" . "|" . // RGB format
+ "rgba\(\s*(?:\d{1,3}\s*,\s*){3}\s*(0|0\.\d+|1)\s*\)" . "|" . // RGBA format
+ "[a-zA-Z]+" . // Named colors
+ ")$/i";
+
+ // Validate the color
+ if (!preg_match($colorPattern, $color)) {
+ // Return a default color if validation fails
+ $color = "#2b8080";
+ }
+
return $color;
}
@@ -1010,4 +1025,3 @@ function callbackTimeout(callable $callback, int $interval)
return $result;
}
-