Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c62ff5b2c0 | |||
| ad422a134d | |||
| 9fce9ec8dd | |||
| a329137de2 | |||
| 21bdb0d66d | |||
| 5db4ad3e63 | |||
| 2ce13cef72 | |||
| 02551049e0 | |||
| 55e9fa6a20 | |||
| c82378baa8 | |||
| 541d5b4c5e | |||
| f9ab3f8db2 | |||
| 6c5047be30 | |||
| 25f6d2bf4a | |||
| 4d8f338649 | |||
| 46a307a5b0 | |||
| 7706c7dfbf | |||
| a946cee891 | |||
| 4d4b8aeb99 |
Generated
+1
@@ -10,6 +10,7 @@
|
|||||||
<option name="highlightLevel" value="WARNING" />
|
<option name="highlightLevel" value="WARNING" />
|
||||||
<option name="transferred" value="true" />
|
<option name="transferred" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="PhpProjectSharedConfiguration" php_language_level="8.5" />
|
||||||
<component name="PhpStanOptionsConfiguration">
|
<component name="PhpStanOptionsConfiguration">
|
||||||
<option name="transferred" value="true" />
|
<option name="transferred" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -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();
|
||||||
+33
-12
@@ -1,3 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
$error = $error ?? null;
|
||||||
|
?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Form: Login-Bereich
|
Form: Login-Bereich
|
||||||
Funktion: Benutzerauthentifizierung und Zugang zum eigenen Profil, Erstellen von Beiträgen, etc.
|
Funktion: Benutzerauthentifizierung und Zugang zum eigenen Profil, Erstellen von Beiträgen, etc.
|
||||||
@@ -7,26 +11,43 @@
|
|||||||
|
|
||||||
<h1>Bitte anmelden</h1>
|
<h1>Bitte anmelden</h1>
|
||||||
|
|
||||||
<form>
|
<?php if ($error): ?>
|
||||||
<label id ="inputEmail" class="screenreader-only">E-Mail Adresse / </label>
|
<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>
|
<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>
|
<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">
|
<button type="submit"
|
||||||
<label>
|
value="anmelden"
|
||||||
<input type="checkbox" name="remember-me" value="1"> angemeldet bleiben
|
name="loginSubmit"
|
||||||
</label>
|
class="login-button">
|
||||||
</div>
|
anmelden
|
||||||
|
</button>
|
||||||
<button type="submit" value="anmelden" name="loginSubmit" class="login-button">anmelden</button>
|
|
||||||
|
|
||||||
<div class="register-link">
|
<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>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
$_SESSION = [];
|
||||||
|
session_destroy();
|
||||||
|
|
||||||
|
header("Location: index.php");
|
||||||
|
exit();
|
||||||
+33
-34
@@ -1,46 +1,45 @@
|
|||||||
<!--
|
<?php
|
||||||
Content: Profil
|
include_once 'php/controller/profile-controller.php';
|
||||||
Inhalt: Das eigene Profil, wenn man angemeldet ist. Dort hat man die Möglichkeit seine Angaben zu ändern.
|
|
||||||
-->
|
$user = $user ?? null;
|
||||||
|
?>
|
||||||
|
|
||||||
<main class="form-page">
|
<main class="form-page">
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
|
|
||||||
|
<h1>Mein Profil</h1>
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
|
<label class="input-label">Name</label>
|
||||||
<label class="input-label">Vorname</label>
|
<input type="text"
|
||||||
|
class="login-input"
|
||||||
<input type="text" name="Vorname" class="login-input" required
|
readonly
|
||||||
placeholder="Vorname"
|
value="<?php echo htmlspecialchars($user["username"] ?? ""); ?>">
|
||||||
value="<?php //DB-Daten ?>">
|
|
||||||
|
|
||||||
<label class="input-label">Nachname</label>
|
|
||||||
<input type="text" name="Nachname" class="login-input" required
|
|
||||||
placeholder="Nachname"
|
|
||||||
value="<?php //DB-Daten ?>">
|
|
||||||
|
|
||||||
<label class="input-label">Email-Adresse</label>
|
<label class="input-label">Email-Adresse</label>
|
||||||
<input type="email" name="Email" class="login-input" required
|
<input type="email"
|
||||||
placeholder="mustermann@web.de"
|
class="login-input"
|
||||||
value="<?php //DB-Daten ?>">
|
readonly
|
||||||
|
value="<?php echo htmlspecialchars($user["email"] ?? ""); ?>">
|
||||||
|
|
||||||
<label class="input-label">Passwort</label>
|
<label class="input-label">Passwort</label>
|
||||||
<input type="password" name="Passwort" class="login-input"
|
<input type="password"
|
||||||
required placeholder="Passwort">
|
class="login-input"
|
||||||
|
readonly
|
||||||
<br>
|
value="********">
|
||||||
|
|
||||||
<button type="submit" class="login-button">
|
|
||||||
Speichern
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
<button type="button" class="login-button">
|
|
||||||
Account löschen
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a href="index.php?pfad=deleteAccount" class="login-button">
|
||||||
|
Account löschen
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<a href="index.php?pfad=logout" class="login-button">
|
||||||
|
Abmelden
|
||||||
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
+41
-11
@@ -1,3 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
include_once 'php/controller/register-controller.php';
|
||||||
|
|
||||||
|
$error = $error ?? null;
|
||||||
|
?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Form: Registrierung
|
Form: Registrierung
|
||||||
Funktion: Erstellung neuer Benutzerkonten
|
Funktion: Erstellung neuer Benutzerkonten
|
||||||
@@ -7,26 +13,50 @@
|
|||||||
|
|
||||||
<h1>Jetzt Registrieren!</h1>
|
<h1>Jetzt Registrieren!</h1>
|
||||||
|
|
||||||
<form>
|
<?php if ($error): ?>
|
||||||
|
<p style="color:red;">
|
||||||
|
<?php echo htmlspecialchars($error); ?>
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form method="post" action="index.php?pfad=register">
|
||||||
|
|
||||||
<p class="input-label">Email:</p>
|
<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"
|
||||||
|
required>
|
||||||
|
|
||||||
<p class="input-label">Vorname:</p>
|
<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"
|
||||||
|
required>
|
||||||
|
|
||||||
<p class="input-label">Nachname:</p>
|
<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"
|
||||||
|
required>
|
||||||
|
|
||||||
<p class="input-label">Passwort:</p>
|
<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">
|
<button type="submit"
|
||||||
<label>
|
value="register"
|
||||||
<input type="checkbox" value="remember-me"> angemeldet bleiben
|
name="registerSubmit"
|
||||||
</label>
|
class="login-button">
|
||||||
</div>
|
kostenlos registrieren
|
||||||
|
</button>
|
||||||
|
|
||||||
<button type="submit" value="anmelden" name="loginSubmit" class="login-button">kostenlos registrieren</button>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
?>
|
|
||||||
<!--
|
|
||||||
Seite: Suchergebnisse
|
|
||||||
Inhalt: Zeigt die Ergebnisse einer Suche an
|
|
||||||
-->
|
|
||||||
<div class="s-res-layout-grid">
|
|
||||||
|
|
||||||
<!-- 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 -->
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
<main class="s-res-main-content">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Ergebnisliste -->
|
|
||||||
<div class="s-res-list">
|
|
||||||
|
|
||||||
<?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>
|
|
||||||
<?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">
|
|
||||||
|
|
||||||
<!-- Auswahl der Ergebnisse pro Seite -->
|
|
||||||
<div class="s-res-limit-selector">
|
|
||||||
<label for="s-res-per-page" class="s-res-limit-label">Ergebnisse pro Seite:</label>
|
|
||||||
<select id="s-res-per-page" name="limit" class="s-res-limit-select">
|
|
||||||
<option value="10" selected>10</option>
|
|
||||||
<option value="20">20</option>
|
|
||||||
<option value="50">50</option>
|
|
||||||
<option value="100">100</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="s-res-page-navigation">
|
|
||||||
<button type="button" class="s-res-page-btn" disabled>«</button>
|
|
||||||
<button type="button" class="s-res-page-btn s-res-page-btn-active">1</button>
|
|
||||||
<button type="button" class="s-res-page-btn">»</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
/* Footer‑Grundlayout */
|
/* Footer‑Grundlayout */
|
||||||
footer {
|
footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #333d43;
|
background: #333d43;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
+1
-10
@@ -3,19 +3,12 @@ main {
|
|||||||
max-width:1200px;
|
max-width:1200px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #eef2f7;
|
background-color: #eef2f7;
|
||||||
color: #1f2937;
|
color: #1f2937;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
min-height: 100vh;
|
|
||||||
display: grid;
|
|
||||||
grid-template-rows: auto 1fr auto; /* Header(auto), Inhalt (bekommt Rest), Footer(auto) */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a, button, input, select, textarea, label, main{
|
a, button, input, select, textarea, label, main{
|
||||||
@@ -24,8 +17,7 @@ a, button, input, select, textarea, label, main{
|
|||||||
|
|
||||||
.flexbox {
|
.flexbox {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: column;
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
@@ -37,7 +29,6 @@ a, button, input, select, textarea, label, main{
|
|||||||
border: 1px solid #dbe3ec;
|
border: 1px solid #dbe3ec;
|
||||||
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
||||||
transition: transform 0.2s, box-shadow 0.2s;
|
transition: transform 0.2s, box-shadow 0.2s;
|
||||||
flex: 1 1 300px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container:hover {
|
.container:hover {
|
||||||
|
|||||||
@@ -205,10 +205,6 @@ CSS für die navbar
|
|||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav__search-button:hover {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* restliche desktop-navbar aus */
|
/* restliche desktop-navbar aus */
|
||||||
.nav__center,
|
.nav__center,
|
||||||
.nav__right .nav__button,
|
.nav__right .nav__button,
|
||||||
@@ -231,9 +227,6 @@ CSS für die navbar
|
|||||||
padding: 2rem 1rem;
|
padding: 2rem 1rem;
|
||||||
box-shadow: 2px 0 10px rgba(0,0,0,0.5);
|
box-shadow: 2px 0 10px rgba(0,0,0,0.5);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
/* Genug Abstand oben rechts, damit Links nicht hinter dem X liegen */
|
|
||||||
padding: 4rem 1.5rem 2rem 1.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav__checkbox:checked ~ .nav__mobile-menu {
|
.nav__checkbox:checked ~ .nav__mobile-menu {
|
||||||
@@ -244,18 +237,6 @@ CSS für die navbar
|
|||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav__close-btn {
|
|
||||||
position: absolute;
|
|
||||||
top: 1rem;
|
|
||||||
right: 1.5rem;
|
|
||||||
font-size: 2rem;
|
|
||||||
color: #fff;
|
|
||||||
cursor: pointer;
|
|
||||||
line-height: 1;
|
|
||||||
user-select: none;
|
|
||||||
transition: color 0.2s ease, transform 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav__mobile-menu a {
|
.nav__mobile-menu a {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|||||||
@@ -1,263 +0,0 @@
|
|||||||
/*
|
|
||||||
CSS für die Suchergebnis-Seite
|
|
||||||
*/
|
|
||||||
/* Container und Layout-Schutz vor globalen Styles */
|
|
||||||
.s-res-layout-grid {
|
|
||||||
box-sizing: border-box;
|
|
||||||
max-width: 95%; /* Nutzt jetzt 95% der Bildschirmbreite statt starrer Pixel */
|
|
||||||
width: 95%; /* Erhöht das Limit für extrem große Monitore von 1200px auf 1600px */
|
|
||||||
margin: 2rem auto;
|
|
||||||
padding: 0 1rem;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
||||||
color: #212529;
|
|
||||||
line-height: 1.5;
|
|
||||||
|
|
||||||
/* Grid für die Zweispaltigkeit */
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 320px 1fr; /* Seitenleiste leicht verbreitert, Inhalt nimmt den gesamten Rest ein */
|
|
||||||
gap: 2.5rem; /* Etwas mehr Abstand zwischen Seitenleiste und Inhalt für das breitere Layout */
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-layout-grid * {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- SEITENLEISTE (FILTER & SUCHE) --- */
|
|
||||||
.s-res-sidebar {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-sidebar-box {
|
|
||||||
background-color: #ffffff;
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-sidebar-title {
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #1a202c;
|
|
||||||
margin: 0 0 1rem 0;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.05em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Formular & deine Suchleisten-Klassen */
|
|
||||||
.s-res-search-form {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Filter Radio-Buttons */
|
|
||||||
.s-res-filter-group {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-filter-option {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
color: #4a5568;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-filter-option input[type="radio"] {
|
|
||||||
margin: 0;
|
|
||||||
accent-color: #3182ce; /* Moderne Färbung des Radio-Buttons */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- HAUPTINHALT (ERGEBNISSE) --- */
|
|
||||||
.s-res-main-content {
|
|
||||||
min-width: 0; /* Verhindert das Ausbrechen von Flex-Elementen */
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-header {
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
border-bottom: 2px solid #dee2e6;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-main-title {
|
|
||||||
font-size: 2rem;
|
|
||||||
color: #1a202c;
|
|
||||||
margin: 0 0 0.5rem 0;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-meta {
|
|
||||||
color: #6c757d;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Einzelner Beitrag */
|
|
||||||
.s-res-item {
|
|
||||||
background-color: #ffffff;
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 1.25rem;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-item:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
|
||||||
border-color: #cbd5e1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-content {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-item-title {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
margin: 0 0 0.25rem 0;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-link {
|
|
||||||
color: #3182ce;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: color 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-link:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
color: #2b6cb0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-author {
|
|
||||||
font-size: 0.875rem;
|
|
||||||
color: #4a5568;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-author-name {
|
|
||||||
font-weight: 600;
|
|
||||||
color: #2d3748;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-arrow {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
color: #a0aec0;
|
|
||||||
padding-left: 1rem;
|
|
||||||
transition: color 0.2s ease, transform 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-item:hover .s-res-arrow {
|
|
||||||
color: #3182ce;
|
|
||||||
transform: translateX(3px);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- ERGEBNISSE PRO SEITE & PAGINIERUNG --- */
|
|
||||||
.s-res-pagination-footer {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-top: 2rem;
|
|
||||||
padding-top: 1.5rem;
|
|
||||||
border-top: 1px solid #e2e8f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Dropdown-Auswahl */
|
|
||||||
.s-res-limit-selector {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-limit-label {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: #4a5568;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-limit-select {
|
|
||||||
padding: 0.35rem 1.5rem 0.35rem 0.5rem;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: #2d3748;
|
|
||||||
background-color: #ffffff;
|
|
||||||
border: 1px solid #cbd5e1;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
outline: none;
|
|
||||||
transition: border-color 0.2s;
|
|
||||||
|
|
||||||
/* Diskreter nativer Pfeil-Style */
|
|
||||||
appearance: none;
|
|
||||||
background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://w3.org' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: right 0.4rem center;
|
|
||||||
background-size: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-limit-select:focus {
|
|
||||||
border-color: #3182ce;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Seitennummern Navigation */
|
|
||||||
.s-res-page-navigation {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-page-btn {
|
|
||||||
background-color: #ffffff;
|
|
||||||
border: 1px solid #cbd5e1;
|
|
||||||
color: #4a5568;
|
|
||||||
padding: 0.35rem 0.75rem;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
font-weight: 500;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-page-btn:hover:not(:disabled) {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
border-color: #cbd5e1;
|
|
||||||
color: #2d3748;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-page-btn-active {
|
|
||||||
background-color: #3182ce;
|
|
||||||
border-color: #3182ce;
|
|
||||||
color: #ffffff;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.s-res-page-btn:disabled {
|
|
||||||
background-color: #f1f5f9;
|
|
||||||
border-color: #e2e8f0;
|
|
||||||
color: #94a3b8;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.s-res-layout-grid {
|
|
||||||
grid-template-columns: 1fr; /* Stapelt Seitenleiste und Inhalt untereinander */
|
|
||||||
gap: 1.5rem;
|
|
||||||
margin: 1rem auto;
|
|
||||||
}
|
|
||||||
.s-res-pagination-footer {
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1rem;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<a href="index.php?pfad=impressum">Impressum</a>
|
<a href="impressum.php">Impressum</a>
|
||||||
<a href="index.php?pfad=datenschutz">Datenschutz</a>
|
<a href="datenschutz.php">Datenschutz</a>
|
||||||
<a href="index.php?pfad=nutzungsbedingungen">Nutzungsbedingungen</a>
|
<a href="nutzungsbedingungen.php">Nutzungsbedingungen</a>
|
||||||
</footer>
|
</footer>
|
||||||
+55
-18
@@ -1,26 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Globales Menü, wird via PHP später in alle Seiten eingebunden
|
Globales Menü, wird via PHP später in alle Seiten eingebunden
|
||||||
-->
|
-->
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<div class="nav__left">
|
<div class="nav__left">
|
||||||
<a href="index.php" class="nav__logo">
|
<a href="index.php" class="nav__logo">
|
||||||
<img src="images/logos/logo_full.png" alt="Logo">
|
<img src="images/logos/logo_full.png" alt="Logo">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Mobile navbar mit Burger-Symbol -->
|
<!-- Mobile navbar mit Burger-Symbol -->
|
||||||
<input type="checkbox" id="nav-toggle" class="nav__checkbox">
|
<input type="checkbox" id="nav-toggle" class="nav__checkbox">
|
||||||
<label for="nav-toggle" id="mobile-nav">
|
<label for="nav-toggle" id="mobile-nav">
|
||||||
<span>☰</span> <!-- Burger Icon Symbol -->
|
<span>☰</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<ul id="mobile-nav" class="nav__mobile-menu">
|
<ul id="mobile-nav" class="nav__mobile-menu">
|
||||||
<li>
|
|
||||||
<label for="nav-toggle" class="nav__close-btn">×</label>
|
<?php if (isset($_SESSION['user'])): ?>
|
||||||
</li>
|
|
||||||
<li><a href="index.php?pfad=profile">Profil</a></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=logout">Abmelden</a></li>
|
||||||
<li><a href="index.php?pfad=register">Registrieren</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>
|
<li>
|
||||||
<label class="nav__mobile-label">Sprachen</label>
|
<label class="nav__mobile-label">Sprachen</label>
|
||||||
<ul class="nav__mobile-submenu">
|
<ul class="nav__mobile-submenu">
|
||||||
@@ -38,7 +49,7 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
|||||||
<li><a href="index.php?pfad=mathe">Mathematik</a></li>
|
<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=biologie">Biologie</a></li>
|
||||||
<li><a href="index.php?pfad=chemie">Chemie</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=physik">Physik</a></li>
|
||||||
<li><a href="index.php?pfad=informatik">Informatik</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=astronomie">Astronomie</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -84,6 +95,7 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
|||||||
<a href="index.php?pfad=literatur">Literatur</a>
|
<a href="index.php?pfad=literatur">Literatur</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="nav__item nav__dropdown">
|
<div class="nav__item nav__dropdown">
|
||||||
<button class="nav__dropdown-toggle">MINT</button>
|
<button class="nav__dropdown-toggle">MINT</button>
|
||||||
<div class="nav__dropdown-menu">
|
<div class="nav__dropdown-menu">
|
||||||
@@ -95,6 +107,7 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
|||||||
<a href="index.php?pfad=astronomie">Astronomie</a>
|
<a href="index.php?pfad=astronomie">Astronomie</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="nav__item nav__dropdown">
|
<div class="nav__item nav__dropdown">
|
||||||
<button class="nav__dropdown-toggle">Gesellschaft & Werte</button>
|
<button class="nav__dropdown-toggle">Gesellschaft & Werte</button>
|
||||||
<div class="nav__dropdown-menu">
|
<div class="nav__dropdown-menu">
|
||||||
@@ -111,6 +124,7 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
|||||||
<a href="index.php?pfad=theater">Theater</a>
|
<a href="index.php?pfad=theater">Theater</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="nav__item nav__dropdown">
|
<div class="nav__item nav__dropdown">
|
||||||
<button class="nav__dropdown-toggle">Technik & Praxis</button>
|
<button class="nav__dropdown-toggle">Technik & Praxis</button>
|
||||||
<div class="nav__dropdown-menu">
|
<div class="nav__dropdown-menu">
|
||||||
@@ -123,13 +137,36 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="nav__right">
|
<div class="nav__right">
|
||||||
<a href="index.php?pfad=profile" class="nav_item nav__link">Profil</a>
|
|
||||||
<div class="nav__search">
|
<?php if (isset($_SESSION['user'])): ?>
|
||||||
<?php
|
|
||||||
include_once 'search.php';
|
<a href="index.php?pfad=profile" class="nav__item nav__link">
|
||||||
?>
|
Profil
|
||||||
</div>
|
</a>
|
||||||
<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>
|
<div class="nav__search">
|
||||||
|
<?php include_once 'search.php'; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -1,40 +1,72 @@
|
|||||||
<!--
|
<?php
|
||||||
Seite: Index der Lernplattform
|
session_start();
|
||||||
Funktion: Webseitengerüst, Anzeigen von Content
|
ob_start();
|
||||||
-->
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
|
|
||||||
<head>
|
$pfad = $_GET["pfad"] ?? "home";
|
||||||
<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">
|
|
||||||
<title>EduForge</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
<body>
|
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();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
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">
|
||||||
|
<title>EduForge</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once 'includes/navbar.php';
|
include_once 'includes/navbar.php';
|
||||||
//Dynamischer Inhalt:
|
|
||||||
if (isset($_GET["pfad"])) {
|
/*
|
||||||
if (file_exists('content/' . $_GET["pfad"] . '.php')) {
|
Dynamischer Inhalt:
|
||||||
include_once 'content/' . $_GET["pfad"] . '.php';
|
Je nach pfad-Parameter wird die passende Datei aus content geladen.
|
||||||
} else {
|
*/
|
||||||
include_once 'content/404.php';
|
if (file_exists('content/' . $pfad . '.php')) {
|
||||||
}
|
include_once 'content/' . $pfad . '.php';
|
||||||
} else {
|
} else {
|
||||||
include_once 'content/home.php';
|
include_once 'content/404.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once 'includes/footer.php';
|
include_once 'includes/footer.php';
|
||||||
?>
|
?>
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
ob_end_flush();
|
||||||
|
?>
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
<meta name="description" content="EduForge">
|
<meta name="description" content="EduForge">
|
||||||
<meta name="author" content="Niklas Ortmann">
|
<meta name="author" content="Niklas Ortmann">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<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="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||||
<link rel="stylesheet" href="../css/main.css">
|
<link rel="stylesheet" href="css/main.css">
|
||||||
<link rel="stylesheet" href="../css/navbar.css">
|
<link rel="stylesheet" href="css/navbar.css">
|
||||||
<link rel="stylesheet" href="../css/footer.css">
|
<link rel="stylesheet" href="css/footer.css">
|
||||||
<title>EduForge</title>
|
<title>EduForge</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?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"])) {
|
||||||
|
|
||||||
|
$_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,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "php/model/LocalUserDAO.php";
|
||||||
|
|
||||||
|
$dao = new LocalUserDAO();
|
||||||
|
|
||||||
|
if (!isset($_SESSION["user"])) {
|
||||||
|
header("Location: index.php?pfad=login");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
$_SESSION = [];
|
||||||
|
session_destroy();
|
||||||
|
|
||||||
|
header("Location: index.php?pfad=login");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "php/model/LocalUserDAO.php";
|
||||||
|
|
||||||
|
$dao = new LocalUserDAO();
|
||||||
|
$error = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Verarbeitung des Registrierungs-Formulars
|
||||||
|
Funktion: Erstellt neuen Benutzer und speichert ihn im DAO + Session
|
||||||
|
*/
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
|
||||||
|
$email = $_POST["email"] ?? "";
|
||||||
|
$vorname = $_POST["vorname"] ?? "";
|
||||||
|
$nachname = $_POST["nachname"] ?? "";
|
||||||
|
$password = password_hash(
|
||||||
|
$_POST["password"] ?? "",
|
||||||
|
PASSWORD_DEFAULT
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($dao->findUser($email)) {
|
||||||
|
|
||||||
|
$error = "Diese E-Mail-Adresse ist bereits registriert.";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$dao->addUser(
|
||||||
|
$email,
|
||||||
|
$vorname . " " . $nachname,
|
||||||
|
$password
|
||||||
|
);
|
||||||
|
|
||||||
|
$_SESSION["user"] = $vorname . " " . $nachname;
|
||||||
|
$_SESSION["user_email"] = $email;
|
||||||
|
|
||||||
|
header("Location: index.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
require_once '../model/LocalArticleManager.php';
|
|
||||||
require_once '../model/ArticleManager.php';
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|
||||||
if(!isset($_POST["search"])){
|
|
||||||
$_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.
|
|
||||||
} 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();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
require_once "UserDAOInterface.php";
|
||||||
|
|
||||||
|
class LocalUserDAO implements UserDAOInterface {
|
||||||
|
|
||||||
|
private string $file = "data/users.json";
|
||||||
|
|
||||||
|
private function loadUsers() {
|
||||||
|
if (!file_exists($this->file)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = file_get_contents($this->file);
|
||||||
|
$users = json_decode($json, true);
|
||||||
|
|
||||||
|
return is_array($users) ? $users : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function saveUsers($users) {
|
||||||
|
file_put_contents(
|
||||||
|
$this->file,
|
||||||
|
json_encode($users, JSON_PRETTY_PRINT)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findUser($email) {
|
||||||
|
$users = $this->loadUsers();
|
||||||
|
|
||||||
|
foreach ($users as $user) {
|
||||||
|
if ($user["email"] === $email) {
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addUser($email, $username, $password) {
|
||||||
|
$users = $this->loadUsers();
|
||||||
|
|
||||||
|
$users[] = [
|
||||||
|
"email" => $email,
|
||||||
|
"username" => $username,
|
||||||
|
"password" => $password
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->saveUsers($users);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteUser($email) {
|
||||||
|
$users = $this->loadUsers();
|
||||||
|
|
||||||
|
foreach ($users as $i => $user) {
|
||||||
|
if ($user["email"] === $email) {
|
||||||
|
unset($users[$i]);
|
||||||
|
$users = array_values($users);
|
||||||
|
$this->saveUsers($users);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @param string $email E-Mail-Adresse des gesuchten Benutzers
|
||||||
|
* @return array|null Benutzerdaten als Array oder null
|
||||||
|
*/
|
||||||
|
public function findUser($email);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt einen neuen Benutzer hinzu.
|
||||||
|
*
|
||||||
|
* @param string $email E-Mail-Adresse des Benutzers
|
||||||
|
* @param string $username Benutzername des Benutzers
|
||||||
|
* @param string $password Passwort des Benutzers
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addUser($email, $username, $password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public function deleteUser($email);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user