summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Kohl <git@jonaskohl.de>2024-09-06 17:01:01 +0200
committerJonas Kohl <git@jonaskohl.de>2024-09-06 17:01:01 +0200
commit3d22cc3333e1265a222425a4ede9c464234e3632 (patch)
tree7acd1379c752913f12168cc75583e68b14278288
parent0540e04c77864186ce48193456634b897a11f5aa (diff)
Small fixes; Add component system
-rwxr-xr-xcgi/contact.php2
-rw-r--r--includes/desktop/components/alert.php27
-rw-r--r--includes/desktop/template_head_start.php2
-rw-r--r--includes/mobile/components/alert.php8
-rw-r--r--includes/mobile/template_end.php2
-rw-r--r--includes/mobile/template_head_end.php14
-rw-r--r--includes/mobile/template_head_start.php2
-rw-r--r--includes/template_head_start.php11
-rw-r--r--pages/about.php3
-rw-r--r--pages/dekomp.php1
-rw-r--r--pages/exklusiv.php1
-rw-r--r--pages/loesung.php1
-rw-r--r--pages/sent.php6
-rw-r--r--pages/start.php20
-rw-r--r--pages/trivia.php1
15 files changed, 65 insertions, 36 deletions
diff --git a/cgi/contact.php b/cgi/contact.php
index 3aceaac..0f9ac5f 100755
--- a/cgi/contact.php
+++ b/cgi/contact.php
@@ -74,4 +74,4 @@ $transport->send((new Email())
->text($message)
);
-header("Location: /pages/sent.html");
+header("Location: /pages/sent.php");
diff --git a/includes/desktop/components/alert.php b/includes/desktop/components/alert.php
new file mode 100644
index 0000000..fce6376
--- /dev/null
+++ b/includes/desktop/components/alert.php
@@ -0,0 +1,27 @@
+<?php
+function c_alert(string $html_message, string $type, ?string $icon = null): void {
+ $type_colors = [
+ "warning" => ["olive","yellow"],
+ "success" => ["green","lime"],
+ ][$type] ?? ["gray","white"];
+ if ($icon !== null)
+ $icon = [
+ "warning-sign" => "warn16",
+ ][$icon] ?? $icon;
+?>
+<center>
+<table bgcolor="<?= htmlentities($type_colors[0]) ?>" cellspacing="0" cellpadding="2"><tr><td>
+<table bgcolor="<?= htmlentities($type_colors[1]) ?>" cellspacing="0" cellpadding="12"><tr><td>
+<?php if ($icon !== null): ?>
+<table bgcolor="<?= htmlentities($type_colors[1]) ?>" cellspacing="0" cellpadding="0"><tr><td>
+<nobr><img src="../images/<?= htmlentities(rawurlencode($icon)) ?>.gif">&nbsp;</nobr>
+</td><td width="100%">
+<?php endif; ?>
+<font color="black"><?= $html_message ?></font>
+<?php if ($icon !== null): ?>
+</td></tr></table>
+<?php endif; ?>
+</td></tr></table>
+</td></tr></table>
+</center>
+<?php }
diff --git a/includes/desktop/template_head_start.php b/includes/desktop/template_head_start.php
index 6d4a776..c0c12f4 100644
--- a/includes/desktop/template_head_start.php
+++ b/includes/desktop/template_head_start.php
@@ -4,7 +4,7 @@
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="MSThemeCompatible" content="no">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
- <title><?= htmlentities($PAGE_TITLE ?? "") ?> - Mystic House Fansite</title>
+ <title><?= htmlentities($PAGE_TITLE ?? "") ?> - Mystic House Corner</title>
<script language="JavaScript">
<!--
function getLocation() {
diff --git a/includes/mobile/components/alert.php b/includes/mobile/components/alert.php
new file mode 100644
index 0000000..fbc3482
--- /dev/null
+++ b/includes/mobile/components/alert.php
@@ -0,0 +1,8 @@
+<?php function c_alert(string $html_message, string $type, ?string $icon = null): void { ?>
+<div class="alert alert-<?= htmlentities($type) ?>">
+<?php if ($icon !== null): ?>
+<i class="glyphicon glyphicon-<?= htmlentities($icon) ?>"></i>
+<?php endif; ?>
+<?= $html_message ?>
+</div>
+<?php }
diff --git a/includes/mobile/template_end.php b/includes/mobile/template_end.php
index 1f3ad26..3746d82 100644
--- a/includes/mobile/template_end.php
+++ b/includes/mobile/template_end.php
@@ -1,6 +1,6 @@
</div>
<footer class="footer">
-<div class="container">
+<div class="container-fluid">
<a href="/view.php?view=d&next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>" target="_top">Desktop-Version</a>
</div>
</footer>
diff --git a/includes/mobile/template_head_end.php b/includes/mobile/template_head_end.php
index 6819603..28eef80 100644
--- a/includes/mobile/template_head_end.php
+++ b/includes/mobile/template_head_end.php
@@ -13,14 +13,14 @@
</div>
<div class="collapse navbar-collapse" id="nav-collapse">
<ul class="nav navbar-nav">
- <li><a href="/pages/start.php">Startseite</a></li>
- <li><a href="/pages/trivia.php">Trivia</a></li>
- <li><a href="/pages/exklusiv.php">Exklusiv</a></li>
- <li><a href="/pages/dekomp.php">Dekomp</a></li>
- <li><a href="/pages/loesung.php">L&ouml;sung</a></li>
- <li><a href="/pages/about.php">&Uuml;ber</a></li>
+ <li<?= ($NAV_LINK_ID ?? null) === "start" ? ' class="active"' : ''; ?>><a href="/pages/start.php">Startseite</a></li>
+ <li<?= ($NAV_LINK_ID ?? null) === "trivia" ? ' class="active"' : ''; ?>><a href="/pages/trivia.php">Trivia</a></li>
+ <li<?= ($NAV_LINK_ID ?? null) === "exklusiv" ? ' class="active"' : ''; ?>><a href="/pages/exklusiv.php">Exklusiv</a></li>
+ <li<?= ($NAV_LINK_ID ?? null) === "dekomp" ? ' class="active"' : ''; ?>><a href="/pages/dekomp.php">Dekomp</a></li>
+ <li<?= ($NAV_LINK_ID ?? null) === "loesung" ? ' class="active"' : ''; ?>><a href="/pages/loesung.php">L&ouml;sung</a></li>
+ <li<?= ($NAV_LINK_ID ?? null) === "about" ? ' class="active"' : ''; ?>><a href="/pages/about.php">&Uuml;ber</a></li>
</ul>
</div>
</div>
</nav>
-<div class="container"> \ No newline at end of file
+<div class="container-fluid"> \ No newline at end of file
diff --git a/includes/mobile/template_head_start.php b/includes/mobile/template_head_start.php
index 21c44f6..4a9e161 100644
--- a/includes/mobile/template_head_start.php
+++ b/includes/mobile/template_head_start.php
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
- <title><?= htmlentities($PAGE_TITLE ?? "") ?> - Mystic House Fansite</title>
+ <title><?= htmlentities($PAGE_TITLE ?? "") ?> - Mystic House Corner</title>
<link rel="stylesheet" href="/mobile/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/mobile/site.css">
<script src="/mobile/jquery-1.12.4.min.js"></script>
diff --git a/includes/template_head_start.php b/includes/template_head_start.php
index 31a5fb4..271cb60 100644
--- a/includes/template_head_start.php
+++ b/includes/template_head_start.php
@@ -1,5 +1,14 @@
<?php
$__mobile = include __DIR__ . "/mobile-detect.php";
+$__inc_dir = __DIR__ . "/" . ($__mobile ? "mobile" : "desktop");
-include __DIR__ . "/" . ($__mobile ? "mobile" : "desktop") . "/template_head_start.php";
+foreach (scandir($__inc_dir . "/components") as $ent) {
+ if ($ent[0] === "." || !is_file($__inc_dir . "/components/" . $ent) || strcasecmp(pathinfo($ent, PATHINFO_EXTENSION), "php") !== 0)
+ continue;
+ include $__inc_dir . "/components/" . $ent;
+}
+
+include $__inc_dir . "/template_head_start.php";
+
+unset($__inc_dir);
diff --git a/pages/about.php b/pages/about.php
index 5ddf3c5..2601b58 100644
--- a/pages/about.php
+++ b/pages/about.php
@@ -1,4 +1,5 @@
-<?php $PAGE_TITLE = "Ueber"; ?>
+<?php $PAGE_TITLE = "Über"; ?>
+<?php $NAV_LINK_ID = "about"; ?>
<?php include __DIR__ . "/../includes/template_head_start.php"; ?>
<?php if (!$__mobile): ?>
<style type="text/css">
diff --git a/pages/dekomp.php b/pages/dekomp.php
index 503e782..72554f9 100644
--- a/pages/dekomp.php
+++ b/pages/dekomp.php
@@ -1,3 +1,4 @@
+<?php $NAV_LINK_ID = "dekomp"; ?>
<?php include __DIR__ . "/../includes/template_start.php"; ?>
<h1>Dekomp</h1>
diff --git a/pages/exklusiv.php b/pages/exklusiv.php
index 6272748..c26c863 100644
--- a/pages/exklusiv.php
+++ b/pages/exklusiv.php
@@ -1,3 +1,4 @@
+<?php $NAV_LINK_ID = "exklusiv"; ?>
<?php include __DIR__ . "/../includes/template_start.php"; ?>
<h1>Exklusiv</h1>
diff --git a/pages/loesung.php b/pages/loesung.php
index 3812e88..1e34a3f 100644
--- a/pages/loesung.php
+++ b/pages/loesung.php
@@ -1,3 +1,4 @@
+<?php $NAV_LINK_ID = "loesung"; ?>
<?php $PAGE_TITLE = "Lösung"; ?>
<?php include __DIR__ . "/../includes/template_start.php"; ?>
diff --git a/pages/sent.php b/pages/sent.php
index e0a0125..e8e8c3f 100644
--- a/pages/sent.php
+++ b/pages/sent.php
@@ -1,9 +1,5 @@
<?php include __DIR__ . "/../includes/template_start.php"; ?>
-<table bgcolor="green" cellspacing="0" cellpadding="2"><tr><td>
-<table bgcolor="lime" cellspacing="0" cellpadding="12"><tr><td>
-<font color="black"><b>Ihre Nachricht ist erfolgreich bei uns eingegangen!</b></font>
-</td></tr></table>
-</td></tr></table>
+<?php c_alert('<b>Ihre Nachricht ist erfolgreich bei uns eingegangen!</b>', 'success'); ?>
<?php include __DIR__ . "/../includes/template_end.php"; ?>
diff --git a/pages/start.php b/pages/start.php
index 07dfd88..ce2f3cd 100644
--- a/pages/start.php
+++ b/pages/start.php
@@ -1,25 +1,9 @@
+<?php $NAV_LINK_ID = "start"; ?>
<?php $PAGE_TITLE = "Startseite"; ?>
<?php include __DIR__ . "/../includes/template_start.php"; ?>
<h1 align="center">Herzlich willkommen bei der <i>Mystic House Corner</i>!</h1>
-<?php if ($__mobile): ?>
-<div class="alert alert-warning">
-<i class="glyphicon glyphicon-warning-sign"></i>
-<b>Achtung:</b> Diese Seite befindet sich noch im Aufbau!
-</div>
-<?php else: ?>
-<center>
-<table bgcolor="olive" cellspacing="0" cellpadding="2"><tr><td>
-<table bgcolor="yellow" cellspacing="0" cellpadding="12"><tr><td>
-<table bgcolor="yellow" cellspacing="0" cellpadding="0"><tr><td>
-<nobr><img src="../images/warn16.gif">&nbsp;</nobr>
-</td><td width="100%">
-<font color="black"><b>Achtung:</b> Diese Seite befindet sich noch im Aufbau!</font>
-</td></tr></table>
-</td></tr></table>
-</td></tr></table>
-</center>
-<?php endif; ?>
+<?php c_alert('<b>Achtung:</b> Diese Seite befindet sich noch im Aufbau!', 'warning', 'warning-sign'); ?>
<?php include __DIR__ . "/../includes/template_end.php"; ?>
diff --git a/pages/trivia.php b/pages/trivia.php
index 30f79a3..06a9237 100644
--- a/pages/trivia.php
+++ b/pages/trivia.php
@@ -1,3 +1,4 @@
+<?php $NAV_LINK_ID = "trivia"; ?>
<?php include __DIR__ . "/../includes/template_start.php"; ?>
<h1>Trivia</h1>