Compare commits
103 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70f7e05fe1 | |||
| 15f17b7af4 | |||
| 5660f8d59d | |||
| 11b55008ea | |||
| 46dcc16c59 | |||
| d42dff1165 | |||
| 11da418f60 | |||
| 981e78ff7e | |||
| c798bbd230 | |||
| e22d97e15a | |||
| c662369259 | |||
| 11b7be4ca0 | |||
| a029314bc9 | |||
| 8dd2d4f4ea | |||
| a4efbd4f0b | |||
| f63b8c6506 | |||
| caa9a9ff8f | |||
| 524dc2a399 | |||
| 793d9632b2 | |||
| 5892a875c8 | |||
| b130bf9e19 | |||
| 46def40a14 | |||
| a76113dcaf | |||
| f56a04c3ab | |||
| 7f891b6ebf | |||
| 1343496a12 | |||
| 1735dd28a2 | |||
| 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 | |||
| 370c047c16 | |||
| a562a67923 | |||
| 078dbd8901 | |||
| 64d624a6df | |||
| 90ab57e4cb | |||
| a00ddf18e6 | |||
| 5048dc2466 | |||
| 7209fe3e20 | |||
| 4e35e67ef1 | |||
| 830b57d245 | |||
| 06930644a6 | |||
| 8e3642c668 | |||
| 87d78b749b | |||
| 604dbeca93 | |||
| 8e9e7d65d0 | |||
| e2c317e507 | |||
| 5a7fa35465 | |||
| 2601a1c1ca | |||
| 0e26679f24 | |||
| d5ab659217 | |||
| 2d5919d572 | |||
| f56a074a3c | |||
| 24dc432f01 | |||
| 016193de07 | |||
| f04d8fecd3 | |||
| 36276c7c88 | |||
| 4a2cf0b55b | |||
| 400436a73f | |||
| 4c378dfba6 | |||
| c3a9de71f4 | |||
| ecf2e9ef57 | |||
| 45ac70eba2 | |||
| 3b66c6aa3a | |||
| e37b882481 | |||
| b328c2613c |
Generated
+18
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="dataSourceStorageLocal" created-in="IU-261.24374.151">
|
||||||
|
<data-source name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
||||||
|
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
||||||
|
<identifier-quote-string>"</identifier-quote-string>
|
||||||
|
</database-info>
|
||||||
|
<case-sensitivity plain-identifiers="mixed" quoted-identifiers="mixed" />
|
||||||
|
<secret-storage>master_key</secret-storage>
|
||||||
|
<auth-provider>no-auth</auth-provider>
|
||||||
|
<schema-mapping>
|
||||||
|
<introspection-scope>
|
||||||
|
<node kind="schema" qname="@" />
|
||||||
|
</introspection-scope>
|
||||||
|
</schema-mapping>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/db/articles</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
+1833
File diff suppressed because it is too large
Load Diff
Generated
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#n:main
|
||||||
|
!<md> [0, 0, null, null, -2147483648, -2147483648]
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
<DataSourcesHistory>
|
||||||
|
<DataSourceFromHistory isRemovedFromProject="true">
|
||||||
|
<data-source source="LOCAL" name="articles" uuid="a0abcd0a-1d6f-40e4-88be-f442bcb431ba">
|
||||||
|
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
||||||
|
<identifier-quote-string>"</identifier-quote-string>
|
||||||
|
</database-info>
|
||||||
|
<case-sensitivity plain-identifiers="mixed" quoted-identifiers="mixed" />
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/db/articles</jdbc-url>
|
||||||
|
<secret-storage>master_key</secret-storage>
|
||||||
|
<auth-provider>no-auth</auth-provider>
|
||||||
|
<schema-mapping>
|
||||||
|
<introspection-scope>
|
||||||
|
<node kind="schema" qname="@" />
|
||||||
|
</introspection-scope>
|
||||||
|
</schema-mapping>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</DataSourceFromHistory>
|
||||||
|
<DataSourceFromHistory isRemovedFromProject="false">
|
||||||
|
<data-source source="LOCAL" name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
||||||
|
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
||||||
|
<identifier-quote-string>"</identifier-quote-string>
|
||||||
|
</database-info>
|
||||||
|
<case-sensitivity plain-identifiers="mixed" quoted-identifiers="mixed" />
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/db/articles</jdbc-url>
|
||||||
|
<secret-storage>master_key</secret-storage>
|
||||||
|
<auth-provider>no-auth</auth-provider>
|
||||||
|
<schema-mapping>
|
||||||
|
<introspection-scope>
|
||||||
|
<node kind="schema" qname="@" />
|
||||||
|
</introspection-scope>
|
||||||
|
</schema-mapping>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</DataSourceFromHistory>
|
||||||
|
</DataSourcesHistory>
|
||||||
@@ -10,16 +10,26 @@ Jeweils im Format `Anmeldename, Passwort, Mailadresse`:
|
|||||||
- `max.mustermann, test123, mustermann@web.de`
|
- `max.mustermann, test123, mustermann@web.de`
|
||||||
|
|
||||||
## Weitere Voraussetzungen zur Nutzung
|
## Weitere Voraussetzungen zur Nutzung
|
||||||
|
- Per Klick auf das Logo gelangt man auf die Home-Seite.
|
||||||
|
|
||||||
## Ausgelassene Teilaufgaben
|
## Ausgelassene Teilaufgaben
|
||||||
|
|
||||||
## Bekannte Fehler und Mängel
|
## Bekannte Fehler und Mängel
|
||||||
- Der Beitragseditor fügt beim Laden von Inhalten leere Zeichen ein.
|
- 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.
|
- 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.
|
||||||
|
- Die Suchseite und Kategorieseite packen momentan alle passenden Beiträge untereinander. Später sollen zunächst 10
|
||||||
|
Ergebnisse auf einer Seite angezeigt werden.
|
||||||
|
|
||||||
## Besonderheiten des Projektes
|
## Besonderheiten des Projektes
|
||||||
- Es wurde ein einfacher Beitrags-Editor erstellt. Mit diesem können Beiträge erstellt oder bearbeitet werden.
|
- 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 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.
|
- 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.
|
- 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 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>
|
<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>
|
<h1>404 - Seite nicht vorhanden</h1>
|
||||||
<p>
|
<p>
|
||||||
Später im Projekt sollen über index.php?pfad= ... der Inhalt der index.php dynamisch gesetzt werden.
|
Später im Projekt sollen über index.php?pfad= ... der Inhalt der index.php dynamisch gesetzt werden.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once "php/model/LocalUserDAO.php";
|
require_once "php/model/LocalUserManager.php";
|
||||||
|
|
||||||
$dao = new LocalUserDAO();
|
$dao = new LocalUserManager();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Deregistrierung
|
Deregistrierung
|
||||||
|
|||||||
+8
-3
@@ -17,6 +17,11 @@ include_once 'php/controller/home-controller.php';
|
|||||||
Dein Beitrag wurde erfolgreich veröffentlicht!
|
Dein Beitrag wurde erfolgreich veröffentlicht!
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?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
|
<?php
|
||||||
unset($_SESSION["message"]);
|
unset($_SESSION["message"]);
|
||||||
?>
|
?>
|
||||||
@@ -34,21 +39,21 @@ include_once 'php/controller/home-controller.php';
|
|||||||
<!-- Flexbox -->
|
<!-- Flexbox -->
|
||||||
<div class="flexbox">
|
<div class="flexbox">
|
||||||
<div class="container">
|
<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">
|
<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>
|
<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>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<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">
|
<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>
|
<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>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<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">
|
<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>
|
<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>
|
</div>
|
||||||
|
|||||||
+61
-70
@@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
$results = $_SESSION["search_results"] ?? [];
|
||||||
|
$query = $_SESSION["search_query"] ?? "";
|
||||||
|
$resultCount = count($results);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!--
|
<!--
|
||||||
Seite: Suchergebnisse
|
Seite: Suchergebnisse
|
||||||
@@ -10,37 +15,40 @@ session_start();
|
|||||||
<!-- Links: Seitenleiste für Filter und Suche -->
|
<!-- Links: Seitenleiste für Filter und Suche -->
|
||||||
<aside class="s-res-sidebar">
|
<aside class="s-res-sidebar">
|
||||||
|
|
||||||
<!-- Suchleiste Box -->
|
<!-- Sortierfuntion Box und Such Box-->
|
||||||
<div class="s-res-sidebar-box">
|
<form action="php/controller/search-results-controller.php" method="GET" class="s-res-sidebar-form">
|
||||||
<h3 class="s-res-sidebar-title">Suche anpassen</h3>
|
|
||||||
<form action="#" method="GET" class="s-res-search-form">
|
<div class="s-res-sidebar-box">
|
||||||
<input type="search" id="site-search" name="q" placeholder="Suchen..." class="nav__search">
|
<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>
|
<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>
|
||||||
</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>
|
</aside>
|
||||||
|
|
||||||
@@ -48,57 +56,40 @@ session_start();
|
|||||||
|
|
||||||
<div class="s-res-header">
|
<div class="s-res-header">
|
||||||
<h1 class="s-res-main-title">Suchergebnisse</h1>
|
<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>
|
</div>
|
||||||
|
|
||||||
<!-- Ergebnisliste -->
|
<!-- Ergebnisliste -->
|
||||||
<div class="s-res-list">
|
<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
|
<?php
|
||||||
if(isset($_SESSION['message']) && $_SESSION['message'] == "new_search_results"): ?>
|
elseif (isset($_SESSION["search_query"]) && $_SESSION["search_query"] !== "" && $resultCount === 0): ?>
|
||||||
<!-- TODO: Hier die Beiträge ausgeben. -->
|
<p>Keine Beiträge zu diesem Suchbegriff gefunden.</p>
|
||||||
<?php elseif (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
<?php
|
||||||
<p>
|
elseif (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||||
Bitte überprüfe deine Sucheingabe und versuche es erneut!
|
<p>Bitte überprüfe deine Sucheingabe und versuche es erneut!</p>
|
||||||
</p>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php
|
<?php
|
||||||
unset($_SESSION["message"]);
|
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>
|
||||||
<div class="s-res-pagination-footer">
|
<div class="s-res-pagination-footer">
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -86,7 +86,7 @@ include_once 'php/controller/showArticle-controller.php';
|
|||||||
<aside class="editor-sidebar">
|
<aside class="editor-sidebar">
|
||||||
|
|
||||||
<div class="sidebar-block">
|
<div class="sidebar-block">
|
||||||
<button type="submit" class="button">Änderungen speichern</button>
|
<button type="submit" id="editor-button" class="button">Änderungen speichern</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sidebar-block">
|
<div class="sidebar-block">
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ a, button, input, select, textarea, label, main{
|
|||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
.flexbox {
|
.flexbox {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
<!--
|
|
||||||
Artikel: Datenschutz vs Datensicherheit
|
|
||||||
Funktion: Inhalt zum Fach Informatik
|
|
||||||
TODO: entfernen, wenn die Kategorie-Anzeige implementiert ist.
|
|
||||||
-->
|
|
||||||
<!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>
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<FilesMatch "\.db">
|
||||||
|
deny from all
|
||||||
|
</FilesMatch>
|
||||||
+52
-52
@@ -39,50 +39,50 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
|||||||
<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">
|
||||||
<li><a href="index.php?pfad=deutsch">Deutsch</a></li>
|
<li><a href="index.php?pfad=showCategory&category=deutsch">Deutsch</a></li>
|
||||||
<li><a href="index.php?pfad=englisch">Englisch</a></li>
|
<li><a href="index.php?pfad=showCategory&category=englisch">Englisch</a></li>
|
||||||
<li><a href="index.php?pfad=franzoesisch">Französisch</a></li>
|
<li><a href="index.php?pfad=showCategory&category=franzoesisch">Französisch</a></li>
|
||||||
<li><a href="index.php?pfad=latein">Latein</a></li>
|
<li><a href="index.php?pfad=showCategory&category=latein">Latein</a></li>
|
||||||
<li><a href="index.php?pfad=literatur">Literatur</a></li>
|
<li><a href="index.php?pfad=showCategory&category=literatur">Literatur</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<label class="nav__mobile-label">MINT</label>
|
<label class="nav__mobile-label">MINT</label>
|
||||||
<ul class="nav__mobile-submenu">
|
<ul class="nav__mobile-submenu">
|
||||||
<li><a href="index.php?pfad=mathe">Mathematik</a></li>
|
<li><a href="index.php?pfad=showCategory&category=mathe">Mathematik</a></li>
|
||||||
<li><a href="index.php?pfad=biologie">Biologie</a></li>
|
<li><a href="index.php?pfad=showCategory&category=biologie">Biologie</a></li>
|
||||||
<li><a href="index.php?pfad=chemie">Chemie</a></li>
|
<li><a href="index.php?pfad=showCategory&category=chemie">Chemie</a></li>
|
||||||
<li><a href="index.php?pfad=physik">Physik</a></li>
|
<li><a href="index.php?pfad=showCategory&category=physik">Physik</a></li>
|
||||||
<li><a href="index.php?pfad=informatik">Informatik</a></li>
|
<li><a href="index.php?pfad=showCategory&category=informatik">Informatik</a></li>
|
||||||
<li><a href="index.php?pfad=astronomie">Astronomie</a></li>
|
<li><a href="index.php?pfad=showCategory&category=astronomie">Astronomie</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<label class="nav__mobile-label">Gesellschaft & Werte</label>
|
<label class="nav__mobile-label">Gesellschaft & Werte</label>
|
||||||
<ul class="nav__mobile-submenu">
|
<ul class="nav__mobile-submenu">
|
||||||
<li><a href="index.php?pfad=geschichte">Geschichte</a></li>
|
<li><a href="index.php?pfad=showCategory&category=geschichte">Geschichte</a></li>
|
||||||
<li><a href="index.php?pfad=erdkunde">Erdkunde</a></li>
|
<li><a href="index.php?pfad=showCategory&category=erdkunde">Erdkunde</a></li>
|
||||||
<li><a href="index.php?pfad=sozialkunde">Sozialkunde</a></li>
|
<li><a href="index.php?pfad=showCategory&category=sozialkunde">Sozialkunde</a></li>
|
||||||
<li><a href="index.php?pfad=wirtschaft">Wirtschaftskunde</a></li>
|
<li><a href="index.php?pfad=showCategory&category=wirtschaft">Wirtschaftskunde</a></li>
|
||||||
<li><a href="index.php?pfad=religion">Religion</a></li>
|
<li><a href="index.php?pfad=showCategory&category=religion">Religion</a></li>
|
||||||
<li><a href="index.php?pfad=ethik">Ethikunterricht</a></li>
|
<li><a href="index.php?pfad=showCategory&category=ethik">Ethikunterricht</a></li>
|
||||||
<li><a href="index.php?pfad=philosophie">Philosophie</a></li>
|
<li><a href="index.php?pfad=showCategory&category=philosophie">Philosophie</a></li>
|
||||||
<li><a href="index.php?pfad=psychologie">Psychologie</a></li>
|
<li><a href="index.php?pfad=showCategory&category=psychologie">Psychologie</a></li>
|
||||||
<li><a href="index.php?pfad=kunst">Kunst</a></li>
|
<li><a href="index.php?pfad=showCategory&category=kunst">Kunst</a></li>
|
||||||
<li><a href="index.php?pfad=musik">Musik</a></li>
|
<li><a href="index.php?pfad=showCategory&category=musik">Musik</a></li>
|
||||||
<li><a href="index.php?pfad=theater">Theater</a></li>
|
<li><a href="index.php?pfad=showCategory&category=theater">Theater</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<label class="nav__mobile-label">Technik & Praxis</label>
|
<label class="nav__mobile-label">Technik & Praxis</label>
|
||||||
<ul class="nav__mobile-submenu">
|
<ul class="nav__mobile-submenu">
|
||||||
<li><a href="index.php?pfad=technik">Technik</a></li>
|
<li><a href="index.php?pfad=showCategory&category=technik">Technik</a></li>
|
||||||
<li><a href="index.php?pfad=werken">Werken</a></li>
|
<li><a href="index.php?pfad=showCategory&category=werken">Werken</a></li>
|
||||||
<li><a href="index.php?pfad=hauswirtschaft">Hauswirtschaft</a></li>
|
<li><a href="index.php?pfad=showCategory&category=hauswirtschaft">Hauswirtschaft</a></li>
|
||||||
<li><a href="index.php?pfad=sport">Sport</a></li>
|
<li><a href="index.php?pfad=showCategory&category=sport">Sport</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -92,50 +92,50 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
|||||||
<div class="nav__item nav__dropdown">
|
<div class="nav__item nav__dropdown">
|
||||||
<button class="nav__dropdown-toggle">Sprachen</button>
|
<button class="nav__dropdown-toggle">Sprachen</button>
|
||||||
<div class="nav__dropdown-menu">
|
<div class="nav__dropdown-menu">
|
||||||
<a href="index.php?pfad=deutsch">Deutsch</a>
|
<a href="index.php?pfad=showCategory&category=deutsch">Deutsch</a>
|
||||||
<a href="index.php?pfad=englisch">Englisch</a>
|
<a href="index.php?pfad=showCategory&category=englisch">Englisch</a>
|
||||||
<a href="index.php?pfad=franzoesisch">Französisch</a>
|
<a href="index.php?pfad=showCategory&category=franzoesisch">Französisch</a>
|
||||||
<a href="index.php?pfad=latein">Latein</a>
|
<a href="index.php?pfad=showCategory&category=latein">Latein</a>
|
||||||
<a href="index.php?pfad=literatur">Literatur</a>
|
<a href="index.php?pfad=showCategory&category=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">
|
||||||
<a href="index.php?pfad=mathe">Mathematik</a>
|
<a href="index.php?pfad=showCategory&category=mathe">Mathematik</a>
|
||||||
<a href="index.php?pfad=biologie">Biologie</a>
|
<a href="index.php?pfad=showCategory&category=biologie">Biologie</a>
|
||||||
<a href="index.php?pfad=chemie">Chemie</a>
|
<a href="index.php?pfad=showCategory&category=chemie">Chemie</a>
|
||||||
<a href="index.php?pfad=physik">Physik</a>
|
<a href="index.php?pfad=showCategory&category=physik">Physik</a>
|
||||||
<a href="index.php?pfad=informatik">Informatik</a>
|
<a href="index.php?pfad=showCategory&category=informatik">Informatik</a>
|
||||||
<a href="index.php?pfad=astronomie">Astronomie</a>
|
<a href="index.php?pfad=showCategory&category=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">
|
||||||
<a href="index.php?pfad=geschichte">Geschichte</a>
|
<a href="index.php?pfad=showCategory&category=geschichte">Geschichte</a>
|
||||||
<a href="index.php?pfad=erdkunde">Erdkunde</a>
|
<a href="index.php?pfad=showCategory&category=erdkunde">Erdkunde</a>
|
||||||
<a href="index.php?pfad=sozialkunde">Sozialkunde</a>
|
<a href="index.php?pfad=showCategory&category=sozialkunde">Sozialkunde</a>
|
||||||
<a href="index.php?pfad=wirtschaft">Wirtschaftskunde</a>
|
<a href="index.php?pfad=showCategory&category=wirtschaft">Wirtschaftskunde</a>
|
||||||
<a href="index.php?pfad=religion">Religion</a>
|
<a href="index.php?pfad=showCategory&category=religion">Religion</a>
|
||||||
<a href="index.php?pfad=ethik">Ethikunterricht</a>
|
<a href="index.php?pfad=showCategory&category=ethik">Ethikunterricht</a>
|
||||||
<a href="index.php?pfad=philosophie">Philosophie</a>
|
<a href="index.php?pfad=showCategory&category=philosophie">Philosophie</a>
|
||||||
<a href="index.php?pfad=psychologie">Psychologie</a>
|
<a href="index.php?pfad=showCategory&category=psychologie">Psychologie</a>
|
||||||
<a href="index.php?pfad=kunst">Kunst</a>
|
<a href="index.php?pfad=showCategory&category=kunst">Kunst</a>
|
||||||
<a href="index.php?pfad=musik">Musik</a>
|
<a href="index.php?pfad=showCategory&category=musik">Musik</a>
|
||||||
<a href="index.php?pfad=theater">Theater</a>
|
<a href="index.php?pfad=showCategory&category=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">
|
||||||
<a href="index.php?pfad=technik">Technik</a>
|
<a href="index.php?pfad=showCategory&category=technik">Technik</a>
|
||||||
<a href="index.php?pfad=werken">Werken</a>
|
<a href="index.php?pfad=showCategory&category=werken">Werken</a>
|
||||||
<a href="index.php?pfad=hauswirtschaft">Hauswirtschaft</a>
|
<a href="index.php?pfad=showCategory&category=hauswirtschaft">Hauswirtschaft</a>
|
||||||
<a href="index.php?pfad=sport">Sport</a>
|
<a href="index.php?pfad=showCategory&category=sport">Sport</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+7
-2
@@ -2,5 +2,10 @@
|
|||||||
Suchleiste. Wird via PHP später in alle Seiten eingebunden
|
Suchleiste. Wird via PHP später in alle Seiten eingebunden
|
||||||
-->
|
-->
|
||||||
<!--<label for="site-search">Suche</label>-->
|
<!--<label for="site-search">Suche</label>-->
|
||||||
<input type="search" id="site-search" name="q" placeholder="Suchen..." class="nav__search">
|
<form action="php/controller/search-results-controller.php" method="GET" class="search-form" style="display: flex; align-items: center; gap: 5px;">
|
||||||
<button type="submit" class="nav__search-button">Suchen</button>
|
|
||||||
|
<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>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ SESSION_START();
|
|||||||
require_once '../model/LocalArticleManager.php';
|
require_once '../model/LocalArticleManager.php';
|
||||||
require_once '../model/ArticleManager.php';
|
require_once '../model/ArticleManager.php';
|
||||||
require_once '../validator/article-validator.php';
|
require_once '../validator/article-validator.php';
|
||||||
require_once "../model/LocalUserDAO.php";
|
require_once "../model/LocalUserManager.php";
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "php/model/LocalUserDAO.php";
|
require_once "php/model/LocalUserManager.php";
|
||||||
|
|
||||||
$dao = new LocalUserDAO();
|
$dao = new LocalUserManager();
|
||||||
$error = null;
|
$error = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "php/model/LocalUserDAO.php";
|
require_once "php/model/LocalUserManager.php";
|
||||||
require_once "php/model/Article.php";
|
require_once "php/model/Article.php";
|
||||||
require_once "php/model/ArticleManager.php";
|
require_once "php/model/ArticleManager.php";
|
||||||
require_once "php/validator/user-validator.php";
|
require_once "php/validator/user-validator.php";
|
||||||
@@ -13,7 +13,7 @@ if (!isset($_SESSION["user"])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dao = new LocalUserDAO();
|
$dao = new LocalUserManager();
|
||||||
|
|
||||||
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
require_once 'php/model/Article.php';
|
require_once 'php/model/Article.php';
|
||||||
require_once 'php/model/ArticleManager.php';
|
require_once 'php/model/ArticleManager.php';
|
||||||
require_once "../model/LocalUserDAO.php";
|
require_once "../model/LocalUserManager.php";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dao = new LocalUserDAO();
|
$dao = new LocalUserManager();
|
||||||
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
||||||
|
|
||||||
$author = $user["email"];
|
$author = $user["email"];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "php/model/LocalUserDAO.php";
|
require_once "php/model/LocalUserManager.php";
|
||||||
require_once "php/validator/user-validator.php";
|
require_once "php/validator/user-validator.php";
|
||||||
|
|
||||||
$error = null;
|
$error = null;
|
||||||
@@ -22,7 +22,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
$error = "Das Passwort muss 8 bis 72 Zeichen lang sein.";
|
$error = "Das Passwort muss 8 bis 72 Zeichen lang sein.";
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$dao = new LocalUserDAO();
|
$dao = new LocalUserManager();
|
||||||
|
|
||||||
$password = password_hash($plainPassword, PASSWORD_DEFAULT);
|
$password = password_hash($plainPassword, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
|||||||
@@ -2,28 +2,67 @@
|
|||||||
session_start();
|
session_start();
|
||||||
require_once '../model/LocalArticleManager.php';
|
require_once '../model/LocalArticleManager.php';
|
||||||
require_once '../model/ArticleManager.php';
|
require_once '../model/ArticleManager.php';
|
||||||
|
require_once '../model/Article.php';
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
if ($_SERVER["REQUEST_METHOD"] === "GET" && isset($_GET["q"])) {
|
||||||
if(!isset($_POST["search"])){
|
|
||||||
|
$search = trim($_GET["q"]);
|
||||||
|
if (empty($search)) {
|
||||||
|
$_SESSION["search_results"] = [];
|
||||||
|
$_SESSION["search_query"] = "";
|
||||||
$_SESSION["message"] = "missing_parameters";
|
$_SESSION["message"] = "missing_parameters";
|
||||||
header("location: ../../index.php?pfad=search-results");
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$search = $_POST["search"];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$articleManager = ArticleManager::getInstance();
|
$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){
|
} catch (Exception $e){
|
||||||
$_SESSION["message"] = "internal_error";
|
$_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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -7,13 +7,13 @@
|
|||||||
*/
|
*/
|
||||||
class Article
|
class Article
|
||||||
{
|
{
|
||||||
private $id;
|
public $id;
|
||||||
private $title;
|
public $title;
|
||||||
private $content;
|
public $content;
|
||||||
private $author;
|
public $author;
|
||||||
private $creationDate;
|
public $creationDate;
|
||||||
private $category;
|
public $category;
|
||||||
private $tags;
|
public $tags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Konstruktor
|
* Konstruktor
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once 'LocalArticleManager.php';
|
require_once 'LocalArticleManager.php';
|
||||||
|
require_once 'DatabaseArticleManager.php';
|
||||||
require_once 'Article.php';
|
require_once 'Article.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7,11 +8,11 @@ require_once 'Article.php';
|
|||||||
*
|
*
|
||||||
* @author Niklas Ortmann
|
* @author Niklas Ortmann
|
||||||
*/
|
*/
|
||||||
class ArticleManager extends LocalArticleManager
|
class ArticleManager
|
||||||
{
|
{
|
||||||
public static function getInstance()
|
public static function getInstance()
|
||||||
{
|
{
|
||||||
$articleManager = LocalArticleManager::getInstance(); // TODO: später durch DataBaseArticleManager ersetzen.
|
$articleManager = DatabaseArticleManager::getInstance(); // Hier kann zwischen dem lokalen und datenbankbasiertem ArticleManager gewechselt werden.
|
||||||
|
|
||||||
// Erstellen von Dummy-Beiträgen:
|
// Erstellen von Dummy-Beiträgen:
|
||||||
if($articleManager->getArticle(1) == null ){
|
if($articleManager->getArticle(1) == null ){
|
||||||
@@ -19,7 +20,7 @@ class ArticleManager extends LocalArticleManager
|
|||||||
"Satz des Pythagoras",
|
"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...",
|
"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",
|
"max.mustermann",
|
||||||
"Mathe",
|
"mathe",
|
||||||
"Dreiecke, Dreiecksseiten berechnen"
|
"Dreiecke, Dreiecksseiten berechnen"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -28,7 +29,7 @@ class ArticleManager extends LocalArticleManager
|
|||||||
"Tunneleffekt",
|
"Tunneleffekt",
|
||||||
"Der Tunneleffekt ist ein quantenmechanisches Phänomen, bei dem Teilchen...",
|
"Der Tunneleffekt ist ein quantenmechanisches Phänomen, bei dem Teilchen...",
|
||||||
"max.mustermann",
|
"max.mustermann",
|
||||||
"Physik",
|
"physik",
|
||||||
"Quantenphysik, Energie"
|
"Quantenphysik, Energie"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -37,11 +38,12 @@ class ArticleManager extends LocalArticleManager
|
|||||||
"Datenschutz vs Datensicherheit",
|
"Datenschutz vs Datensicherheit",
|
||||||
"Datenschutz ist in unserer digital vernetzten Welt allgegenwärtig...",
|
"Datenschutz ist in unserer digital vernetzten Welt allgegenwärtig...",
|
||||||
"max.mustermann",
|
"max.mustermann",
|
||||||
"Informatik",
|
"informatik",
|
||||||
"Daten, DSGVO"
|
"Daten, DSGVO"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $articleManager;
|
return $articleManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -20,8 +20,7 @@ interface ArticleManagerDAO
|
|||||||
* @param $category string Kategorie des Beitrages
|
* @param $category string Kategorie des Beitrages
|
||||||
* @param $tags string optionale Schlagworte für eine bessere Suche
|
* @param $tags string optionale Schlagworte für eine bessere Suche
|
||||||
*
|
*
|
||||||
* Mögliche Exceptions:
|
* @throws InternalServerErrorException
|
||||||
* TODO: Exceptions implementieren.
|
|
||||||
*/
|
*/
|
||||||
public function addArticle($title, $content, $author, $category, $tags);
|
public function addArticle($title, $content, $author, $category, $tags);
|
||||||
|
|
||||||
@@ -37,34 +36,33 @@ interface ArticleManagerDAO
|
|||||||
* @throws InternalServerErrorException
|
* @throws InternalServerErrorException
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
* @throws UnauthorizedAccessException
|
* @throws UnauthorizedAccessException
|
||||||
* /
|
|
||||||
*/
|
*/
|
||||||
public function updateArticle($id, $article, $author);
|
public function updateArticle($id, $article, $author);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Löscht einen Beitrag aus übergebener ID.
|
* Löscht einen Beitrag aus übergebener ID und dem Nutzer, der die Löschung ausführt.
|
||||||
* @param $id
|
* @param $id
|
||||||
|
* @param $author
|
||||||
* @return void
|
* @return void
|
||||||
*
|
* @throws InternalServerErrorException
|
||||||
* TODO: Exceptions implementieren.
|
* @throws NotFoundException
|
||||||
|
* @throws UnauthorizedAccessException
|
||||||
*/
|
*/
|
||||||
public function deleteArticle($id);
|
public function deleteArticle($id, $author);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Beitrag aufrufen.
|
* Beitrag aufrufen.
|
||||||
* $id ID des Beitrags
|
* $id ID des Beitrags
|
||||||
*
|
*
|
||||||
* @return Article
|
* @return Article
|
||||||
* Mögliche Exceptions:
|
* @throws InternalServerErrorException
|
||||||
* TODO: Exceptions implementieren.
|
|
||||||
*/
|
*/
|
||||||
public function getArticle($id);
|
public function getArticle($id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alle Beiträge aufrufen.
|
* Alle Beiträge aufrufen.
|
||||||
*
|
*
|
||||||
* Mögliche Exceptions:
|
* @throws InternalServerErrorException
|
||||||
* TODO: Exceptions implementieren.
|
|
||||||
*/
|
*/
|
||||||
public function getAllArticles();
|
public function getAllArticles();
|
||||||
|
|
||||||
@@ -72,9 +70,27 @@ interface ArticleManagerDAO
|
|||||||
* Gibt alle Beiträge eines Nutzer mit einer gegebenen ID aus.
|
* Gibt alle Beiträge eines Nutzer mit einer gegebenen ID aus.
|
||||||
* @param $author
|
* @param $author
|
||||||
* @return Article[]
|
* @return Article[]
|
||||||
* TODO: Exceptions implementieren.
|
* @throws InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function getArticlesByAuthor($author);
|
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
|
||||||
|
* @throws InternalServerErrorException
|
||||||
|
*/
|
||||||
|
public function getArticlesByCategory($category);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -0,0 +1,313 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'ArticleManagerDAO.php';
|
||||||
|
require_once 'Article.php';
|
||||||
|
/**
|
||||||
|
* Klasse: Eine SQLLite3 Lösung des ArticleManagerDAO.
|
||||||
|
*
|
||||||
|
* @author Niklas Ortmann
|
||||||
|
*/
|
||||||
|
class DatabaseArticleManager implements ArticleManagerDAO {
|
||||||
|
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konstruktor
|
||||||
|
*
|
||||||
|
* Erstellt die Datenbankverbindung und die Tabelle articles.
|
||||||
|
* @throws InternalServerErrorException
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
if (!file_exists(__DIR__ . '/../../db/articles.db')) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
$db = $this->getConnection();
|
||||||
|
|
||||||
|
$db->exec("
|
||||||
|
CREATE TABLE articles (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
title TEXT,
|
||||||
|
content TEXT,
|
||||||
|
author TEXT,
|
||||||
|
category TEXT,
|
||||||
|
tags TEXT,
|
||||||
|
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);");
|
||||||
|
unset($db);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new InternalServerErrorException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Baut die Verbindung zur Datenbank auf.
|
||||||
|
* @throws InternalServerErrorException
|
||||||
|
*/
|
||||||
|
private function getConnection()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$user = 'root';
|
||||||
|
$pw = null;
|
||||||
|
$dsn = 'sqlite:' . __DIR__ . '/../../db/articles.db';
|
||||||
|
return new PDO($dsn, $user, $pw);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new InternalServerErrorException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt die DatabaseArticleManager-Instanz zurück.
|
||||||
|
* @return DatabaseArticleManager
|
||||||
|
*/
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if (self::$instance == null) {
|
||||||
|
self::$instance = new DatabaseArticleManager();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addArticle($title, $content, $author, $category, $tags)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = $this->getConnection();
|
||||||
|
|
||||||
|
$sql = "INSERT INTO articles (title, content, author, category, tags)
|
||||||
|
VALUES (:title, :content, :author, :category, :tags);";
|
||||||
|
|
||||||
|
$command = $db->prepare($sql);
|
||||||
|
if (!$command) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verknüpft die übergebenen Parameter exakt mit den SQL-Platzhaltern
|
||||||
|
$success = $command->execute([
|
||||||
|
":title" => $title,
|
||||||
|
":content" => $content,
|
||||||
|
":author" => $author,
|
||||||
|
":category" => $category,
|
||||||
|
":tags" => $tags
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$success) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
return intval($db->lastInsertId());
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new InternalServerErrorException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateArticle($id, $article, $author)
|
||||||
|
{
|
||||||
|
if (empty($article)) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Berechtigungsprüfung analog zur lokalen Implementierung:
|
||||||
|
if ($article->getAuthor() !== $author) {
|
||||||
|
throw new UnauthorizedAccessException("unauthorized_access");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$db = $this->getConnection();
|
||||||
|
|
||||||
|
$sql = "UPDATE articles
|
||||||
|
SET title = :title, content = :content, author = :author, category = :category, tags = :tags
|
||||||
|
WHERE id = :id;";
|
||||||
|
|
||||||
|
$command = $db->prepare($sql);
|
||||||
|
if (!$command) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
$success = $command->execute([
|
||||||
|
":id" => $id,
|
||||||
|
":title" => $article->getTitle(),
|
||||||
|
":content" => $article->getContent(),
|
||||||
|
":author" => $author,
|
||||||
|
":category" => $article->getCategory(),
|
||||||
|
":tags" => $article->getTags()
|
||||||
|
]);
|
||||||
|
|
||||||
|
// rowCount() prüft, ob eine Zeile mit dieser ID existierte und geändert werden konnte
|
||||||
|
if (!$success || $command->rowCount() === 0) {
|
||||||
|
// Falls die ID nicht existiert, prüfen wir, ob sie überhaupt da ist
|
||||||
|
if (!$this->getArticle($id)) {
|
||||||
|
throw new NotFoundException("missing_id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteArticle($id, $author)
|
||||||
|
{
|
||||||
|
$article = getArticle($id);
|
||||||
|
if (empty($article)) {
|
||||||
|
throw new NotFoundException("not_found_article");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Berechtigungsprüfung:
|
||||||
|
if ($article->getAuthor() !== $author) {
|
||||||
|
throw new UnauthorizedAccessException("unauthorized_access");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$db = $this->getConnection();
|
||||||
|
$sql = "DELETE FROM articles WHERE id = :id;";
|
||||||
|
|
||||||
|
$command = $db->prepare($sql);
|
||||||
|
if (!$command) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$command->execute([":id" => $id])) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
} catch (PDOException $exc) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getArticle($id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = $this->getConnection();
|
||||||
|
$sql = "SELECT * FROM articles WHERE id = :id;";
|
||||||
|
|
||||||
|
$command = $db->prepare($sql);
|
||||||
|
if (!$command) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
$command->execute([":id" => $id]);
|
||||||
|
$row = $command->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($row) {
|
||||||
|
return new Article(
|
||||||
|
intval($row['id']),
|
||||||
|
$row['title'],
|
||||||
|
$row['content'],
|
||||||
|
$row['author'],
|
||||||
|
$row['category'],
|
||||||
|
$row['tags'],
|
||||||
|
$row['created']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllArticles()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = $this->getConnection();
|
||||||
|
$sql = "SELECT * FROM articles;";
|
||||||
|
|
||||||
|
$command = $db->query($sql);
|
||||||
|
if (!$command) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows = $command->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$articles = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$articles[] = new Article(
|
||||||
|
intval($row['id']),
|
||||||
|
$row['title'],
|
||||||
|
$row['content'],
|
||||||
|
$row['author'],
|
||||||
|
$row['category'],
|
||||||
|
$row['tags'],
|
||||||
|
$row['created']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $articles;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getArticlesByAuthor($author)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = $this->getConnection();
|
||||||
|
$sql = "SELECT * FROM articles WHERE author = :author;";
|
||||||
|
|
||||||
|
$command = $db->prepare($sql);
|
||||||
|
if (!$command) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
$command->execute([":author" => $author]);
|
||||||
|
$rows = $command->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$filteredArticles = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$filteredArticles[] = new Article(
|
||||||
|
intval($row['id']),
|
||||||
|
$row['title'],
|
||||||
|
$row['content'],
|
||||||
|
$row['author'],
|
||||||
|
$row['category'],
|
||||||
|
$row['tags'],
|
||||||
|
$row['created']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $filteredArticles;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getArticlesByCategory($category)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$db = $this->getConnection();
|
||||||
|
$sql = "SELECT * FROM articles WHERE category = :category;";
|
||||||
|
|
||||||
|
$command = $db->prepare($sql);
|
||||||
|
if (!$command) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
|
||||||
|
$command->execute([":category" => $category]);
|
||||||
|
$rows = $command->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$filteredArticles = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$filteredArticles[] = new Article(
|
||||||
|
intval($row['id']),
|
||||||
|
$row['title'],
|
||||||
|
$row['content'],
|
||||||
|
$row['author'],
|
||||||
|
$row['category'],
|
||||||
|
$row['tags'],
|
||||||
|
$row['created']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $filteredArticles;
|
||||||
|
} catch (PDOException $exc) {
|
||||||
|
throw new InternalServerErrorException("internal_error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function search(string $keyword): array
|
||||||
|
{
|
||||||
|
// TODO: implement search()
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
require_once "UserManagerDAO.php";
|
||||||
|
|
||||||
|
class DatabaseUserManager implements UserManagerDAO {
|
||||||
|
|
||||||
|
public function findUser($email)
|
||||||
|
{
|
||||||
|
// TODO: Implement findUser() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addUser($email, $vorname, $nachname, $password)
|
||||||
|
{
|
||||||
|
// TODO: Implement addUser() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateUser($oldEmail, $newEmail, $vorname, $nachname, $password = null)
|
||||||
|
{
|
||||||
|
// TODO: Implement updateUser() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteUser($email)
|
||||||
|
{
|
||||||
|
// TODO: Implement deleteUser() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -102,8 +102,18 @@ class LocalArticleManager implements ArticleManagerDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteArticle($id)
|
public function deleteArticle($id, $author)
|
||||||
{
|
{
|
||||||
|
$article = getArticle($id);
|
||||||
|
if (empty($article)) {
|
||||||
|
throw new NotFoundException("not_found_article");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Berechtigungsprüfung:
|
||||||
|
if ($article->getAuthor() !== $author) {
|
||||||
|
throw new UnauthorizedAccessException("unauthorized_access");
|
||||||
|
}
|
||||||
|
|
||||||
$articles = $this->getAllArticles();
|
$articles = $this->getAllArticles();
|
||||||
$articleFound = false;
|
$articleFound = false;
|
||||||
|
|
||||||
@@ -166,5 +176,61 @@ class LocalArticleManager implements ArticleManagerDAO {
|
|||||||
}
|
}
|
||||||
return $filteredArticles;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "UserDAOInterface.php";
|
require_once "UserManagerDAO.php";
|
||||||
|
|
||||||
class LocalUserDAO implements UserDAOInterface {
|
class LocalUserManager implements UserManagerDAO {
|
||||||
|
|
||||||
private string $file = "data/users.json";
|
private string $file = "data/users.json";
|
||||||
|
|
||||||
|
public static function getInstance(){
|
||||||
|
// TODO: implement the getIsntance method.
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lädt alle Benutzer aus der JSON-Datei.
|
* Lädt alle Benutzer aus der JSON-Datei.
|
||||||
*
|
*
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
require_once "UserManagerDAO.php";
|
||||||
|
|
||||||
|
class UserManager extends LocalUserManager{
|
||||||
|
|
||||||
|
public static function getInstance(){
|
||||||
|
// TODO: implement this.
|
||||||
|
// TODO: dummy-user anlegen: - `max.mustermann, test123, mustermann@web.de` (analog zu ArticleManager)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* Definiert die Methoden, die jede UserDAO-Implementierung
|
* Definiert die Methoden, die jede UserDAO-Implementierung
|
||||||
* bereitstellen muss.
|
* bereitstellen muss.
|
||||||
*/
|
*/
|
||||||
interface UserDAOInterface {
|
interface UserManagerDAO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sucht einen Benutzer anhand seiner E-Mail-Adresse.
|
* Sucht einen Benutzer anhand seiner E-Mail-Adresse.
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
<!--
|
|
||||||
Artikel: Satz des Pythagoras
|
|
||||||
Funktion: Inhalt zum Fach Mathe
|
|
||||||
TODO: entfernen, wenn die Kategorie-Anzeige implementiert ist.
|
|
||||||
-->
|
|
||||||
<!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,47 +0,0 @@
|
|||||||
<!--
|
|
||||||
Artikel: Tunneleffekt
|
|
||||||
Funktion: Inhalt zum Fach Physik
|
|
||||||
TODO: entfernen, wenn die Kategorie-Anzeige implementiert ist.
|
|
||||||
-->
|
|
||||||
<!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