From 56336ee3d5ec32647f6dbf35cf09f94a13795b60 Mon Sep 17 00:00:00 2001 From: Connor Thomson Date: Sat, 19 Sep 2026 10:51:36 -0700 Subject: Random fixes and updates --- app.php | 19 ++++++++++------- css/all.css | 23 -------------------- css/body.css | 49 ------------------------------------------- css/container.css | 24 --------------------- css/content.css | 28 ------------------------- css/desktop/body.css | 49 +++++++++++++++++++++++++++++++++++++++++++ css/desktop/container.css | 24 +++++++++++++++++++++ css/desktop/content.css | 28 +++++++++++++++++++++++++ css/desktop/footer.css | 28 +++++++++++++++++++++++++ css/desktop/header.css | 53 +++++++++++++++++++++++++++++++++++++++++++++++ css/footer.css | 28 ------------------------- css/header.css | 53 ----------------------------------------------- html/app.html | 15 ++++++++++---- html/footer.html | 0 html/header.html | 0 php/execute.php | 29 ++++++++++++++++++++++++++ php/footer.php | 0 php/load-css.php | 9 ++++++++ php/path-clean.php | 25 ++++++++++++++++++++++ php/replace.php | 0 php/templates.php | 37 --------------------------------- 21 files changed, 268 insertions(+), 253 deletions(-) mode change 100644 => 100755 app.php delete mode 100644 css/all.css delete mode 100644 css/body.css delete mode 100644 css/container.css delete mode 100644 css/content.css create mode 100755 css/desktop/body.css create mode 100644 css/desktop/container.css create mode 100755 css/desktop/content.css create mode 100755 css/desktop/footer.css create mode 100755 css/desktop/header.css delete mode 100644 css/footer.css delete mode 100644 css/header.css mode change 100644 => 100755 html/app.html mode change 100644 => 100755 html/footer.html mode change 100644 => 100755 html/header.html create mode 100644 php/execute.php mode change 100644 => 100755 php/footer.php create mode 100644 php/load-css.php create mode 100644 php/path-clean.php mode change 100644 => 100755 php/replace.php delete mode 100644 php/templates.php diff --git a/app.php b/app.php old mode 100644 new mode 100755 index 62fdda7..6a4b41e --- a/app.php +++ b/app.php @@ -24,17 +24,22 @@ define('ROOT_DIR', __DIR__ . '/'); define('HTML_DIR', __DIR__ . '/html/'); define('PHP_DIR', __DIR__ . '/php/'); -require_once PHP_DIR . 'templates.php'; +require_once PHP_DIR . 'replace.php'; +require_once PHP_DIR . 'execute.php'; +require_once PHP_DIR . 'path-clean.php'; -$file = $_GET['file'] ?? 'index.html'; +$file = path_clean($_GET['file'] ?? 'index.html'); -$components = [ - '{{HEADER}}' => HTML_DIR . 'header.html', - '{{CONTENT}}' => ROOT_DIR . $file, - '{{FOOTER}}' => PHP_DIR . 'footer.php' +$device = 'desktop'; + +$targets = [ + '{{header}}' => file_get_contents(HTML_DIR . 'header.html'), + '{{content}}' => file_get_contents(ROOT_DIR . $file), + '{{footer}}' => execute(PHP_DIR . 'footer.php'), + '{{device}}' => $device ]; -$app_html = template_process(HTML_DIR . 'app.html', $components); +$app_html = replace(HTML_DIR . 'app.html', $targets); echo $app_html; ?> diff --git a/css/all.css b/css/all.css deleted file mode 100644 index 1900236..0000000 --- a/css/all.css +++ /dev/null @@ -1,23 +0,0 @@ -/* - * GNUfault.org - GNUfault's website - * Copyright (C) 2026 Connor Thomson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -@import url("body.css"); -@import url("content.css"); -@import url("header.css"); -@import url("footer.css"); -@import url("container.css"); diff --git a/css/body.css b/css/body.css deleted file mode 100644 index e252f1c..0000000 --- a/css/body.css +++ /dev/null @@ -1,49 +0,0 @@ -/* - * GNUfault.org - GNUfault's website - * Copyright (C) 2026 Connor Thomson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -* { - box-sizing: border-box; - -webkit-tap-highlight-color: transparent; -} - -html, body { - font-family: sans-serif; - margin: 0; - padding: 0; - background-color: #F5F7FA; - line-height: 1; -} - -.content p, -.content h1, -.content h2, -.content h3, -.content h4, -.content h5, -.content h6 { - margin-top: 0; - margin-bottom: 10px; -} - -a:visited { - color: #0000EE; -} - -a:active { - color: #EE0000; -} diff --git a/css/container.css b/css/container.css deleted file mode 100644 index ff5e766..0000000 --- a/css/container.css +++ /dev/null @@ -1,24 +0,0 @@ -/* - * GNUfault.org - GNUfault's website - * Copyright (C) 2026 Connor Thomson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -.container { - width: 1000px; - margin: 12px auto 0 auto; - border: 1px solid #98A5B0; - border-radius: 10px; -} diff --git a/css/content.css b/css/content.css deleted file mode 100644 index 0a86b16..0000000 --- a/css/content.css +++ /dev/null @@ -1,28 +0,0 @@ -/* - * GNUfault.org - GNUfault's website - * Copyright (C) 2026 Connor Thomson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -.content { - background-color: white; - padding: 5px; -} - -.content hr { - height: 1px; - border: none; - background-color: #98A5B0; -} diff --git a/css/desktop/body.css b/css/desktop/body.css new file mode 100755 index 0000000..e252f1c --- /dev/null +++ b/css/desktop/body.css @@ -0,0 +1,49 @@ +/* + * GNUfault.org - GNUfault's website + * Copyright (C) 2026 Connor Thomson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +* { + box-sizing: border-box; + -webkit-tap-highlight-color: transparent; +} + +html, body { + font-family: sans-serif; + margin: 0; + padding: 0; + background-color: #F5F7FA; + line-height: 1; +} + +.content p, +.content h1, +.content h2, +.content h3, +.content h4, +.content h5, +.content h6 { + margin-top: 0; + margin-bottom: 10px; +} + +a:visited { + color: #0000EE; +} + +a:active { + color: #EE0000; +} diff --git a/css/desktop/container.css b/css/desktop/container.css new file mode 100644 index 0000000..ff5e766 --- /dev/null +++ b/css/desktop/container.css @@ -0,0 +1,24 @@ +/* + * GNUfault.org - GNUfault's website + * Copyright (C) 2026 Connor Thomson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +.container { + width: 1000px; + margin: 12px auto 0 auto; + border: 1px solid #98A5B0; + border-radius: 10px; +} diff --git a/css/desktop/content.css b/css/desktop/content.css new file mode 100755 index 0000000..0a86b16 --- /dev/null +++ b/css/desktop/content.css @@ -0,0 +1,28 @@ +/* + * GNUfault.org - GNUfault's website + * Copyright (C) 2026 Connor Thomson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +.content { + background-color: white; + padding: 5px; +} + +.content hr { + height: 1px; + border: none; + background-color: #98A5B0; +} diff --git a/css/desktop/footer.css b/css/desktop/footer.css new file mode 100755 index 0000000..7e3b215 --- /dev/null +++ b/css/desktop/footer.css @@ -0,0 +1,28 @@ +/* + * GNUfault.org - GNUfault's website + * Copyright (C) 2026 Connor Thomson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +.footer { + height: 35px; + padding: 5px; + background-color: #CADCEB; + display: flex; + align-items: center; + justify-content: center; + border-radius: 0 0 9px 9px; + border-top: 1px solid #98A5B0; +} diff --git a/css/desktop/header.css b/css/desktop/header.css new file mode 100755 index 0000000..ad7afb8 --- /dev/null +++ b/css/desktop/header.css @@ -0,0 +1,53 @@ +/* + * GNUfault.org - GNUfault's website + * Copyright (C) 2026 Connor Thomson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +.header { + background-image: linear-gradient(180deg, #12A3EB 0%, #095276 100%); + display: flex; + flex-direction: column; + border-radius: 9px 9px 0 0; +} + +.header .banner { + height: 80px; + position: relative; + display: flex; + justify-content: center; + align-items: center; + border-bottom: 1px solid #98A5B0; +} + +.header .banner .taya { + position: absolute; + left: 0; + top: 50%; + transform: translateY(-50%); +} + +.header .banner a { + text-decoration: none; +} + +.header .navbar { + height: 35px; + padding: 5px; + background-color: #CADCEB; + display: flex; + align-items: center; + border-bottom: 1px solid #98A5B0; +} diff --git a/css/footer.css b/css/footer.css deleted file mode 100644 index 7e3b215..0000000 --- a/css/footer.css +++ /dev/null @@ -1,28 +0,0 @@ -/* - * GNUfault.org - GNUfault's website - * Copyright (C) 2026 Connor Thomson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -.footer { - height: 35px; - padding: 5px; - background-color: #CADCEB; - display: flex; - align-items: center; - justify-content: center; - border-radius: 0 0 9px 9px; - border-top: 1px solid #98A5B0; -} diff --git a/css/header.css b/css/header.css deleted file mode 100644 index ad7afb8..0000000 --- a/css/header.css +++ /dev/null @@ -1,53 +0,0 @@ -/* - * GNUfault.org - GNUfault's website - * Copyright (C) 2026 Connor Thomson - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -.header { - background-image: linear-gradient(180deg, #12A3EB 0%, #095276 100%); - display: flex; - flex-direction: column; - border-radius: 9px 9px 0 0; -} - -.header .banner { - height: 80px; - position: relative; - display: flex; - justify-content: center; - align-items: center; - border-bottom: 1px solid #98A5B0; -} - -.header .banner .taya { - position: absolute; - left: 0; - top: 50%; - transform: translateY(-50%); -} - -.header .banner a { - text-decoration: none; -} - -.header .navbar { - height: 35px; - padding: 5px; - background-color: #CADCEB; - display: flex; - align-items: center; - border-bottom: 1px solid #98A5B0; -} diff --git a/html/app.html b/html/app.html old mode 100644 new mode 100755 index b5e4d0d..a01ca45 --- a/html/app.html +++ b/html/app.html @@ -20,19 +20,26 @@ + GNUfault.org - + + + + + + +
- {{HEADER}} + {{header}}
- {{CONTENT}} + {{content}}
- {{FOOTER}} + {{footer}}
diff --git a/html/footer.html b/html/footer.html old mode 100644 new mode 100755 diff --git a/html/header.html b/html/header.html old mode 100644 new mode 100755 diff --git a/php/execute.php b/php/execute.php new file mode 100644 index 0000000..bd8fe18 --- /dev/null +++ b/php/execute.php @@ -0,0 +1,29 @@ +. + */ + +function execute($path) { + if (file_exists($path)) { + ob_start(); + include $path; + return ob_get_clean(); + } + return ''; +} + +?> diff --git a/php/footer.php b/php/footer.php old mode 100644 new mode 100755 diff --git a/php/load-css.php b/php/load-css.php new file mode 100644 index 0000000..7cabc91 --- /dev/null +++ b/php/load-css.php @@ -0,0 +1,9 @@ + + + + + + diff --git a/php/path-clean.php b/php/path-clean.php new file mode 100644 index 0000000..d7b5fbf --- /dev/null +++ b/php/path-clean.php @@ -0,0 +1,25 @@ +. + */ + +function path_clean($path) { + $pattern = '/(\.\.\/)+/'; + return preg_replace($pattern, '', $path); +} + +?> diff --git a/php/replace.php b/php/replace.php old mode 100644 new mode 100755 diff --git a/php/templates.php b/php/templates.php deleted file mode 100644 index dfd4063..0000000 --- a/php/templates.php +++ /dev/null @@ -1,37 +0,0 @@ -. - */ - -function render_component(string $componentPath): string { - ob_start(); - include($componentPath); - return ob_get_clean(); -} - -function template_process(string $template, array $components = []): string { - $html = file_get_contents($template); - - foreach ($components as $placeholder => $componentPath) { - $injectedContent = render_component($componentPath); - $html = str_replace($placeholder, $injectedContent, $html); - } - - return $html; -} - -?> -- cgit v1.2.3