From 84e0630893fd15065c388c11cf5787bd062c8c8c Mon Sep 17 00:00:00 2001 From: hacker_marc Date: Fri, 2 Oct 2026 21:23:20 +0200 Subject: [PATCH] Refactor error handling in HTMLLoader, enhance error templates, and add new entry and setup templates --- .gitignore | 0 public/html_loader.php | 10 ++++-- public/templates/entrys_frontend/entrys.html | 38 ++++++++++++++++++++ public/templates/error/error.css | 15 ++++++++ public/templates/error/error.html | 4 +++ public/templates/setup/setup.css | 0 public/templates/setup/setup.html | 0 public/templates/templates.json | 0 public/test.php | 0 9 files changed, 64 insertions(+), 3 deletions(-) mode change 100644 => 100755 .gitignore create mode 100644 public/templates/entrys_frontend/entrys.html mode change 100644 => 100755 public/templates/error/error.css mode change 100644 => 100755 public/templates/error/error.html create mode 100644 public/templates/setup/setup.css mode change 100644 => 100755 public/templates/setup/setup.html mode change 100644 => 100755 public/templates/templates.json mode change 100644 => 100755 public/test.php diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/public/html_loader.php b/public/html_loader.php index 1a08962..5251469 100755 --- a/public/html_loader.php +++ b/public/html_loader.php @@ -36,11 +36,11 @@ class HTMLLoader { foreach ($page["css_files"] as $file) { // Check if File exists if (!is_file(TEMPLATE_PATH . $page["dir_name"] . "/" . $file)) { - $this->showError('CSS File ' . $file . ' for Template error in ' . __FILE__ . ""); + $this->showError('CSS File ' . $file . ' for Template error in ' . __FILE__ . " not found."); } // Add CSS Files to HTML - $css .= ''; + $css .= ''; } $html = str_replace("%css%", $css, $html); @@ -61,10 +61,12 @@ class HTMLLoader { $html = file_get_contents(TEMPLATE_PATH . $page["dir_name"] . "/" . $page["html_file"]); // Get CSS + $css = ""; + foreach ($page["css_files"] as $file) { // Check if File exists if (!is_file(TEMPLATE_PATH . $page["dir_name"] . "/" . $file)) { - $this->showError('CSS File ' . $file . ' for Template ' . $this->template . ' in ' . __FILE__ . ""); + $this->showError('CSS File ' . $file . ' for Template ' . $this->template . ' in ' . __FILE__ . " not found."); } // Add CSS Files to HTML @@ -72,5 +74,7 @@ class HTMLLoader { } $html = str_replace("%css%", $css, $html); + + die($html); } } \ No newline at end of file diff --git a/public/templates/entrys_frontend/entrys.html b/public/templates/entrys_frontend/entrys.html new file mode 100644 index 0000000..d752889 --- /dev/null +++ b/public/templates/entrys_frontend/entrys.html @@ -0,0 +1,38 @@ + + + + + + + + + + +
+

Hello!

+

Welcome to your Guestbook! Enter here your prefered username and password.

+

+

+

+ Save +
+ + \ No newline at end of file diff --git a/public/templates/error/error.css b/public/templates/error/error.css old mode 100644 new mode 100755 index 3c2875c..00ad9e2 --- a/public/templates/error/error.css +++ b/public/templates/error/error.css @@ -1,3 +1,18 @@ .icon { + display: flex; + justify-content: center; + align-items: center; font-size: 100pt; +} + +.text { + text-align: center; + font-family: Verdana, Geneva, Tahoma, sans-serif; +} + +.code { + font-family: monospace; + background-color: rgb(226, 225, 225); + padding: 1px; + border-radius: 5px; } \ No newline at end of file diff --git a/public/templates/error/error.html b/public/templates/error/error.html old mode 100644 new mode 100755 index 6534d4f..4a35432 --- a/public/templates/error/error.html +++ b/public/templates/error/error.html @@ -11,6 +11,10 @@
⚠️
+
+

Error

+

%error%

+
\ No newline at end of file diff --git a/public/templates/setup/setup.css b/public/templates/setup/setup.css new file mode 100644 index 0000000..e69de29 diff --git a/public/templates/setup/setup.html b/public/templates/setup/setup.html old mode 100644 new mode 100755 diff --git a/public/templates/templates.json b/public/templates/templates.json old mode 100644 new mode 100755 diff --git a/public/test.php b/public/test.php old mode 100644 new mode 100755