Compare commits
202 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c32f31204e | |||
| b130bf9e19 | |||
| 1314362df9 | |||
| 5a1c032f1b | |||
| fae4bc86ad | |||
| 664092d52f | |||
| 22b1dd827d | |||
| 50df844e23 | |||
| 45b6b41d60 | |||
| a0a79e0191 | |||
| 722f4055a5 | |||
| 46def40a14 | |||
| a76113dcaf | |||
| f56a04c3ab | |||
| 7f891b6ebf | |||
| 1343496a12 | |||
| 1735dd28a2 | |||
| bfc9ee4d01 | |||
| 9321d09489 | |||
| 7269ea03db | |||
| 2a3a15c92d | |||
| a7f1729e6e | |||
| cdccb0bfe8 | |||
| 48501a9069 | |||
| a175765e33 | |||
| 3d57c2e482 | |||
| bac4334fb8 | |||
| aa3e7c2f36 | |||
| 46cd524f70 | |||
| 86fb37abc4 | |||
| 9349b91926 | |||
| b9c86e2074 | |||
| 68672474e4 | |||
| a08197cc10 | |||
| e28620d9fb | |||
| ded98ed757 | |||
| 18fe69cbcd | |||
| e35d07ebc3 | |||
| e772a8b57f | |||
| 9c3ebc9877 | |||
| 3d13c3b8c8 | |||
| 6c3e788f13 | |||
| aceac0bf8b | |||
| 78d04f1715 | |||
| 1d773ea4e6 | |||
| a595567db1 | |||
| 945d3e1c1f | |||
| d58ea953af | |||
| b9475a045f | |||
| 32c2a1a3d8 | |||
| fc93f2b3f0 | |||
| f33778f97a | |||
| 1c72a03f26 | |||
| 3dcbdbf23c | |||
| 8143d501fa | |||
| 3471eedf4a | |||
| b6a3dad2ab | |||
| 375e6d9625 | |||
| 4d144ec704 | |||
| 92574a0f76 | |||
| ade73f3105 | |||
| ee75620cd8 | |||
| 94486e2b0a | |||
| a26e985edf | |||
| cf9ac795eb | |||
| 370c047c16 | |||
| a562a67923 | |||
| 078dbd8901 | |||
| 64d624a6df | |||
| 90ab57e4cb | |||
| a00ddf18e6 | |||
| 5048dc2466 | |||
| 7209fe3e20 | |||
| 4e35e67ef1 | |||
| 830b57d245 | |||
| 06930644a6 | |||
| a519387773 | |||
| ed40596389 | |||
| 4c855c05ed | |||
| e7189245d5 | |||
| 709a4ba83c | |||
| fb54ba2462 | |||
| c6b55030cf | |||
| af04557f58 | |||
| 2c100bddf2 | |||
| 8e3642c668 | |||
| 87d78b749b | |||
| 604dbeca93 | |||
| 8e9e7d65d0 | |||
| e2c317e507 | |||
| 5a7fa35465 | |||
| 2601a1c1ca | |||
| 0e26679f24 | |||
| d5ab659217 | |||
| 2d5919d572 | |||
| f56a074a3c | |||
| 24dc432f01 | |||
| 016193de07 | |||
| f04d8fecd3 | |||
| 36276c7c88 | |||
| 4a2cf0b55b | |||
| 400436a73f | |||
| 4c378dfba6 | |||
| c3a9de71f4 | |||
| ecf2e9ef57 | |||
| 45ac70eba2 | |||
| 3b66c6aa3a | |||
| e37b882481 | |||
| 5c7a47e002 | |||
| bbaa73dc1a | |||
| 9f5806f019 | |||
| 6de86c3143 | |||
| c9c0de6c3c | |||
| 4f827ed3a8 | |||
| aedac79743 | |||
| 84a39bf0d4 | |||
| 75c6d099f5 | |||
| 319957c01e | |||
| 26dc33ea2f | |||
| 7597eddd7c | |||
| 0441b4e56f | |||
| cbff21136c | |||
| 03f0d19b01 | |||
| ca65c6c6e1 | |||
| 2b095f16bf | |||
| 930bf99fa1 | |||
| 366527e8e9 | |||
| 4e06240307 | |||
| 38608a5278 | |||
| b19f30cca4 | |||
| b206e809ac | |||
| e88f741fa7 | |||
| 6958e71bfb | |||
| c6ad0b2a59 | |||
| da9ea4f413 | |||
| 5703c0a6dd | |||
| b70943dd35 | |||
| 0f7099be81 | |||
| 9cbc1637b4 | |||
| d01be7d84c | |||
| 28511e0cc4 | |||
| 3774a2caee | |||
| 70277d3712 | |||
| 18cb092d06 | |||
| 417f34e35f | |||
| c62ff5b2c0 | |||
| ad422a134d | |||
| 9fce9ec8dd | |||
| a329137de2 | |||
| b328c2613c | |||
| 62a7b6773c | |||
| 625dd35b9e | |||
| f99b7bc8ab | |||
| e779162ec2 | |||
| 17345345b5 | |||
| 3df526d5b5 | |||
| d5f30176c4 | |||
| 308e5af6ff | |||
| 268fe6a6b9 | |||
| a24914126f | |||
| 1ca27bc072 | |||
| c96d93c2ce | |||
| cd38af22db | |||
| c440c25e41 | |||
| e105ab61b7 | |||
| 10b058afa0 | |||
| d18f33a87a | |||
| 62190fa821 | |||
| a6210c9d6e | |||
| fdece531af | |||
| 8073235466 | |||
| 7dc3c3b988 | |||
| 21793dffd7 | |||
| ca337c4fac | |||
| 76beb8d62e | |||
| c5bfd02f09 | |||
| 9f4ca058bd | |||
| 603c208ae4 | |||
| 754777d69e | |||
| 829a0e49d8 | |||
| f12babf2b1 | |||
| d6249169c6 | |||
| 6aa1cd9a63 | |||
| 09795c30dd | |||
| 59268dc102 | |||
| 979378d142 | |||
| 6ce7f0ef22 | |||
| 21bdb0d66d | |||
| 5db4ad3e63 | |||
| 2ce13cef72 | |||
| 02551049e0 | |||
| 55e9fa6a20 | |||
| c82378baa8 | |||
| 541d5b4c5e | |||
| f9ab3f8db2 | |||
| 6c5047be30 | |||
| 25f6d2bf4a | |||
| 4d8f338649 | |||
| 46a307a5b0 | |||
| 7706c7dfbf | |||
| a946cee891 | |||
| 4d4b8aeb99 |
Generated
+1
-3
@@ -10,9 +10,7 @@
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.0">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.5" />
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
Team Tag-Buchstabe: DI-14-C-Schulte-Eilers-Ortmann
|
||||
Namen der Studierenden:
|
||||
- Name 1 Caroline Schulte
|
||||
- Name 2 Jacques Eilers
|
||||
- Name 3 Niklas Ortmann
|
||||
Abgabe zu Aufgabenblatt 1
|
||||
# Webprogrammierung: Gruppe DI-14-C
|
||||
|
||||
Hinweise:
|
||||
index.html wurde zu einer index.php umbenannt.
|
||||
webhook.php bitte ignorieren. Diese dient nur als zukünftige Automatisierung des Repo-Pulls (s. https://docs.gitea.com/usage/webhooks)
|
||||
## Beteiligte
|
||||
- Caroline Schulte
|
||||
- Jacques Eilers
|
||||
- Niklas Ortmann
|
||||
|
||||
Beim Verwenden der Navbar-Links bitte Folgendes beachten: nur die Kategorien Physik, Mathe, Informatik führen exemplarisch auf eine Beispiel-Seite.
|
||||
Die anderen Links sind erstmal Platzhalter, dessen dynamischer Inhalt später mit PHP in die index.php eingefügt wird. Alle anderen Links führen auf eine 404-Seite.
|
||||
## Login-Informationen für Dummy-User
|
||||
Jeweils im Format `Anmeldename, Passwort, Mailadresse`:
|
||||
- `max.mustermann, test123, mustermann@web.de`
|
||||
|
||||
## Weitere Voraussetzungen zur Nutzung
|
||||
- Per Klick auf das Logo gelangt man auf die Home-Seite.
|
||||
|
||||
## Ausgelassene Teilaufgaben
|
||||
|
||||
## Bekannte Fehler und Mängel
|
||||
- Der Beitragseditor fügt beim Laden von Inhalten leere Zeichen ein.
|
||||
- Bitte auf die gesetzten TODO's achten. Wenn Inhalte fehlen, sind sie i.d.R. als TODO kommentiert.
|
||||
- Die Navbar hat noch keine onHover-Effekte und erschwert etwas die Bedienung.
|
||||
- Suchleiste in der Nav ist in der mobilen Ansicht etwas schmal. Ggf. ein alternatives (kleineres) Logo implementieren.
|
||||
|
||||
## Besonderheiten des Projektes
|
||||
- Es wurde ein einfacher Beitrags-Editor erstellt. Mit diesem können Beiträge erstellt oder bearbeitet werden.
|
||||
Es handelt es sich um eine einfache Version. Später sollen z.B. Bilder und die Positionierung der Elemente folgen.
|
||||
- Es sind drei Dummy-Beiträge für den Nutzer max.mustermann hinterlegt.
|
||||
- Beim Verwenden der Navbar-Links bitte Folgendes beachten: nur die Kategorien Physik, Mathe, Informatik führen exemplarisch auf eine Beispiel-Seite.
|
||||
Die anderen Links sind erstmal Platzhalter und führen auf eine 404-Seite.
|
||||
- Die Such-Seite umfasst eine Suchfunktion (aber noch nicht nach Tags) und Sortierfunktion. Jedoch fehlt noch eine Filterfunktion (z.B. nur Mathe anzeigen).
|
||||
Wenn die Filterfunktion implementiert ist, dann können die statischen Seiten "Informatik", "Mathe", "Physik" entfernt und dynamisch auf der Suchseite
|
||||
nach gefiltertem Fach angezeigt werden. (Vorläufige showCategory.php implementiert)
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
-->
|
||||
<main>
|
||||
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein interner Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
<h1>404 - Seite nicht vorhanden</h1>
|
||||
<p>
|
||||
Später im Projekt sollen über index.php?pfad= ... der Inhalt der index.php dynamisch gesetzt werden.
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
session_start();
|
||||
$user = $user ?? null;
|
||||
if (!isset($_SESSION["user"])) {
|
||||
header("Location: index.php?pfad=login");
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<!--
|
||||
Seite: Beitrag erstellen
|
||||
@@ -18,18 +22,47 @@ session_start();
|
||||
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_title"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_content"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Der Text erlaubt eine Länge von 10 bis maximal 7.000 Zeichen (ca. 1.000 Wörter).
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_category"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Die ausgewählte Kategorie ist ungültig.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_tags"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Ungültige Schlagworte gefunden. Erlaubt sind nur Buchstaben, Zahlen, Leerzeichen und Bindestriche (2-50 Zeichen).
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "validation_missing"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Bei der Validierung deiner Daten ist ein Fehler aufgetreten. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
<input type="text" id="title" name="title" placeholder="Titel hier eingeben" required>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."></textarea>
|
||||
<input type="text" id="title" name="title"
|
||||
value="<?php echo htmlspecialchars($_SESSION['old_title'] ?? ''); unset($_SESSION['old_title']); ?>"
|
||||
placeholder="Titel hier eingeben" required>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
||||
<?php echo htmlspecialchars($_SESSION['old_content'] ?? ''); unset($_SESSION['old_content']); ?>
|
||||
</textarea>
|
||||
</main>
|
||||
|
||||
<!-- Seitenleiste -->
|
||||
<aside class="editor-sidebar">
|
||||
|
||||
<div class="sidebar-block">
|
||||
<button type="submit" class="btn-publish">Veröffentlichen</button>
|
||||
<button type="submit" id="editor-button" class="button">Veröffentlichen</button>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-block">
|
||||
@@ -79,7 +112,9 @@ session_start();
|
||||
|
||||
<div class="sidebar-block">
|
||||
<label for="tags">Schlagwörter</label>
|
||||
<input type="text" id="tags" name="tags" placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||
<input type="text" id="tags" name="tags"
|
||||
value="<?php echo htmlspecialchars($_SESSION['old_tags'] ?? ''); unset($_SESSION['old_tags']); ?>"
|
||||
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
require_once "php/model/LocalUserDAO.php";
|
||||
|
||||
$dao = new LocalUserDAO();
|
||||
|
||||
/*
|
||||
Deregistrierung
|
||||
Funktion: Entfernt User aus Dummy-Daten und beendet Session
|
||||
*/
|
||||
|
||||
if (isset($_SESSION["user_email"])) {
|
||||
$dao->deleteUser($_SESSION["user_email"]);
|
||||
}
|
||||
|
||||
$_SESSION = [];
|
||||
session_destroy();
|
||||
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
+8
-3
@@ -17,6 +17,11 @@ include_once 'php/controller/home-controller.php';
|
||||
Dein Beitrag wurde erfolgreich veröffentlicht!
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_category"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Diese Kategorie ist nicht gültig.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
@@ -34,21 +39,21 @@ include_once 'php/controller/home-controller.php';
|
||||
<!-- Flexbox -->
|
||||
<div class="flexbox">
|
||||
<div class="container">
|
||||
<a href="index.php?pfad=informatik" class="category-link">Informatik</a>
|
||||
<a href="index.php?pfad=showCategory&category=informatik" class="category-link">Informatik</a>
|
||||
<div class="article-link">
|
||||
<a href="index.php?pfad=showArticle&id=<?php echo $dummy3->getId()?>"><?php if(isset($dummy3)){echo $dummy3->getTitle();}else{echo "Fehler: Beitrag nicht gefunden!";} ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<a href="index.php?pfad=mathe" class="category-link">Mathe</a>
|
||||
<a href="index.php?pfad=showCategory&category=mathe" class="category-link">Mathe</a>
|
||||
<div class="article-link">
|
||||
<a href="index.php?pfad=showArticle&id=<?php echo $dummy1->getId()?>"><?php if(isset($dummy1)){echo $dummy1->getTitle();}else{echo "Fehler: Beitrag nicht gefunden!";} ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<a href="index.php?pfad=physik" class="category-link">Physik</a>
|
||||
<a href="index.php?pfad=showCategory&category=physik" class="category-link">Physik</a>
|
||||
<div class="article-link">
|
||||
<a href="index.php?pfad=showArticle&id=<?php echo $dummy2->getId()?>"><?php if(isset($dummy2)){echo $dummy2->getTitle();}else{echo "Fehler: Beitrag nicht gefunden!";} ?></a>
|
||||
</div>
|
||||
|
||||
+33
-12
@@ -1,3 +1,7 @@
|
||||
<?php
|
||||
$error = $error ?? null;
|
||||
?>
|
||||
|
||||
<!--
|
||||
Form: Login-Bereich
|
||||
Funktion: Benutzerauthentifizierung und Zugang zum eigenen Profil, Erstellen von Beiträgen, etc.
|
||||
@@ -7,26 +11,43 @@
|
||||
|
||||
<h1>Bitte anmelden</h1>
|
||||
|
||||
<form>
|
||||
<label id ="inputEmail" class="screenreader-only">E-Mail Adresse / </label>
|
||||
<?php if ($error): ?>
|
||||
<p style="color:red;">
|
||||
<?php echo htmlspecialchars($error); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="index.php?pfad=login">
|
||||
|
||||
<p class="input-label">Benutzername/E-Mail-Adresse:</p>
|
||||
<input type="email" name="email" class="login-input" placeholder="E-Mail-Adresse" required autofocus>
|
||||
<input type="email"
|
||||
name="email"
|
||||
class="login-input"
|
||||
placeholder="E-Mail-Adresse"
|
||||
required
|
||||
autofocus>
|
||||
|
||||
<p class="input-label">Passwort:</p>
|
||||
<input type="password" name="password" class="login-input" placeholder="Passwort" required>
|
||||
<input type="password"
|
||||
name="password"
|
||||
class="login-input"
|
||||
placeholder="Passwort"
|
||||
required>
|
||||
|
||||
<div class="checkbox-wrapper">
|
||||
<label>
|
||||
<input type="checkbox" name="remember-me" value="1"> angemeldet bleiben
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" value="anmelden" name="loginSubmit" class="login-button">anmelden</button>
|
||||
<button type="submit"
|
||||
value="anmelden"
|
||||
name="loginSubmit"
|
||||
class="button">
|
||||
anmelden
|
||||
</button>
|
||||
|
||||
<div class="register-link">
|
||||
<a href="register.php">Noch keinen Account? Jetzt hier registrieren!</a>
|
||||
<a href="index.php?pfad=register">
|
||||
Noch keinen Account? Jetzt hier registrieren!
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$_SESSION = [];
|
||||
session_destroy();
|
||||
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
+116
-37
@@ -1,74 +1,144 @@
|
||||
<!--
|
||||
Content: Profil
|
||||
Inhalt: Das eigene Profil, wenn man angemeldet ist. Dort hat man die Möglichkeit seine Angaben zu ändern.
|
||||
-->
|
||||
<?php
|
||||
include_once 'php/controller/profileArticles-controller.php';
|
||||
include_once 'php/controller/profile-controller.php';
|
||||
|
||||
$user = $user ?? null;
|
||||
$isEditMode = (isset($_GET["edit"]) && $_GET["edit"] === "1") || !empty($error);
|
||||
?>
|
||||
|
||||
<main class="form-page">
|
||||
<div class="flexbox">
|
||||
<!-- Linke Spalte: Profildaten -->
|
||||
|
||||
<div class="container">
|
||||
<form>
|
||||
|
||||
<?php if (!empty($error)): ?>
|
||||
<p class="alert-message is-error">
|
||||
<?php echo htmlspecialchars($error); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="index.php?pfad=profile">
|
||||
|
||||
<label class="input-label">Vorname</label>
|
||||
<input type="text" name="Vorname" class="login-input" required
|
||||
placeholder="Vorname"
|
||||
value="<?php //DB-Daten ?>">
|
||||
<input type="text"
|
||||
name="vorname"
|
||||
class="login-input"
|
||||
value="<?php echo htmlspecialchars($_POST["vorname"] ?? $user["vorname"] ?? ""); ?>"
|
||||
<?php echo $isEditMode ? "" : "readonly"; ?>
|
||||
required>
|
||||
|
||||
<label class="input-label">Nachname</label>
|
||||
<input type="text" name="Nachname" class="login-input" required
|
||||
placeholder="Nachname"
|
||||
value="<?php //DB-Daten ?>">
|
||||
<input type="text"
|
||||
name="nachname"
|
||||
class="login-input"
|
||||
value="<?php echo htmlspecialchars($_POST["nachname"] ?? $user["nachname"] ?? ""); ?>"
|
||||
<?php echo $isEditMode ? "" : "readonly"; ?>
|
||||
required>
|
||||
|
||||
<label class="input-label">Email-Adresse</label>
|
||||
<input type="email" name="Email" class="login-input" required
|
||||
placeholder="mustermann@web.de"
|
||||
value="<?php //DB-Daten ?>">
|
||||
<input type="email"
|
||||
name="email"
|
||||
class="login-input"
|
||||
value="<?php echo htmlspecialchars($_POST["email"] ?? $user["email"] ?? ""); ?>"
|
||||
<?php echo $isEditMode ? "" : "readonly"; ?>
|
||||
required>
|
||||
|
||||
<label class="input-label">Passwort</label>
|
||||
<input type="password" name="Passwort" class="login-input"
|
||||
required placeholder="Passwort">
|
||||
<label class="input-label">
|
||||
<?php echo $isEditMode ? "Neues Passwort" : "Passwort"; ?>
|
||||
</label>
|
||||
|
||||
<button type="submit" class="login-button">
|
||||
Speichern
|
||||
</button>
|
||||
<?php if ($isEditMode): ?>
|
||||
<input type="password"
|
||||
name="password"
|
||||
class="login-input"
|
||||
placeholder="Leer lassen, wenn es gleich bleiben soll">
|
||||
<?php else: ?>
|
||||
<input type="password"
|
||||
name="password"
|
||||
class="login-input"
|
||||
value="********"
|
||||
readonly>
|
||||
<?php endif; ?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<?php if ($isEditMode): ?>
|
||||
<button type="submit"
|
||||
name="saveProfile"
|
||||
class="button">
|
||||
Speichern
|
||||
</button>
|
||||
|
||||
<a href="index.php?pfad=profile" class="button">
|
||||
Abbrechen
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a href="index.php?pfad=profile&edit=1" class="button">
|
||||
Bearbeiten
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<button type="button" class="login-button delete-account-button">
|
||||
Account löschen
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<br>
|
||||
|
||||
<a href="index.php?pfad=deleteAccount" class="button">
|
||||
Account löschen
|
||||
</a>
|
||||
|
||||
<br><br>
|
||||
|
||||
<a href="index.php?pfad=logout" class="button">
|
||||
Abmelden
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Rechte Spalte: Eigene Beiträge -->
|
||||
<div class="container">
|
||||
<h2 class="section-title">Meine Beiträge</h2>
|
||||
|
||||
<div class="articles-list">
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein interner Fehler aufgetreten. Bitte versuche es erneut.
|
||||
</p>
|
||||
|
||||
<?php elseif (isset($userArticles) && count($userArticles) > 0): ?>
|
||||
|
||||
<?php foreach ($userArticles as $userArticle): ?>
|
||||
<!-- Ein einzelner Artikel-Eintrag -->
|
||||
<div class="article-item">
|
||||
<div class="article-meta">
|
||||
<span class="article-date"><?php echo htmlspecialchars($userArticle->getCreationDate()); ?></span>
|
||||
<span class="article-category"><?php echo htmlspecialchars($userArticle->getCategory()); ?></span>
|
||||
<span class="article-date">
|
||||
<?php echo htmlspecialchars($userArticle->getCreationDate()); ?>
|
||||
</span>
|
||||
|
||||
<span class="article-category">
|
||||
<?php echo htmlspecialchars($userArticle->getCategory()); ?>
|
||||
</span>
|
||||
</div>
|
||||
<h3 class="article-title"><?php echo htmlspecialchars($userArticle->getTitle()); ?></h3>
|
||||
|
||||
<h3 class="article-title">
|
||||
<?php echo htmlspecialchars($userArticle->getTitle()); ?>
|
||||
</h3>
|
||||
|
||||
<?php
|
||||
$tags = $userArticle->getTags();
|
||||
if (isset($tags) && !empty($tags)): ?>
|
||||
if (isset($tags) && !empty($tags)):
|
||||
?>
|
||||
<div class="article-view-bottom-section">
|
||||
<div class="article-view-tags-label">Tags:</div>
|
||||
|
||||
<div class="article-view-tags-list">
|
||||
<?php
|
||||
$tagArray = is_array($tags) ? $tags : explode(',', $tags);
|
||||
|
||||
foreach ($tagArray as $tag):
|
||||
$trimmedTag = trim($tag);
|
||||
|
||||
if (!empty($trimmedTag)):
|
||||
?>
|
||||
<span class="article-view-tag-item"><?php echo htmlspecialchars($trimmedTag); ?></span>
|
||||
<span class="article-view-tag-item">
|
||||
<?php echo htmlspecialchars($trimmedTag); ?>
|
||||
</span>
|
||||
<?php
|
||||
endif;
|
||||
endforeach;
|
||||
@@ -76,18 +146,27 @@ include_once 'php/controller/profileArticles-controller.php';
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<a href="index.php?pfad=updateArticle&id=<?php echo $userArticle->getID(); ?>" class="edit-link-button">Bearbeiten</a>
|
||||
|
||||
<a href="index.php?pfad=updateArticle&id=<?php echo $userArticle->getID(); ?>"
|
||||
class="edit-link-button">
|
||||
Bearbeiten
|
||||
</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<p>Du hast noch keine Beiträge erstellt.</p>
|
||||
<button type="button" class="login-button" onclick="window.location.href='index.php?pfad=createArticle';">
|
||||
|
||||
<button type="button"
|
||||
class="button"
|
||||
onclick="window.location.href='index.php?pfad=createArticle';">
|
||||
Beitrag erstellen!
|
||||
</button>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
|
||||
<?php unset($_SESSION["message"]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+42
-11
@@ -1,3 +1,7 @@
|
||||
<?php
|
||||
$error = $error ?? null;
|
||||
?>
|
||||
|
||||
<!--
|
||||
Form: Registrierung
|
||||
Funktion: Erstellung neuer Benutzerkonten
|
||||
@@ -7,26 +11,53 @@
|
||||
|
||||
<h1>Jetzt Registrieren!</h1>
|
||||
|
||||
<form>
|
||||
<?php if (!empty($error)): ?>
|
||||
<p class="alert-message is-error" style="color:red;">
|
||||
<?php echo htmlspecialchars($error); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="index.php?pfad=register">
|
||||
|
||||
<p class="input-label">Email:</p>
|
||||
<input type="email" name="email" class="login-input" placeholder="mustermann@web.de" required>
|
||||
<input type="email"
|
||||
name="email"
|
||||
class="login-input"
|
||||
placeholder="mustermann@web.de"
|
||||
value="<?php echo htmlspecialchars($_POST["email"] ?? ""); ?>"
|
||||
required>
|
||||
|
||||
<p class="input-label">Vorname:</p>
|
||||
<input type="text" name="vorname" class="login-input" placeholder="Max" required>
|
||||
<input type="text"
|
||||
name="vorname"
|
||||
class="login-input"
|
||||
placeholder="Max"
|
||||
value="<?php echo htmlspecialchars($_POST["vorname"] ?? ""); ?>"
|
||||
required>
|
||||
|
||||
<p class="input-label">Nachname:</p>
|
||||
<input type="text" name="nachname" class="login-input" placeholder="Mustermann" required>
|
||||
<input type="text"
|
||||
name="nachname"
|
||||
class="login-input"
|
||||
placeholder="Mustermann"
|
||||
value="<?php echo htmlspecialchars($_POST["nachname"] ?? ""); ?>"
|
||||
required>
|
||||
|
||||
<p class="input-label">Passwort:</p>
|
||||
<input type="password" name="password" class="login-input" placeholder="Passwort" required>
|
||||
<input type="password"
|
||||
name="password"
|
||||
class="login-input"
|
||||
placeholder="Passwort"
|
||||
required>
|
||||
|
||||
<div class="checkbox-wrapper">
|
||||
<label>
|
||||
<input type="checkbox" value="remember-me"> angemeldet bleiben
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit"
|
||||
value="register"
|
||||
name="registerSubmit"
|
||||
class="button">
|
||||
kostenlos registrieren
|
||||
</button>
|
||||
|
||||
<button type="submit" value="anmelden" name="loginSubmit" class="login-button">kostenlos registrieren</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
+60
-69
@@ -1,5 +1,10 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
$results = $_SESSION["search_results"] ?? [];
|
||||
$query = $_SESSION["search_query"] ?? "";
|
||||
$resultCount = count($results);
|
||||
|
||||
?>
|
||||
<!--
|
||||
Seite: Suchergebnisse
|
||||
@@ -10,37 +15,40 @@ session_start();
|
||||
<!-- Links: Seitenleiste für Filter und Suche -->
|
||||
<aside class="s-res-sidebar">
|
||||
|
||||
<!-- Suchleiste Box -->
|
||||
<div class="s-res-sidebar-box">
|
||||
<h3 class="s-res-sidebar-title">Suche anpassen</h3>
|
||||
<form action="#" method="GET" class="s-res-search-form">
|
||||
<input type="search" id="site-search" name="q" placeholder="Suchen..." class="nav__search">
|
||||
<button type="submit" class="nav__search-button">Suchen</button>
|
||||
</form>
|
||||
</div>
|
||||
<!-- Sortierfuntion Box und Such Box-->
|
||||
<form action="php/controller/search-results-controller.php" method="GET" class="s-res-sidebar-form">
|
||||
|
||||
<!-- Sortierfuntion Box -->
|
||||
<div class="s-res-sidebar-box">
|
||||
<h3 class="s-res-sidebar-title">Sortierung</h3>
|
||||
<div class="s-res-filter-group">
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="alphabet" checked>
|
||||
<span>Alphabetisch</span>
|
||||
</label>
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="likes">
|
||||
<span>Beliebtheit (Likes)</span>
|
||||
</label>
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="newest">
|
||||
<span>Neueste Beiträge</span>
|
||||
</label>
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="oldest">
|
||||
<span>Älteste Beiträge</span>
|
||||
</label>
|
||||
<div class="s-res-sidebar-box">
|
||||
<h3 class="s-res-sidebar-title">Suche anpassen</h3>
|
||||
<input type="search" id="site-search" name="q" placeholder="Suchen..." class="nav__search" value="<?php echo htmlspecialchars($query); ?>" maxlength="50" required>
|
||||
<button type="submit" class="nav__search-button">Suchen</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="s-res-sidebar-box">
|
||||
<h3 class="s-res-sidebar-title">Sortierung</h3>
|
||||
<?php $currentSort = $_SESSION['search_sort'] ?? 'alphabet'; ?>
|
||||
<div class="s-res-filter-group">
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="alphabet" <?php echo $currentSort === 'alphabet' ? 'checked' : ''; ?> onchange="this.form.submit()">
|
||||
<span>Alphabetisch</span>
|
||||
</label>
|
||||
<!-- Noch disabled, da likes noch nicht implementiert-->
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="likes" <?php echo $currentSort === 'likes' ? 'checked' : ''; ?> disabled>
|
||||
<span style="color: #94a3b8;">Beliebtheit (Likes)</span>
|
||||
</label>
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="newest" <?php echo $currentSort === 'newest' ? 'checked' : ''; ?> onchange="this.form.submit()">
|
||||
<span>Neueste Beiträge</span>
|
||||
</label>
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="oldest" <?php echo $currentSort === 'oldest' ? 'checked' : ''; ?> onchange="this.form.submit()">
|
||||
<span>Älteste Beiträge</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</aside>
|
||||
|
||||
@@ -48,57 +56,40 @@ session_start();
|
||||
|
||||
<div class="s-res-header">
|
||||
<h1 class="s-res-main-title">Suchergebnisse</h1>
|
||||
<p class="s-res-meta">3 Treffer für Ihre Suchanfrage</p>
|
||||
<p class="s-res-meta"><?php echo $resultCount; ?> Treffer für Ihre Suchanfrage "<?php echo htmlspecialchars($query); ?>"</p>
|
||||
</div>
|
||||
|
||||
<!-- Ergebnisliste -->
|
||||
<div class="s-res-list">
|
||||
<?php
|
||||
if (!empty($results)): ?>
|
||||
|
||||
<?php foreach ($results as $item): ?>
|
||||
<div class="s-res-item">
|
||||
<div class="s-res-content">
|
||||
<h2 class="s-res-item-title">
|
||||
<a href="index.php?pfad=showArticle&id=<?php echo $item['id']; ?>" class="s-res-link">
|
||||
<?php echo htmlspecialchars($item['title']); ?>
|
||||
</a>
|
||||
</h2>
|
||||
<p class="s-res-author">Von: <span class="s-res-author-name"><?php echo htmlspecialchars($item['author']); ?></span></p>
|
||||
</div>
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php
|
||||
if(isset($_SESSION['message']) && $_SESSION['message'] == "new_search_results"): ?>
|
||||
<!-- TODO: Hier die Beiträge ausgeben. -->
|
||||
<?php elseif (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||
<p>
|
||||
Bitte überprüfe deine Sucheingabe und versuche es erneut!
|
||||
</p>
|
||||
elseif (isset($_SESSION["search_query"]) && $_SESSION["search_query"] !== "" && $resultCount === 0): ?>
|
||||
<p>Keine Beiträge zu diesem Suchbegriff gefunden.</p>
|
||||
<?php
|
||||
elseif (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||
<p>Bitte überprüfe deine Sucheingabe und versuche es erneut!</p>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
|
||||
<!-- Beispielbeitrag -->
|
||||
<div class="s-res-item">
|
||||
<div class="s-res-content">
|
||||
<h2 class="s-res-item-title">
|
||||
<a href="#" class="s-res-link">Pythagoras</a>
|
||||
</h2>
|
||||
<p class="s-res-author">Von: <span class="s-res-author-name">Max Mustermann</span></p>
|
||||
</div>
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
|
||||
<!-- Beispielbeitrag -->
|
||||
<div class="s-res-item">
|
||||
<div class="s-res-content">
|
||||
<h2 class="s-res-item-title">
|
||||
<a href="#" class="s-res-link">Pythagoras</a>
|
||||
</h2>
|
||||
<p class="s-res-author">Von: <span class="s-res-author-name">Max Mustermann</span></p>
|
||||
</div>
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
|
||||
<!-- Beispielbeitrag -->
|
||||
<div class="s-res-item">
|
||||
<div class="s-res-content">
|
||||
<h2 class="s-res-item-title">
|
||||
<a href="#" class="s-res-link">Pythagoras</a>
|
||||
</h2>
|
||||
<p class="s-res-author">Von: <span class="s-res-author-name">Max Mustermann</span></p>
|
||||
</div>
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="s-res-pagination-footer">
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
include_once 'php/controller/showArticle-controller.php';
|
||||
?>
|
||||
<!--
|
||||
Seite: Anzeige für Beiträge
|
||||
Funktion: Stellt einen übergebenen Beitrag dar.
|
||||
-->
|
||||
|
||||
<?php
|
||||
include_once 'php/controller/showArticle-controller.php';
|
||||
?>
|
||||
|
||||
<!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) -->
|
||||
<main class="article-view-container">
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
include_once "php/controller/showCategory-controller.php";
|
||||
?>
|
||||
|
||||
<main>
|
||||
|
||||
<h1><?php if (isset($category) && !empty($category)){ echo htmlspecialchars($category); } ?></h1>
|
||||
|
||||
<div class="s-res-list">
|
||||
<?php
|
||||
if (!empty($articles)): ?>
|
||||
<?php foreach ($articles as $article): ?>
|
||||
<div class="s-res-item">
|
||||
<div class="s-res-content">
|
||||
<h2 class="s-res-item-title">
|
||||
<a href="index.php?pfad=showArticle&id=<?php echo $article->getId(); ?>" class="s-res-link">
|
||||
<?php echo htmlspecialchars($article->getTitle()); ?>
|
||||
</a>
|
||||
</h2>
|
||||
<p class="s-res-author">Von: <span class="s-res-author-name"><?php echo htmlspecialchars($article->getAuthor()); ?></span></p>
|
||||
</div>
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
else: ?>
|
||||
<p> Es sind noch keine Beiträge in dieser Kategorie enthalten.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
$user = $user ?? null;
|
||||
if (!isset($_SESSION["user"])) {
|
||||
header("Location: index.php?pfad=login");
|
||||
exit();
|
||||
}
|
||||
include_once 'php/controller/showArticle-controller.php';
|
||||
?>
|
||||
<!--
|
||||
@@ -23,12 +28,57 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_title"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_content"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Der Text erlaubt eine Länge von 10 bis maximal 7.000 Zeichen (ca. 1.000 Wörter).
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_category"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Die ausgewählte Kategorie ist ungültig.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_tags"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Ungültige Schlagworte gefunden. Erlaubt sind nur Buchstaben, Zahlen, Leerzeichen und Bindestriche (2-20 Zeichen).
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "validation_missing"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Bei der Validierung deiner Daten ist ein Fehler aufgetreten. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "unauthorized_access"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Sie sind nicht berechtigt, diesen Beitrag zu bearbeiten.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
<input type="text" id="title" name="title" value="<?php if (isset($title) && !empty($title)){echo htmlspecialchars($title);} ?>" placeholder="Titel hier eingeben" required>
|
||||
<input type="text" id="title" name="title"
|
||||
value="<?php
|
||||
if (isset($title) && !empty($title)){echo htmlspecialchars($title);
|
||||
}elseif (isset($_SESSION['old_title']) && !empty($_SESSION['old_title'])){
|
||||
echo htmlspecialchars($_SESSION['old_title']);
|
||||
unset($_SESSION['old_title']);
|
||||
}
|
||||
|
||||
?>"
|
||||
placeholder="Titel hier eingeben" required>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
||||
<?php if (isset($content) && !empty($content)){echo htmlspecialchars($content);} ?>
|
||||
<?php
|
||||
if (isset($content) && !empty($content)){echo htmlspecialchars($content);
|
||||
}elseif (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){
|
||||
echo htmlspecialchars($_SESSION['old_content']);
|
||||
unset($_SESSION['old_content']);
|
||||
}
|
||||
?>
|
||||
</textarea>
|
||||
</main>
|
||||
|
||||
@@ -36,7 +86,7 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
<aside class="editor-sidebar">
|
||||
|
||||
<div class="sidebar-block">
|
||||
<button type="submit" class="btn-publish">Änderungen speichern</button>
|
||||
<button type="submit" id="editor-button" class="button">Änderungen speichern</button>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-block">
|
||||
@@ -86,7 +136,15 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
|
||||
<div class="sidebar-block">
|
||||
<label for="tags">Schlagwörter</label>
|
||||
<input type="text" id="tags" name="tags" value="<?php if (isset($tags) && !empty($tags)){echo htmlspecialchars($tags);} ?>" placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||
<input type="text" id="tags" name="tags"
|
||||
value="<?php
|
||||
if (isset($tags) && !empty($tags)){echo htmlspecialchars($tags);
|
||||
} elseif (isset($_SESSION['old_tags']) && !empty($_SESSION['old_tags'])){
|
||||
echo htmlspecialchars($_SESSION['old_tags']);
|
||||
unset($_SESSION['old_tags']);
|
||||
}
|
||||
?>"
|
||||
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
|
||||
+2
-14
@@ -86,20 +86,8 @@
|
||||
}
|
||||
|
||||
/* Button-Zeugs */
|
||||
.article-editor-scope .btn-publish {
|
||||
background-color: #007cba;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.article-editor-scope .btn-publish:hover {
|
||||
background-color: #006ba1;
|
||||
.button#editor-button {
|
||||
padding: 18px 12px;
|
||||
}
|
||||
|
||||
/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */
|
||||
|
||||
+6
-2
@@ -22,6 +22,10 @@ a, button, input, select, textarea, label, main{
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.flexbox {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -155,7 +159,7 @@ a, button, input, select, textarea, label, main{
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.login-button {
|
||||
.button {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background-color: #2563eb;
|
||||
@@ -168,7 +172,7 @@ a, button, input, select, textarea, label, main{
|
||||
transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.login-button:hover {
|
||||
.button:hover {
|
||||
background-color: #1d4ed8;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 10px rgba(0,0,0,0.15);
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ CSS für die navbar
|
||||
}
|
||||
|
||||
/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */
|
||||
@media (max-width: 760px) {
|
||||
@media (max-width: 800px) {
|
||||
.nav {
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -1,55 +0,0 @@
|
||||
<!--
|
||||
Artikel: Datenschutz vs Datensicherheit
|
||||
Funktion: Inhalt zum Fach Informatik
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="EduForge">
|
||||
<meta name="author" content="Niklas Ortmann">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<title>EduForge</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
include_once 'includes/navbar.php';
|
||||
?>
|
||||
<main>
|
||||
|
||||
<h1>Datenschutz vs Datensicherheit</h1>
|
||||
|
||||
<p>
|
||||
Datenschutz ist in unserer digital vernetzten Welt allgegenwärtig – ob in sozialen Netzwerken, beim
|
||||
Online-Shopping oder dem Einsatz von Bonuskarten, bei der Auswertung von Konsumverhalten und selbstverständlich
|
||||
auch im schulischen Kontext.
|
||||
</p>
|
||||
<h2>
|
||||
Was ist Datenschutz?
|
||||
</h2>
|
||||
<p>
|
||||
Datenschutz bedeutet, dass persönliche Daten nur gesammelt, gespeichert und verwendet werden dürfen, wenn
|
||||
es wirklich nötig ist – und nur für klar festgelegte Zwecke. Es geht darum, die Privatsphäre von Menschen
|
||||
zu schützen.
|
||||
</p>
|
||||
<h2>
|
||||
Was ist Datenschutz?
|
||||
</h2>
|
||||
<p>
|
||||
Datensicherheit umfasst alle technischen und organisatorischen Maßnahmen, die verhindern sollen, dass Daten
|
||||
verloren gehen, beschädigt oder unbemerkt verändert werden. Sie schützt Informationen vor Missbrauch.
|
||||
</p>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
include_once 'includes/footer.php';
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+111
-68
@@ -1,74 +1,88 @@
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
|
||||
<!--
|
||||
Globales Menü, wird via PHP später in alle Seiten eingebunden
|
||||
-->
|
||||
<nav class="nav">
|
||||
<div class="nav__left">
|
||||
<a href="index.php" class="nav__logo">
|
||||
<img src="images/logos/logo_full.png" alt="Logo">
|
||||
</a>
|
||||
<img src="images/logos/logo_full.png" alt="Logo">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Mobile navbar mit Burger-Symbol -->
|
||||
<input type="checkbox" id="nav-toggle" class="nav__checkbox">
|
||||
<label for="nav-toggle" id="mobile-nav">
|
||||
<span>☰</span> <!-- Burger Icon Symbol -->
|
||||
<span>☰</span>
|
||||
</label>
|
||||
|
||||
<ul id="mobile-nav" class="nav__mobile-menu">
|
||||
<li>
|
||||
<label for="nav-toggle" class="nav__close-btn">×</label>
|
||||
</li>
|
||||
<li><a href="index.php?pfad=profile">Profil</a></li>
|
||||
<li><a href="index.php?pfad=login">Anmelden</a></li>
|
||||
<li><a href="index.php?pfad=register">Registrieren</a></li>
|
||||
<li><a href="index.php?pfad=createArticle">Beitrag erstellen</a></li>
|
||||
|
||||
<?php if (isset($_SESSION['user'])): ?>
|
||||
|
||||
<li><a href="index.php?pfad=profile">Profil</a></li>
|
||||
<li><a href="index.php?pfad=logout">Abmelden</a></li>
|
||||
<li><a href="index.php?pfad=createArticle">Beitrag erstellen</a></li>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<li><a href="index.php?pfad=login">Anmelden</a></li>
|
||||
<li><a href="index.php?pfad=register">Registrieren</a></li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<li>
|
||||
<label class="nav__mobile-label">Sprachen</label>
|
||||
<ul class="nav__mobile-submenu">
|
||||
<li><a href="index.php?pfad=deutsch">Deutsch</a></li>
|
||||
<li><a href="index.php?pfad=englisch">Englisch</a></li>
|
||||
<li><a href="index.php?pfad=franzoesisch">Französisch</a></li>
|
||||
<li><a href="index.php?pfad=latein">Latein</a></li>
|
||||
<li><a href="index.php?pfad=literatur">Literatur</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=deutsch">Deutsch</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=englisch">Englisch</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=franzoesisch">Französisch</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=latein">Latein</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=literatur">Literatur</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label class="nav__mobile-label">MINT</label>
|
||||
<ul class="nav__mobile-submenu">
|
||||
<li><a href="index.php?pfad=mathe">Mathematik</a></li>
|
||||
<li><a href="index.php?pfad=biologie">Biologie</a></li>
|
||||
<li><a href="index.php?pfad=chemie">Chemie</a></li>
|
||||
<li><a href="index.php?pfad=englisch">Physik</a></li>
|
||||
<li><a href="index.php?pfad=informatik">Informatik</a></li>
|
||||
<li><a href="index.php?pfad=astronomie">Astronomie</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=mathe">Mathematik</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=biologie">Biologie</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=chemie">Chemie</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=physik">Physik</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=informatik">Informatik</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=astronomie">Astronomie</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label class="nav__mobile-label">Gesellschaft & Werte</label>
|
||||
<ul class="nav__mobile-submenu">
|
||||
<li><a href="index.php?pfad=geschichte">Geschichte</a></li>
|
||||
<li><a href="index.php?pfad=erdkunde">Erdkunde</a></li>
|
||||
<li><a href="index.php?pfad=sozialkunde">Sozialkunde</a></li>
|
||||
<li><a href="index.php?pfad=wirtschaft">Wirtschaftskunde</a></li>
|
||||
<li><a href="index.php?pfad=religion">Religion</a></li>
|
||||
<li><a href="index.php?pfad=ethik">Ethikunterricht</a></li>
|
||||
<li><a href="index.php?pfad=philosophie">Philosophie</a></li>
|
||||
<li><a href="index.php?pfad=psychologie">Psychologie</a></li>
|
||||
<li><a href="index.php?pfad=kunst">Kunst</a></li>
|
||||
<li><a href="index.php?pfad=musik">Musik</a></li>
|
||||
<li><a href="index.php?pfad=theater">Theater</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=geschichte">Geschichte</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=erdkunde">Erdkunde</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=sozialkunde">Sozialkunde</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=wirtschaft">Wirtschaftskunde</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=religion">Religion</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=ethik">Ethikunterricht</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=philosophie">Philosophie</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=psychologie">Psychologie</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=kunst">Kunst</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=musik">Musik</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=theater">Theater</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label class="nav__mobile-label">Technik & Praxis</label>
|
||||
<ul class="nav__mobile-submenu">
|
||||
<li><a href="index.php?pfad=technik">Technik</a></li>
|
||||
<li><a href="index.php?pfad=werken">Werken</a></li>
|
||||
<li><a href="index.php?pfad=hauswirtschaft">Hauswirtschaft</a></li>
|
||||
<li><a href="index.php?pfad=sport">Sport</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=technik">Technik</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=werken">Werken</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=hauswirtschaft">Hauswirtschaft</a></li>
|
||||
<li><a href="index.php?pfad=showCategory&category=sport">Sport</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -78,60 +92,89 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
||||
<div class="nav__item nav__dropdown">
|
||||
<button class="nav__dropdown-toggle">Sprachen</button>
|
||||
<div class="nav__dropdown-menu">
|
||||
<a href="index.php?pfad=deutsch">Deutsch</a>
|
||||
<a href="index.php?pfad=englisch">Englisch</a>
|
||||
<a href="index.php?pfad=franzoesisch">Französisch</a>
|
||||
<a href="index.php?pfad=latein">Latein</a>
|
||||
<a href="index.php?pfad=literatur">Literatur</a>
|
||||
<a href="index.php?pfad=showCategory&category=deutsch">Deutsch</a>
|
||||
<a href="index.php?pfad=showCategory&category=englisch">Englisch</a>
|
||||
<a href="index.php?pfad=showCategory&category=franzoesisch">Französisch</a>
|
||||
<a href="index.php?pfad=showCategory&category=latein">Latein</a>
|
||||
<a href="index.php?pfad=showCategory&category=literatur">Literatur</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav__item nav__dropdown">
|
||||
<button class="nav__dropdown-toggle">MINT</button>
|
||||
<div class="nav__dropdown-menu">
|
||||
<a href="index.php?pfad=mathe">Mathematik</a>
|
||||
<a href="index.php?pfad=biologie">Biologie</a>
|
||||
<a href="index.php?pfad=chemie">Chemie</a>
|
||||
<a href="index.php?pfad=physik">Physik</a>
|
||||
<a href="index.php?pfad=informatik">Informatik</a>
|
||||
<a href="index.php?pfad=astronomie">Astronomie</a>
|
||||
<a href="index.php?pfad=showCategory&category=mathe">Mathematik</a>
|
||||
<a href="index.php?pfad=showCategory&category=biologie">Biologie</a>
|
||||
<a href="index.php?pfad=showCategory&category=chemie">Chemie</a>
|
||||
<a href="index.php?pfad=showCategory&category=physik">Physik</a>
|
||||
<a href="index.php?pfad=showCategory&category=informatik">Informatik</a>
|
||||
<a href="index.php?pfad=showCategory&category=astronomie">Astronomie</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav__item nav__dropdown">
|
||||
<button class="nav__dropdown-toggle">Gesellschaft & Werte</button>
|
||||
<div class="nav__dropdown-menu">
|
||||
<a href="index.php?pfad=geschichte">Geschichte</a>
|
||||
<a href="index.php?pfad=erdkunde">Erdkunde</a>
|
||||
<a href="index.php?pfad=sozialkunde">Sozialkunde</a>
|
||||
<a href="index.php?pfad=wirtschaft">Wirtschaftskunde</a>
|
||||
<a href="index.php?pfad=religion">Religion</a>
|
||||
<a href="index.php?pfad=ethik">Ethikunterricht</a>
|
||||
<a href="index.php?pfad=philosophie">Philosophie</a>
|
||||
<a href="index.php?pfad=psychologie">Psychologie</a>
|
||||
<a href="index.php?pfad=kunst">Kunst</a>
|
||||
<a href="index.php?pfad=musik">Musik</a>
|
||||
<a href="index.php?pfad=theater">Theater</a>
|
||||
<a href="index.php?pfad=showCategory&category=geschichte">Geschichte</a>
|
||||
<a href="index.php?pfad=showCategory&category=erdkunde">Erdkunde</a>
|
||||
<a href="index.php?pfad=showCategory&category=sozialkunde">Sozialkunde</a>
|
||||
<a href="index.php?pfad=showCategory&category=wirtschaft">Wirtschaftskunde</a>
|
||||
<a href="index.php?pfad=showCategory&category=religion">Religion</a>
|
||||
<a href="index.php?pfad=showCategory&category=ethik">Ethikunterricht</a>
|
||||
<a href="index.php?pfad=showCategory&category=philosophie">Philosophie</a>
|
||||
<a href="index.php?pfad=showCategory&category=psychologie">Psychologie</a>
|
||||
<a href="index.php?pfad=showCategory&category=kunst">Kunst</a>
|
||||
<a href="index.php?pfad=showCategory&category=musik">Musik</a>
|
||||
<a href="index.php?pfad=showCategory&category=theater">Theater</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav__item nav__dropdown">
|
||||
<button class="nav__dropdown-toggle">Technik & Praxis</button>
|
||||
<div class="nav__dropdown-menu">
|
||||
<a href="index.php?pfad=technik">Technik</a>
|
||||
<a href="index.php?pfad=werken">Werken</a>
|
||||
<a href="index.php?pfad=hauswirtschaft">Hauswirtschaft</a>
|
||||
<a href="index.php?pfad=sport">Sport</a>
|
||||
<a href="index.php?pfad=showCategory&category=technik">Technik</a>
|
||||
<a href="index.php?pfad=showCategory&category=werken">Werken</a>
|
||||
<a href="index.php?pfad=showCategory&category=hauswirtschaft">Hauswirtschaft</a>
|
||||
<a href="index.php?pfad=showCategory&category=sport">Sport</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav__right">
|
||||
<a href="index.php?pfad=profile" class="nav_item nav__link">Profil</a>
|
||||
<div class="nav__search">
|
||||
<?php
|
||||
include_once 'search.php';
|
||||
?>
|
||||
</div>
|
||||
<a href="index.php?pfad=login" class="nav__item nav__button">Anmelden</a>
|
||||
<a href="index.php?pfad=register" class="nav__item nav__button">Registrieren</a>
|
||||
<a href="index.php?pfad=createArticle" class="nav__item nav__button">Beitrag erstellen</a>
|
||||
|
||||
<?php if (isset($_SESSION['user'])): ?>
|
||||
|
||||
<a href="index.php?pfad=profile" class="nav__item nav__link">
|
||||
Profil
|
||||
</a>
|
||||
|
||||
<div class="nav__search">
|
||||
<?php include_once 'search.php'; ?>
|
||||
</div>
|
||||
|
||||
<a href="index.php?pfad=createArticle" class="nav__item nav__button">
|
||||
Beitrag erstellen
|
||||
</a>
|
||||
|
||||
<a href="index.php?pfad=logout" class="nav__item nav__button">
|
||||
Abmelden
|
||||
</a>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<div class="nav__search">
|
||||
<?php include_once 'search.php'; ?>
|
||||
</div>
|
||||
|
||||
<a href="index.php?pfad=login" class="nav__item nav__button">
|
||||
Anmelden
|
||||
</a>
|
||||
|
||||
<a href="index.php?pfad=register" class="nav__item nav__button">
|
||||
Registrieren
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
+7
-2
@@ -2,5 +2,10 @@
|
||||
Suchleiste. Wird via PHP später in alle Seiten eingebunden
|
||||
-->
|
||||
<!--<label for="site-search">Suche</label>-->
|
||||
<input type="search" id="site-search" name="q" placeholder="Suchen..." class="nav__search">
|
||||
<button type="submit" class="nav__search-button">Suchen</button>
|
||||
<form action="php/controller/search-results-controller.php" method="GET" class="search-form" style="display: flex; align-items: center; gap: 5px;">
|
||||
|
||||
<input type="hidden" name="pfad" value="search-results">
|
||||
|
||||
<input type="search" id="site-search" name="q" placeholder="Suchen..." class="nav__search" maxlength="50" required>
|
||||
<button type="submit" class="nav__search-button">Suchen</button>
|
||||
</form>
|
||||
|
||||
@@ -1,52 +1,77 @@
|
||||
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($abs_path)) {
|
||||
require_once "path.php";
|
||||
ob_start();
|
||||
|
||||
$pfad = $_GET["pfad"] ?? "home";
|
||||
|
||||
/*
|
||||
Controller für Aktionen werden vor der HTML-Ausgabe geladen,
|
||||
damit Weiterleitungen mit header() funktionieren.
|
||||
*/
|
||||
if ($pfad === "login") {
|
||||
include_once "php/controller/login-controller.php";
|
||||
}
|
||||
|
||||
if ($pfad === "register") {
|
||||
include_once "php/controller/register-controller.php";
|
||||
}
|
||||
|
||||
if ($pfad === "logout") {
|
||||
include_once "content/logout.php";
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($pfad === "deleteAccount") {
|
||||
include_once "content/deleteAccount.php";
|
||||
exit();
|
||||
}
|
||||
require_once $abs_path . "/php/controller/index-controller.php";
|
||||
?>
|
||||
|
||||
<!--
|
||||
Seite: Index der Lernplattform
|
||||
Funktion: Webseitengerüst, Anzeigen von Content
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<!--
|
||||
Seite: Index der Lernplattform
|
||||
Funktion: Webseitengerüst, Anzeigen von Content
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="EduForge">
|
||||
<meta name="author" content="Niklas Ortmann">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<link rel="stylesheet" href="css/search-results.css">
|
||||
<link rel="stylesheet" href="css/createArticle.css">
|
||||
<link rel="stylesheet" href="css/profile.css">
|
||||
<link rel="stylesheet" href="css/showArticle.css">
|
||||
<link rel="stylesheet" href="css/message.css">
|
||||
<title>EduForge</title>
|
||||
</head>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="EduForge">
|
||||
<meta name="author" content="Niklas Ortmann">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<link rel="stylesheet" href="css/search-results.css">
|
||||
<link rel="stylesheet" href="css/createArticle.css">
|
||||
<link rel="stylesheet" href="css/profile.css">
|
||||
<link rel="stylesheet" href="css/showArticle.css">
|
||||
<link rel="stylesheet" href="css/message.css">
|
||||
<title>EduForge</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
include_once 'includes/navbar.php';
|
||||
//Dynamischer Inhalt:
|
||||
if (isset($_GET["pfad"])) {
|
||||
if (file_exists($abs_path . '/content/' . $_GET["pfad"] . '.php')) {
|
||||
include_once $abs_path . '/content/' . $_GET["pfad"] . '.php';
|
||||
} else {
|
||||
include_once $abs_path . '/content/404.php';
|
||||
}
|
||||
} else {
|
||||
include_once $abs_path . '/content/home.php';
|
||||
}
|
||||
include_once $abs_path . '/includes/footer.php';
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
/*
|
||||
Dynamischer Inhalt:
|
||||
Je nach pfad-Parameter wird die passende Datei aus content geladen.
|
||||
*/
|
||||
if (file_exists('content/' . $pfad . '.php')) {
|
||||
include_once 'content/' . $pfad . '.php';
|
||||
} else {
|
||||
include_once 'content/404.php';
|
||||
}
|
||||
|
||||
include_once 'includes/footer.php';
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
ob_end_flush();
|
||||
?>
|
||||
@@ -1,32 +1,89 @@
|
||||
<?php
|
||||
session_start();
|
||||
SESSION_START();
|
||||
require_once '../model/LocalArticleManager.php';
|
||||
require_once '../model/ArticleManager.php';
|
||||
require_once '../validator/article-validator.php';
|
||||
require_once "../model/LocalUserDAO.php";
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
||||
$_SESSION["message"] = "missing_parameters";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
} else {
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
||||
$_SESSION["old_content"] = $_POST["content"] ?? '';
|
||||
$_SESSION["old_category"] = $_POST["category"] ?? '';
|
||||
$_SESSION["old_tags"] = $_POST["tags"] ?? '';
|
||||
|
||||
$title = $_POST["title"];
|
||||
$content = $_POST["content"];
|
||||
$category = $_POST["category"];
|
||||
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
||||
$tags = $_POST["tags"];
|
||||
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
||||
$_SESSION["message"] = "missing_parameters";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
exit();
|
||||
} else {
|
||||
$title = $_POST["title"];
|
||||
$content = $_POST["content"];
|
||||
$author = $_SESSION["user_email"];
|
||||
$category = $_POST["category"];
|
||||
$tags = $_POST['tags'] ?? '';
|
||||
|
||||
try {
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$articleManager->addArticle($title, $content, $author, $category, $tags);
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
// -------------------------------- Validierung der Daten: -------------------------
|
||||
if (!articleAuthorValidator($author)) {
|
||||
$_SESSION["message"] = "author_not_valid";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleTitleValidator($title)) {
|
||||
$_SESSION["message"] = "invalid_title";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleContentValidator($content)) {
|
||||
$_SESSION["message"] = "invalid_content";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleCategoryValidator($category)) {
|
||||
$_SESSION["message"] = "invalid_category";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleTagValidator($tags)) {
|
||||
$_SESSION["message"] = "invalid_tags";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
exit();
|
||||
} else {
|
||||
$cleanedTags = [];
|
||||
$rawTags = explode(',', $tags);
|
||||
foreach ($rawTags as $rawTag) {
|
||||
// Leerzeichen am Anfang/Ende des einzelnen Tags entfernen:
|
||||
$tag = trim($rawTag);
|
||||
$cleanedTags[] = $tag;
|
||||
}
|
||||
// Duplikate entfernen:
|
||||
$cleanedTags = array_unique($cleanedTags);
|
||||
$cleanedTags = implode(',', $cleanedTags);
|
||||
}
|
||||
// ----------------- Übertragung der validierten Daten in ArticleManager: ---------------------------
|
||||
try {
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$articleManager->addArticle($title, $content, $author, $category, $cleanedTags);
|
||||
|
||||
// Formulardaten nach erfolgreichem Erstellen aus der Session löschen
|
||||
unset($_SESSION["old_title"], $_SESSION["old_content"], $_SESSION["old_category"], $_SESSION["old_tags"]);
|
||||
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
$_SESSION["message"] = "new_article";
|
||||
// Weiterleitung zur Homepage
|
||||
header("location: ../../index.php");
|
||||
exit();
|
||||
}
|
||||
$_SESSION["message"] = "new_article";
|
||||
// Weiterleitung zur Homepage
|
||||
header("location: ../../index.php");
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
require_once "php/model/LocalUserDAO.php";
|
||||
|
||||
$dao = new LocalUserDAO();
|
||||
$error = null;
|
||||
|
||||
/*
|
||||
Verarbeitung des Login-Formulars
|
||||
Funktion: Prüft Benutzerdaten und erstellt Session für eingeloggten Nutzer
|
||||
*/
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
|
||||
$email = $_POST["email"] ?? "";
|
||||
$password = $_POST["password"] ?? "";
|
||||
|
||||
$user = $dao->findUser($email);
|
||||
|
||||
if ($user && password_verify($password, $user["password"])) {
|
||||
|
||||
if (isset($user["vorname"]) && isset($user["nachname"])) {
|
||||
$_SESSION["user"] = $user["vorname"] . " " . $user["nachname"];
|
||||
} else {
|
||||
$_SESSION["user"] = $user["username"] ?? "";
|
||||
}
|
||||
|
||||
$_SESSION["user_email"] = $user["email"];
|
||||
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
|
||||
} else {
|
||||
$error = "Login fehlgeschlagen. Bitte überprüfe deine Eingaben.";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
require_once "php/model/LocalUserDAO.php";
|
||||
require_once "php/model/Article.php";
|
||||
require_once "php/model/ArticleManager.php";
|
||||
require_once "php/validator/user-validator.php";
|
||||
|
||||
$error = null;
|
||||
|
||||
if (!isset($_SESSION["user"])) {
|
||||
header("Location: index.php?pfad=login");
|
||||
exit();
|
||||
}
|
||||
|
||||
try {
|
||||
$dao = new LocalUserDAO();
|
||||
|
||||
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
||||
|
||||
if (!$user) {
|
||||
$_SESSION = [];
|
||||
session_destroy();
|
||||
|
||||
header("Location: index.php?pfad=login");
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["saveProfile"])) {
|
||||
$oldEmail = $_SESSION["user_email"];
|
||||
|
||||
$newEmail = trim($_POST["email"] ?? "");
|
||||
$vorname = trim($_POST["vorname"] ?? "");
|
||||
$nachname = trim($_POST["nachname"] ?? "");
|
||||
$password = $_POST["password"] ?? "";
|
||||
|
||||
if (!userEmailValidator($newEmail)) {
|
||||
$error = "Bitte gib eine gültige E-Mail-Adresse ein.";
|
||||
$_GET["edit"] = "1";
|
||||
|
||||
} elseif (!userNameValidator($vorname)) {
|
||||
$error = "Der Vorname muss 2 bis 50 Zeichen lang sein und darf nur Buchstaben, Leerzeichen und Bindestriche enthalten.";
|
||||
$_GET["edit"] = "1";
|
||||
|
||||
} elseif (!userNameValidator($nachname)) {
|
||||
$error = "Der Nachname muss 2 bis 50 Zeichen lang sein und darf nur Buchstaben, Leerzeichen und Bindestriche enthalten.";
|
||||
$_GET["edit"] = "1";
|
||||
|
||||
} elseif (!userOptionalPasswordValidator($password)) {
|
||||
$error = "Das Passwort muss 8 bis 72 Zeichen lang sein.";
|
||||
$_GET["edit"] = "1";
|
||||
|
||||
} else {
|
||||
$updated = $dao->updateUser(
|
||||
$oldEmail,
|
||||
$newEmail,
|
||||
$vorname,
|
||||
$nachname,
|
||||
$password
|
||||
);
|
||||
|
||||
if ($updated) {
|
||||
$_SESSION["user"] = $vorname . " " . $nachname;
|
||||
$_SESSION["user_email"] = $newEmail;
|
||||
|
||||
header("Location: index.php?pfad=profile");
|
||||
exit();
|
||||
} else {
|
||||
$error = "Die Daten konnten nicht gespeichert werden.";
|
||||
$_GET["edit"] = "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
||||
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$userArticles = $articleManager->getArticlesByAuthor($_SESSION["user_email"]);
|
||||
|
||||
if (!isset($userArticles)) {
|
||||
$_SESSION["message"] = "user_has_no_articles";
|
||||
}
|
||||
|
||||
} catch (InvalidArgumentException $e) {
|
||||
$error = $e->getMessage();
|
||||
$_GET["edit"] = "1";
|
||||
|
||||
} catch (Exception $e) {
|
||||
$error = "Es ist ein interner Fehler aufgetreten. Bitte versuche es erneut.";
|
||||
$_SESSION["message"] = "internal_error";
|
||||
$_GET["edit"] = "1";
|
||||
}
|
||||
@@ -3,12 +3,15 @@
|
||||
* Controller für die Liste der eigenen Beiträge eines Nutzers auf der eigenen Profilseite
|
||||
*/
|
||||
|
||||
session_start();
|
||||
require_once 'php/model/Article.php';
|
||||
require_once 'php/model/ArticleManager.php';
|
||||
require_once "../model/LocalUserDAO.php";
|
||||
|
||||
try {
|
||||
$author = "max.mustermann"; // TODO: später Nutzer aus der Session beziehen.
|
||||
$dao = new LocalUserDAO();
|
||||
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
||||
|
||||
$author = $user["email"];
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$userArticles = $articleManager->getArticlesByAuthor($author);
|
||||
if(!isset($userArticles)) {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
require_once "php/model/LocalUserDAO.php";
|
||||
require_once "php/validator/user-validator.php";
|
||||
|
||||
$error = null;
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
|
||||
$email = trim($_POST["email"] ?? "");
|
||||
$vorname = trim($_POST["vorname"] ?? "");
|
||||
$nachname = trim($_POST["nachname"] ?? "");
|
||||
$plainPassword = $_POST["password"] ?? "";
|
||||
|
||||
if (!userEmailValidator($email)) {
|
||||
$error = "Bitte gib eine gültige E-Mail-Adresse ein.";
|
||||
} elseif (!userNameValidator($vorname)) {
|
||||
$error = "Der Vorname muss 2 bis 50 Zeichen lang sein und darf nur Buchstaben, Umlaute, Leerzeichen und Bindestriche enthalten.";
|
||||
} elseif (!userNameValidator($nachname)) {
|
||||
$error = "Der Nachname muss 2 bis 50 Zeichen lang sein und darf nur Buchstaben, Umlaute, Leerzeichen und Bindestriche enthalten.";
|
||||
} elseif (!userPasswordValidator($plainPassword)) {
|
||||
$error = "Das Passwort muss 8 bis 72 Zeichen lang sein.";
|
||||
} else {
|
||||
try {
|
||||
$dao = new LocalUserDAO();
|
||||
|
||||
$password = password_hash($plainPassword, PASSWORD_DEFAULT);
|
||||
|
||||
$dao->addUser($email, $vorname, $nachname, $password);
|
||||
|
||||
$_SESSION["user"] = $vorname . " " . $nachname;
|
||||
$_SESSION["user_email"] = $email;
|
||||
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
|
||||
} catch (InvalidArgumentException $e) {
|
||||
$error = $e->getMessage();
|
||||
} catch (Exception $e) {
|
||||
$error = "Die Registrierung konnte nicht gespeichert werden.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,28 +2,67 @@
|
||||
session_start();
|
||||
require_once '../model/LocalArticleManager.php';
|
||||
require_once '../model/ArticleManager.php';
|
||||
require_once '../model/Article.php';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
if(!isset($_POST["search"])){
|
||||
if ($_SERVER["REQUEST_METHOD"] === "GET" && isset($_GET["q"])) {
|
||||
|
||||
$search = trim($_GET["q"]);
|
||||
if (empty($search)) {
|
||||
$_SESSION["search_results"] = [];
|
||||
$_SESSION["search_query"] = "";
|
||||
$_SESSION["message"] = "missing_parameters";
|
||||
header("location: ../../index.php?pfad=search-results");
|
||||
} else {
|
||||
|
||||
$search = $_POST["search"];
|
||||
|
||||
try {
|
||||
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$articleManager->search($search); // TODO: Methode implementieren.
|
||||
|
||||
$results = $articleManager->search($search);
|
||||
|
||||
$sortStyle = $_GET['sort'] ?? 'alphabet';
|
||||
$_SESSION['search_sort'] = $sortStyle;
|
||||
|
||||
if ($sortStyle === 'alphabet') {
|
||||
// Titel aufsteigend alphabetiisch sortiert
|
||||
usort($results, function($a, $b) {
|
||||
return strcasecmp($a->title, $b->title);
|
||||
});
|
||||
} elseif ($sortStyle === 'newest') {
|
||||
// Datum neu zu alt sortiert
|
||||
usort($results, function($a, $b) {
|
||||
return strcmp($b->creationDate, $a->creationDate);
|
||||
});
|
||||
} elseif ($sortStyle === 'oldest') {
|
||||
// Datum alt zu neu sortiert
|
||||
usort($results, function($a, $b) {
|
||||
return strcmp($a->creationDate, $b->creationDate);
|
||||
});
|
||||
}
|
||||
|
||||
// Ergebnisse werden in ein flaches array umgewandelt, da sont incomplete-PHP error im Ergebnis
|
||||
$safeArrayResults = [];
|
||||
foreach ($results as $obj) {
|
||||
$safeArrayResults[] = [
|
||||
"id" => $obj->id,
|
||||
"title" => $obj->title,
|
||||
"content" => $obj->content,
|
||||
"author" => $obj->author,
|
||||
"category" => $obj->category,
|
||||
"tags" => $obj->tags,
|
||||
"creationDate" => $obj->creationDate
|
||||
];
|
||||
}
|
||||
|
||||
$_SESSION["search_results"] = $safeArrayResults;
|
||||
$_SESSION["search_query"] = $search;
|
||||
$_SESSION["message"] = "new_search_results";
|
||||
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
}
|
||||
$_SESSION["message"] = "new_search_results";
|
||||
// TODO: Liste mit Artikeln in der Suchreihenfolge übertragen.
|
||||
// Weiterleitung zur Suchergebnisanzeige
|
||||
header("location: ../../index.php?pfad=search-results");
|
||||
exit();
|
||||
|
||||
}
|
||||
header("Location: ../../index.php?pfad=search-results");
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -3,7 +3,7 @@ session_start();
|
||||
require_once 'php/model/Article.php';
|
||||
require_once 'php/model/ArticleManager.php';
|
||||
|
||||
if (isset($_GET["id"])){
|
||||
if (isset($_GET["id"]) && !empty($_GET["id"])){
|
||||
try {
|
||||
$id = $_GET["id"];
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
@@ -15,12 +15,15 @@ if (isset($_GET["id"])){
|
||||
$author = $article->getAuthor();
|
||||
$tags = $article->getTags();
|
||||
}else{
|
||||
$_SESSION["message"] = "article_not_found";
|
||||
//header("location: index.php?pfad=404");
|
||||
include_once "content/404.php";
|
||||
exit();
|
||||
}
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
$_SESSION["message"] = "article_not_found";
|
||||
$_SESSION["message"] = "missing_id";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
require_once 'php/model/Article.php';
|
||||
require_once 'php/model/ArticleManager.php';
|
||||
require_once 'php/validator/article-validator.php';
|
||||
|
||||
if (isset($_GET["category"]) && !empty($_GET["category"]) && articleCategoryValidator($_GET["category"])){
|
||||
$category = $_GET["category"];
|
||||
try {
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$articles = $articleManager->getArticlesByCategory($category);
|
||||
} catch (Exception $e) {
|
||||
$_SESSION["message"] = "internal_error";
|
||||
include_once "content/404.php";
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
$_SESSION["message"] = "invalid_category";
|
||||
include_once "content/404.php";
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
@@ -1,46 +1,95 @@
|
||||
<?php
|
||||
session_start();
|
||||
SESSION_START();
|
||||
require_once '../model/LocalArticleManager.php';
|
||||
require_once '../model/ArticleManager.php';
|
||||
require_once '../model/Article.php';
|
||||
require_once '../validator/article-validator.php';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
try {
|
||||
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
||||
$_SESSION["old_content"] = $_POST["content"] ?? '';
|
||||
$_SESSION["old_category"] = $_POST["category"] ?? ''; // TODO: die Kategorie im Dropdown setzen, wenn der Editor erneut geöffnet wird.
|
||||
$_SESSION["old_tags"] = $_POST["tags"] ?? '';
|
||||
|
||||
if (isset($_GET["id"]) && !empty($_GET["id"])) {
|
||||
$id = $_GET["id"];
|
||||
} catch (Exception $e){
|
||||
} else {
|
||||
$_SESSION["message"] = "missing_id";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
||||
$_SESSION["message"] = "missing_parameters";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
} elseif(!isset($id)) {
|
||||
$_SESSION["message"] = "missing_id";
|
||||
//header("location: ../../index.php?pfad=updateArticle");
|
||||
exit();
|
||||
}else{
|
||||
$title = $_POST["title"];
|
||||
$content = $_POST["content"];
|
||||
$author = $_SESSION["user_email"];
|
||||
$category = $_POST["category"];
|
||||
$tags = $_POST['tags'] ?? '';
|
||||
|
||||
$newTitle = $_POST["title"];
|
||||
$newContent = $_POST["content"];
|
||||
$newCategory = $_POST["category"];
|
||||
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
||||
$newTags = $_POST["tags"];
|
||||
// -------------------------------- Validierung der Daten: -------------------------
|
||||
if (!articleAuthorValidator($author)) {
|
||||
$_SESSION["message"] = "author_not_valid";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleTitleValidator($title)) {
|
||||
$_SESSION["message"] = "invalid_title";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleContentValidator($content)) {
|
||||
$_SESSION["message"] = "invalid_content";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleCategoryValidator($category)) {
|
||||
$_SESSION["message"] = "invalid_category";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleTagValidator($tags)) {
|
||||
$_SESSION["message"] = "invalid_tags";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
exit();
|
||||
} else {
|
||||
$cleanedTags = [];
|
||||
$rawTags = explode(',', $tags);
|
||||
foreach ($rawTags as $rawTag) {
|
||||
// Leerzeichen am Anfang/Ende des einzelnen Tags entfernen:
|
||||
$tag = trim($rawTag);
|
||||
$cleanedTags[] = $tag;
|
||||
}
|
||||
// Duplikate entfernen:
|
||||
$cleanedTags = array_unique($cleanedTags);
|
||||
$cleanedTags = implode(',', $cleanedTags);
|
||||
}
|
||||
|
||||
// ----------------- Übertragung der validierten Daten in ArticleManager: ---------------------------
|
||||
try {
|
||||
$articleManager = ArticleManager::getInstance(); // TODO: Später aus Session den Nutzer auslesen und Autorenrechte prüfen!
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$article = $articleManager->getArticle($id);
|
||||
$article->setTitle($newTitle);
|
||||
$article->setContent($newContent);
|
||||
$article->setCategory($newCategory);
|
||||
$article->setTags($newTags);
|
||||
$article->setTitle($title);
|
||||
$article->setContent($content);
|
||||
$article->setCategory($category);
|
||||
$article->setTags($cleanedTags);
|
||||
$articleManager->updateArticle($id ,$article, $author);
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
$_SESSION["message"] = $e->getMessage();
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
exit();
|
||||
}
|
||||
$_SESSION["message"] = "article_updated";
|
||||
// Weiterleitung zur Homepage
|
||||
header("location: ../../index.php?pfad=showArticle&id=$id");
|
||||
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -7,13 +7,13 @@
|
||||
*/
|
||||
class Article
|
||||
{
|
||||
private $id;
|
||||
private $title;
|
||||
private $content;
|
||||
private $author;
|
||||
private $creationDate;
|
||||
private $category;
|
||||
private $tags;
|
||||
public $id;
|
||||
public $title;
|
||||
public $content;
|
||||
public $author;
|
||||
public $creationDate;
|
||||
public $category;
|
||||
public $tags;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
|
||||
@@ -19,7 +19,7 @@ class ArticleManager extends LocalArticleManager
|
||||
"Satz des Pythagoras",
|
||||
"Der Satz des Pythagoras wurde von dem griechischen Philosophen Pythagoras von Samos formuliert und im dritten Jahrhundert vor Christus veröffentlicht. In der beigefügten Abbildung sehen wir ein rechtwinkliges Dreieck...",
|
||||
"max.mustermann",
|
||||
"Mathe",
|
||||
"mathe",
|
||||
"Dreiecke, Dreiecksseiten berechnen"
|
||||
);
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class ArticleManager extends LocalArticleManager
|
||||
"Tunneleffekt",
|
||||
"Der Tunneleffekt ist ein quantenmechanisches Phänomen, bei dem Teilchen...",
|
||||
"max.mustermann",
|
||||
"Physik",
|
||||
"physik",
|
||||
"Quantenphysik, Energie"
|
||||
);
|
||||
}
|
||||
@@ -37,11 +37,12 @@ class ArticleManager extends LocalArticleManager
|
||||
"Datenschutz vs Datensicherheit",
|
||||
"Datenschutz ist in unserer digital vernetzten Welt allgegenwärtig...",
|
||||
"max.mustermann",
|
||||
"Informatik",
|
||||
"informatik",
|
||||
"Daten, DSGVO"
|
||||
);
|
||||
}
|
||||
|
||||
return $articleManager;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
<?php
|
||||
require_once "Article.php";
|
||||
|
||||
class NotFoundException extends Exception {}
|
||||
class UnauthorizedAccessException extends Exception {}
|
||||
class InternalServerErrorException extends Exception {}
|
||||
|
||||
/**
|
||||
* Die Klasse beinhaltet alle Methoden für die Operation mit den Artikel-Daten.
|
||||
*
|
||||
@@ -16,7 +21,7 @@ interface ArticleManagerDAO
|
||||
* @param $tags string optionale Schlagworte für eine bessere Suche
|
||||
*
|
||||
* Mögliche Exceptions:
|
||||
* TODO Fehlerbeschreibung hinzufügen & tags hinzufügen
|
||||
* TODO: Exceptions implementieren.
|
||||
*/
|
||||
public function addArticle($title, $content, $author, $category, $tags);
|
||||
|
||||
@@ -29,7 +34,10 @@ interface ArticleManagerDAO
|
||||
* @param $author
|
||||
* @return void
|
||||
*
|
||||
* TODO: Fehlerbeschreibung hinzufügen
|
||||
* @throws InternalServerErrorException
|
||||
* @throws NotFoundException
|
||||
* @throws UnauthorizedAccessException
|
||||
* /
|
||||
*/
|
||||
public function updateArticle($id, $article, $author);
|
||||
|
||||
@@ -38,7 +46,7 @@ interface ArticleManagerDAO
|
||||
* @param $id
|
||||
* @return void
|
||||
*
|
||||
* TODO: Fehlerbeschreibung hinzufügen
|
||||
* TODO: Exceptions implementieren.
|
||||
*/
|
||||
public function deleteArticle($id);
|
||||
|
||||
@@ -48,7 +56,7 @@ interface ArticleManagerDAO
|
||||
*
|
||||
* @return Article
|
||||
* Mögliche Exceptions:
|
||||
* TODO Fehlerbeschreibung hinzufügen
|
||||
* TODO: Exceptions implementieren.
|
||||
*/
|
||||
public function getArticle($id);
|
||||
|
||||
@@ -56,7 +64,7 @@ interface ArticleManagerDAO
|
||||
* Alle Beiträge aufrufen.
|
||||
*
|
||||
* Mögliche Exceptions:
|
||||
* TODO Fehlerbeschreibung hinzufügen
|
||||
* TODO: Exceptions implementieren.
|
||||
*/
|
||||
public function getAllArticles();
|
||||
|
||||
@@ -64,8 +72,26 @@ interface ArticleManagerDAO
|
||||
* Gibt alle Beiträge eines Nutzer mit einer gegebenen ID aus.
|
||||
* @param $author
|
||||
* @return Article[]
|
||||
* TODO: Exceptions implementieren.
|
||||
*/
|
||||
public function getArticlesByAuthor($author);
|
||||
|
||||
/**
|
||||
* Durchsucht die vorhandenen Beiträge nach einem bestimmten Suchbegriff.
|
||||
* Die Suche prüft, ob das übergebene Keyword im Titel oder im Inhalt eines Beitrags vorkommt.
|
||||
* (Unabhängig von Groß-und Kleinschreibung)
|
||||
* @param string $keyword Der eingegebene Suchbegriff.
|
||||
* @return array Ein Array von Artikeln ,die dem Suchkriterium entsprechen. Wenn nichts gefunden wird, ein leeres Array.
|
||||
*/
|
||||
public function search(string $keyword): array;
|
||||
|
||||
/**
|
||||
* Gibt alle Beiträge einer gegebenen Kategorie aus.
|
||||
* @param $category
|
||||
* @return mixed
|
||||
*/
|
||||
public function getArticlesByCategory($category);
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -36,6 +36,7 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
* Speichert alle Artikel/Beiträge in der Datei.
|
||||
* @param $articles
|
||||
* @return void
|
||||
* TODO: Exceptions implementieren.
|
||||
*/
|
||||
public function saveArticle($articles)
|
||||
{
|
||||
@@ -65,14 +66,12 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
public function updateArticle($id, $article, $author)
|
||||
{
|
||||
if (empty($article)) {
|
||||
// TODO: Implement Exception.
|
||||
return;
|
||||
throw new InternalServerErrorException("internal_error");
|
||||
}
|
||||
|
||||
// Berechtigungsprüfung:
|
||||
if ($article->getAuthor() !== $author) {
|
||||
// TODO: Implement Exception.
|
||||
return;
|
||||
throw new UnauthorizedAccessException("unauthorized_access");
|
||||
}
|
||||
|
||||
// Beitrag aktualisieren:
|
||||
@@ -92,15 +91,14 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
];
|
||||
$updated = true;
|
||||
break;
|
||||
}else{
|
||||
// TODO: Implement Exception.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Nur speichern, wenn Beitrag geändert wurde:
|
||||
if ($updated) {
|
||||
$this->saveArticle($articles);
|
||||
} else {
|
||||
throw new NotFoundException("missing_id");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,5 +166,61 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
}
|
||||
return $filteredArticles;
|
||||
}
|
||||
|
||||
|
||||
public function search(string $keyword): array
|
||||
{
|
||||
$articles = $this->getAllArticles();
|
||||
$filteredArticles = [];
|
||||
|
||||
if (!is_array($articles)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$cleanKeyword = strtolower(trim($keyword));
|
||||
|
||||
foreach ($articles as $article) {
|
||||
$title = isset($article['title']) ? strtolower((string)$article['title']) : '';
|
||||
$content = isset($article['content']) ? strtolower((string)$article['content']) : '';
|
||||
|
||||
if (($cleanKeyword !== '' && strpos($title, $cleanKeyword) !== false) ||
|
||||
($cleanKeyword !== '' && strpos($content, $cleanKeyword) !== false)) {
|
||||
|
||||
$filteredArticles[] = new Article(
|
||||
intval($article['id'] ?? 0),
|
||||
$article['title'] ?? '',
|
||||
$article['content'] ?? '',
|
||||
$article['author'] ?? '',
|
||||
$article['category'] ?? '',
|
||||
$article['tags'] ?? '',
|
||||
$article['creationDate'] ?? ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $filteredArticles;
|
||||
}
|
||||
|
||||
public function getArticlesByCategory($category)
|
||||
{
|
||||
$articles = $this->getAllArticles();
|
||||
$filteredArticles = [];
|
||||
|
||||
foreach ($articles as $article) {
|
||||
if (isset($article['category']) && $article['category'] == $category) {
|
||||
$filteredArticles[] = new Article(
|
||||
intval($article['id']),
|
||||
$article['title'],
|
||||
$article['content'],
|
||||
$article['author'],
|
||||
$article['category'],
|
||||
$article['tags'],
|
||||
$article['creationDate']
|
||||
);
|
||||
}
|
||||
}
|
||||
return $filteredArticles;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
require_once "UserDAOInterface.php";
|
||||
|
||||
class LocalUserDAO implements UserDAOInterface {
|
||||
|
||||
private string $file = "data/users.json";
|
||||
|
||||
/**
|
||||
* Lädt alle Benutzer aus der JSON-Datei.
|
||||
*
|
||||
* @return array Liste aller Benutzer
|
||||
* @throws RuntimeException wenn die Datei nicht gelesen werden kann
|
||||
* oder fehlerhafte JSON-Daten enthält
|
||||
*/
|
||||
private function loadUsers() {
|
||||
if (!file_exists($this->file)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$json = file_get_contents($this->file);
|
||||
|
||||
if ($json === false) {
|
||||
throw new RuntimeException("Benutzerdaten konnten nicht gelesen werden.");
|
||||
}
|
||||
|
||||
$users = json_decode($json, true);
|
||||
|
||||
if ($users === null && json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new RuntimeException("Benutzerdaten sind fehlerhaft.");
|
||||
}
|
||||
|
||||
return is_array($users) ? $users : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert alle Benutzer in die JSON-Datei.
|
||||
*
|
||||
* @param array $users Liste aller Benutzer
|
||||
* @return void
|
||||
* @throws RuntimeException wenn die Daten nicht gespeichert werden können
|
||||
*/
|
||||
private function saveUsers($users) {
|
||||
$json = json_encode($users, JSON_PRETTY_PRINT);
|
||||
|
||||
if ($json === false) {
|
||||
throw new RuntimeException("Benutzerdaten konnten nicht umgewandelt werden.");
|
||||
}
|
||||
|
||||
$result = file_put_contents($this->file, $json);
|
||||
|
||||
if ($result === false) {
|
||||
throw new RuntimeException("Benutzerdaten konnten nicht gespeichert werden.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sucht einen Benutzer anhand seiner E-Mail-Adresse.
|
||||
*
|
||||
* @param string $email E-Mail-Adresse des gesuchten Benutzers
|
||||
* @return array|null Benutzerdaten oder null, wenn kein Benutzer gefunden wurde
|
||||
* @throws RuntimeException wenn die Benutzerdaten nicht gelesen werden können
|
||||
*/
|
||||
public function findUser($email) {
|
||||
$users = $this->loadUsers();
|
||||
|
||||
foreach ($users as $user) {
|
||||
if (isset($user["email"]) && $user["email"] === $email) {
|
||||
|
||||
if (!isset($user["vorname"]) && isset($user["username"])) {
|
||||
$nameParts = explode(" ", $user["username"], 2);
|
||||
$user["vorname"] = $nameParts[0] ?? "";
|
||||
$user["nachname"] = $nameParts[1] ?? "";
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fügt einen neuen Benutzer hinzu.
|
||||
*
|
||||
* @param string $email E-Mail-Adresse
|
||||
* @param string $vorname Vorname
|
||||
* @param string $nachname Nachname
|
||||
* @param string $password Passwort-Hash
|
||||
* @return void
|
||||
* @throws InvalidArgumentException wenn die E-Mail-Adresse bereits verwendet wird
|
||||
* @throws RuntimeException wenn die Benutzerdaten nicht gelesen oder gespeichert werden können
|
||||
*/
|
||||
public function addUser($email, $vorname, $nachname, $password) {
|
||||
$users = $this->loadUsers();
|
||||
|
||||
foreach ($users as $user) {
|
||||
if (isset($user["email"]) && $user["email"] === $email) {
|
||||
throw new InvalidArgumentException("Diese E-Mail-Adresse wird bereits verwendet.");
|
||||
}
|
||||
}
|
||||
|
||||
$users[] = [
|
||||
"email" => $email,
|
||||
"vorname" => $vorname,
|
||||
"nachname" => $nachname,
|
||||
"password" => $password
|
||||
];
|
||||
|
||||
$this->saveUsers($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Aktualisiert einen bestehenden Benutzer.
|
||||
*
|
||||
* @param string $oldEmail Alte E-Mail-Adresse
|
||||
* @param string $newEmail Neue E-Mail-Adresse
|
||||
* @param string $vorname Neuer Vorname
|
||||
* @param string $nachname Neuer Nachname
|
||||
* @param string|null $password Neues Passwort oder null
|
||||
* @return bool true, wenn der Benutzer aktualisiert wurde, sonst false
|
||||
* @throws InvalidArgumentException wenn die neue E-Mail-Adresse bereits verwendet wird
|
||||
* @throws RuntimeException wenn die Benutzerdaten nicht gelesen oder gespeichert werden können
|
||||
*/
|
||||
public function updateUser($oldEmail, $newEmail, $vorname, $nachname, $password = null) {
|
||||
$users = $this->loadUsers();
|
||||
|
||||
foreach ($users as $user) {
|
||||
if (
|
||||
isset($user["email"])
|
||||
&& $user["email"] === $newEmail
|
||||
&& $newEmail !== $oldEmail
|
||||
) {
|
||||
throw new InvalidArgumentException("Diese E-Mail-Adresse wird bereits verwendet.");
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($users as $i => $user) {
|
||||
if (isset($user["email"]) && $user["email"] === $oldEmail) {
|
||||
$users[$i]["email"] = $newEmail;
|
||||
$users[$i]["vorname"] = $vorname;
|
||||
$users[$i]["nachname"] = $nachname;
|
||||
|
||||
unset($users[$i]["username"]);
|
||||
|
||||
if (!empty($password)) {
|
||||
$users[$i]["password"] = password_hash($password, PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
$this->saveUsers($users);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht einen Benutzer anhand seiner E-Mail-Adresse.
|
||||
*
|
||||
* @param string $email E-Mail-Adresse des zu löschenden Benutzers
|
||||
* @return bool true, wenn der Benutzer gelöscht wurde, sonst false
|
||||
* @throws RuntimeException wenn die Benutzerdaten nicht gelesen oder gespeichert werden können
|
||||
*/
|
||||
public function deleteUser($email) {
|
||||
$users = $this->loadUsers();
|
||||
|
||||
foreach ($users as $i => $user) {
|
||||
if (isset($user["email"]) && $user["email"] === $email) {
|
||||
unset($users[$i]);
|
||||
$users = array_values($users);
|
||||
$this->saveUsers($users);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Interface für den Zugriff auf Benutzerdaten.
|
||||
*
|
||||
* Definiert die Methoden, die jede UserDAO-Implementierung
|
||||
* bereitstellen muss.
|
||||
*/
|
||||
interface UserDAOInterface {
|
||||
|
||||
/**
|
||||
* Sucht einen Benutzer anhand seiner E-Mail-Adresse.
|
||||
*
|
||||
* Funktion:
|
||||
* Liefert die gespeicherten Benutzerdaten zu einer E-Mail-Adresse.
|
||||
*
|
||||
* Eingabe:
|
||||
* @param string $email E-Mail-Adresse des gesuchten Benutzers
|
||||
*
|
||||
* Ausgabe:
|
||||
* @return array|null Benutzerdaten als Array oder null
|
||||
*
|
||||
* Mögliche Fehler:
|
||||
* @throws RuntimeException wenn die Benutzerdaten nicht gelesen werden können
|
||||
*/
|
||||
public function findUser($email);
|
||||
|
||||
/**
|
||||
* Fügt einen neuen Benutzer hinzu.
|
||||
*
|
||||
* Funktion:
|
||||
* Erstellt einen neuen Benutzereintrag und speichert ihn
|
||||
* in der jeweiligen Datenquelle.
|
||||
*
|
||||
* Eingabe:
|
||||
* @param string $email E-Mail-Adresse des Benutzers
|
||||
* @param string $vorname Vorname des Benutzers
|
||||
* @param string $nachname Nachname des Benutzers
|
||||
* @param string $password Passwort des Benutzers
|
||||
*
|
||||
* Ausgabe:
|
||||
* @return void
|
||||
*
|
||||
* Mögliche Fehler:
|
||||
* @throws InvalidArgumentException wenn die E-Mail-Adresse bereits verwendet wird
|
||||
* @throws RuntimeException wenn die Benutzerdaten nicht gelesen oder gespeichert werden können
|
||||
*/
|
||||
public function addUser($email, $vorname, $nachname, $password);
|
||||
|
||||
/**
|
||||
* Aktualisiert einen bestehenden Benutzer.
|
||||
*
|
||||
* Funktion:
|
||||
* Ändert die E-Mail-Adresse, den Vornamen, den Nachnamen
|
||||
* und optional das Passwort eines bestehenden Benutzers.
|
||||
*
|
||||
* Eingabe:
|
||||
* @param string $oldEmail Alte E-Mail-Adresse
|
||||
* @param string $newEmail Neue E-Mail-Adresse
|
||||
* @param string $vorname Neuer Vorname
|
||||
* @param string $nachname Neuer Nachname
|
||||
* @param string|null $password Neues Passwort oder null
|
||||
*
|
||||
* Ausgabe:
|
||||
* @return bool true, wenn der Benutzer aktualisiert wurde, sonst false
|
||||
*
|
||||
* Mögliche Fehler:
|
||||
* @throws InvalidArgumentException wenn die neue E-Mail-Adresse bereits verwendet wird
|
||||
* @throws RuntimeException wenn die Benutzerdaten nicht gelesen oder gespeichert werden können
|
||||
*/
|
||||
public function updateUser($oldEmail, $newEmail, $vorname, $nachname, $password = null);
|
||||
|
||||
/**
|
||||
* Löscht einen Benutzer anhand seiner E-Mail-Adresse.
|
||||
*
|
||||
* Funktion:
|
||||
* Entfernt einen vorhandenen Benutzer aus der Datenquelle.
|
||||
*
|
||||
* Eingabe:
|
||||
* @param string $email E-Mail-Adresse des zu löschenden Benutzers
|
||||
*
|
||||
* Ausgabe:
|
||||
* @return bool true, wenn der Benutzer gelöscht wurde, sonst false
|
||||
*
|
||||
* Mögliche Fehler:
|
||||
* @throws RuntimeException wenn die Benutzerdaten nicht gelesen oder gespeichert werden können
|
||||
*/
|
||||
public function deleteUser($email);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* Prüft, ob der Autor auch der Eigentümer des Beitrags ist.
|
||||
* @param $author
|
||||
* @return true
|
||||
* TODO: Implement this.
|
||||
*/
|
||||
function articleAuthorValidator($author)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob der Titel die folgenden Bedingungen erfüllt:
|
||||
* Buchstaben von a-z; A-Z
|
||||
* Zahlen von 0-9
|
||||
* Umlaute äöüÄÖÜß
|
||||
* Satzeichen .,!?:;()"„“«»_+-
|
||||
* 5-120 Zeichen
|
||||
* @param $title
|
||||
* @return bool
|
||||
*/
|
||||
function articleTitleValidator($title)
|
||||
{
|
||||
$title = trim($title);
|
||||
$titlePattern = '/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u';
|
||||
if (preg_match($titlePattern, $title)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob der Contenttext 10-7000 Zeichen enthält.
|
||||
* @param $content
|
||||
* @return bool
|
||||
*/
|
||||
function articleContentValidator($content)
|
||||
{
|
||||
$content = trim($content);
|
||||
$zeichenAnzahl = mb_strlen($content);
|
||||
if ($zeichenAnzahl <= 7000 && $zeichenAnzahl >= 10) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob die Kategorie eine erlaubt Kategorie ist.
|
||||
* @param $category
|
||||
* @return bool
|
||||
*/
|
||||
function articleCategoryValidator($category)
|
||||
{
|
||||
$allowedCategories = [
|
||||
'deutsch', 'englisch', 'franzoesisch', 'latein', 'literatur',
|
||||
'mathe', 'biologie', 'chemie', 'physik', 'informatik', 'astronomie',
|
||||
'geschichte', 'erdkunde', 'sozialkunde', 'wirtschaft', 'religion',
|
||||
'ethik', 'philosophie', 'psychologie', 'kunst', 'musik', 'theater',
|
||||
'technik', 'werken', 'hauswirtschaft', 'sport'
|
||||
];
|
||||
if (in_array($category, $allowedCategories, true)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob die Tags die folgenden Bedingungen erfüllen:
|
||||
* Buchstaben von a-z; A-Z
|
||||
* Zahlen von 0-9
|
||||
* Umlaute äöüÄÖÜß
|
||||
* Satzeichen -
|
||||
* 2-50 Zeichen
|
||||
* @param $tags
|
||||
* @return bool
|
||||
*/
|
||||
function articleTagValidator($tags)
|
||||
{
|
||||
if (!isset($tags)) {
|
||||
$tags = '';
|
||||
}
|
||||
|
||||
$rawTags = explode(',', $tags);
|
||||
|
||||
foreach ($rawTags as $rawTag) {
|
||||
// Leerzeichen am Anfang/Ende des einzelnen Tags entfernen:
|
||||
$tag = trim($rawTag);
|
||||
|
||||
// leere Elemente überspringen:
|
||||
if ($tag === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Tag mit Regex prüfen:
|
||||
$tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,50}$/u';
|
||||
if (!preg_match($tagPattern, $tag)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
function userNameValidator($name)
|
||||
{
|
||||
$name = trim($name);
|
||||
$namePattern = '/^[a-zA-ZäöüÄÖÜß\s-]{2,50}$/u';
|
||||
|
||||
return preg_match($namePattern, $name) === 1;
|
||||
}
|
||||
|
||||
function userEmailValidator($email)
|
||||
{
|
||||
$email = trim($email);
|
||||
|
||||
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false
|
||||
&& mb_strlen($email) <= 100;
|
||||
}
|
||||
|
||||
function userPasswordValidator($password)
|
||||
{
|
||||
$zeichenAnzahl = mb_strlen($password);
|
||||
|
||||
return $zeichenAnzahl >= 8 && $zeichenAnzahl <= 72;
|
||||
}
|
||||
|
||||
function userOptionalPasswordValidator($password)
|
||||
{
|
||||
if (!isset($password) || $password === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return userPasswordValidator($password);
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
<!--
|
||||
Artikel: Satz des Pythagoras
|
||||
Funktion: Inhalt zum Fach Mathe
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="EduForge">
|
||||
<meta name="author" content="Niklas Ortmann">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<title>EduForge</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
include_once 'includes/navbar.php';
|
||||
?>
|
||||
<main>
|
||||
|
||||
<h1>Satz des Pythagoras</h1>
|
||||
|
||||
<p>
|
||||
Der Satz des Pythagoras wurde von dem griechischen Philosophen Pythagoras von Samos formuliert und im
|
||||
dritten Jahrhundert vor Christus veröffentlicht.
|
||||
</p>
|
||||
<figure>
|
||||
<img src="https://cdn8.picryl.com/photo/2016/05/14/pythagoras-e9560b-1024.jpg" alt="Trulli" style="width:10%">
|
||||
<figcaption><a href="https://cdn8.picryl.com/photo/2016/05/14/pythagoras-e9560b-1024.jpg">Quelle</a></figcaption>
|
||||
</figure>
|
||||
<p>
|
||||
In der beigefügten Abbildung sehen wir ein rechtwinkliges Dreieck, dessen drei Seiten die Längen a, b und c
|
||||
besitzen. Auf jeder Seite ist ein Quadrat konstruiert. Das Quadrat auf der Seite a hat die Fläche a2, das
|
||||
Quadrat auf der Seite b hat die Fläche b2 und das Quadrat auf der Seite c hat die Fläche c2. Der Satz des
|
||||
Pythagoras besagt, dass die Summe der Flächen der beiden kleineren Quadrate gleich der Fläche des größten
|
||||
Quadrats ist. Das bedeutet, dass a^2+b^2=c^2 (Satz des Pythagoras).
|
||||
</p>
|
||||
<a href="docs/Uebungsaufgaben_Pythagoras.pdf">Lernzettel-Download</a>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
include_once 'includes/footer.php';
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,46 +0,0 @@
|
||||
<!--
|
||||
Artikel: Tunneleffekt
|
||||
Funktion: Inhalt zum Fach Physik
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="EduForge">
|
||||
<meta name="author" content="Niklas Ortmann">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<title>EduForge</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
include_once 'includes/navbar.php';
|
||||
?>
|
||||
<main>
|
||||
|
||||
<h1>Tunneleffekt</h1>
|
||||
|
||||
<p>
|
||||
Der Tunneleffekt ist ein quantenmechanisches Phänomen, bei dem Teilchen – vor allem Elektronen – eine
|
||||
Energiebarriere überwinden können, obwohl sie nach den Regeln der klassischen Physik nicht genügend Energie
|
||||
dafür besitzen. In der klassischen Vorstellung müsste ein Elektron entweder genügend Energie haben, um über
|
||||
eine Barriere zu „springen“, oder es würde vollständig zurückgeworfen. In der Quantenphysik wird ein Elektron
|
||||
jedoch nicht als punktförmiges Teilchen beschrieben, sondern als Wellenfunktion, die sich räumlich ausdehnt.
|
||||
Dadurch besteht eine endliche Wahrscheinlichkeit, dass sich das Elektron auf der anderen Seite einer Barriere
|
||||
befindet (Griffiths & Schroeter, 2018).
|
||||
</p>
|
||||
|
||||
</main>
|
||||
|
||||
<?php
|
||||
include_once 'includes/footer.php';
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user