Abgleich mit Live-Daten
This commit is contained in:
+169
-169
@@ -1,169 +1,169 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// WICHTIG: Pfade aus /admin heraus korrekt auflösen
|
||||
require_once __DIR__ . "/../inc/config.inc.php";
|
||||
require_once __DIR__ . "/../inc/functions.inc.php";
|
||||
|
||||
// Login prüfen
|
||||
$user = check_admin_user();
|
||||
|
||||
include __DIR__ . "/templates/header.inc.php";
|
||||
|
||||
$user = check_admin_user();
|
||||
$internUserId = (int)$_SESSION['auth']['id'];
|
||||
|
||||
if (!$user) { echo "<div class='container main-container'><h3>Erst anmelden: <a href=login.php>Login</a></h3><br>";
|
||||
|
||||
include("templates/footer.inc.php");
|
||||
exit; }
|
||||
?>
|
||||
<script src="js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
|
||||
<div class="container main-container">
|
||||
<?php
|
||||
|
||||
echo '<div style="float: right; width: 200px; ">';
|
||||
echo "<form action='" . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . "' id='formbenutzersuche' method='POST'>";
|
||||
echo '<input type="hidden" name="aktion" value="benutzersuche" />';
|
||||
echo '<input type="hidden" name="userid_input" id="userid_input" />';
|
||||
echo '<label>Benutzersuche Impfen:</label>
|
||||
<input type="text" id="user_input" name="skill_input" width="48"/>';
|
||||
echo "</form>";
|
||||
echo '</div>';
|
||||
|
||||
?>
|
||||
<h2>Administration - webseiteninhalt anpassen</h2>
|
||||
|
||||
Hallo <?php echo htmlspecialchars($user['vorname'] ?? '', ENT_QUOTES, 'UTF-8'); ?>,<br>
|
||||
Herzlich Willkommen im internen Bereich!<br><br>
|
||||
|
||||
<?php
|
||||
|
||||
$aktion = $_POST["aktion"] ?? null;
|
||||
$subaktion = $_POST["subaktion"] ?? null;
|
||||
|
||||
if (!check_worker()) {
|
||||
echo "Dieser Bereich ist nur für Bearbeiter freigeschaltet!<br><br><br>";
|
||||
} else {
|
||||
|
||||
// =========================
|
||||
// EDIT-MODUS
|
||||
// =========================
|
||||
if ($aktion === "edit") {
|
||||
|
||||
// ------- Speichern -------
|
||||
if ($subaktion === "save") {
|
||||
|
||||
$inhaltid = (int)($_POST["inhaltid"] ?? 0);
|
||||
$inhalt = $_POST["inhalt"] ?? "";
|
||||
$webseitentitel = $_POST["webseitentitel"] ?? "";
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
UPDATE webseiteninhalt
|
||||
SET inhalt = :inhalt,
|
||||
webseitentitel = :webseitentitel
|
||||
WHERE inhaltid = :inhaltid
|
||||
");
|
||||
$stmt->execute([
|
||||
':inhalt' => $inhalt,
|
||||
':webseitentitel' => $webseitentitel,
|
||||
':inhaltid' => $inhaltid,
|
||||
]);
|
||||
|
||||
echo "<div class='infofenster'><h4>Speicherung der Vorlage erfolgreich!</h4></div>";
|
||||
} catch (Throwable $e) {
|
||||
echo "<div class='infofenster'><h4>Fehler bei der Speicherung der Vorlage!</h4></div>";
|
||||
// Optional debug:
|
||||
// echo "<pre>" . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "</pre>";
|
||||
}
|
||||
}
|
||||
|
||||
// ------- Vorlage laden -------
|
||||
$inhaltid = (int)($_POST["inhaltid"] ?? 0);
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT webseitentitel, inhalt
|
||||
FROM webseiteninhalt
|
||||
WHERE inhaltid = ?
|
||||
LIMIT 1
|
||||
");
|
||||
$stmt->execute([$inhaltid]);
|
||||
$rowconfig = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$rowconfig) {
|
||||
echo "<div class='infofenster'><h4>Vorlage nicht gefunden.</h4></div>";
|
||||
} else {
|
||||
$webseitentitel = $rowconfig["webseitentitel"] ?? "";
|
||||
$inhalt = $rowconfig["inhalt"] ?? "";
|
||||
|
||||
echo "<h1>Webseiteninhalt bearbeiten</h1><br>";
|
||||
echo "<h4>Vorlage: " . htmlspecialchars($webseitentitel, ENT_QUOTES, 'UTF-8') . "</h4>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<form action='" . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . "' method='POST'>";
|
||||
echo "<input name='webseitentitel' type='hidden' value='" . htmlspecialchars($webseitentitel, ENT_QUOTES, 'UTF-8') . "'>";
|
||||
echo "<div id='my-editor'></div>";
|
||||
// Inhalt ist HTML -> bewusst NICHT escapen, sonst zerstörst du HTML im Editor
|
||||
echo "<textarea height='200' name='inhalt' id='trumbowyg-demo'>" . $inhalt . "</textarea>";
|
||||
echo "<input name='aktion' type='hidden' value='edit'>";
|
||||
echo "<input name='subaktion' type='hidden' value='save'>";
|
||||
echo "<input name='inhaltid' type='hidden' value='" . (int)$inhaltid . "'><br><br>";
|
||||
echo "<input type='submit' value='Speichern'><br>";
|
||||
echo "</form>";
|
||||
|
||||
echo "<br><br>";
|
||||
echo "<form action='" . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . "' method='POST'>";
|
||||
echo "<input type='submit' class='btn btn-primary btn-sm' value='zurück'>";
|
||||
echo "</form>";
|
||||
}
|
||||
|
||||
} catch (Throwable $e) {
|
||||
echo "<div class='infofenster'><h4>Fehler beim Laden der Vorlage.</h4></div>";
|
||||
// Optional debug:
|
||||
// echo "<pre>" . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "</pre>";
|
||||
}
|
||||
|
||||
// =========================
|
||||
// LISTE (Auswahl)
|
||||
// =========================
|
||||
} else {
|
||||
|
||||
echo "<form action='" . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . "' method='POST'>";
|
||||
echo "Wählen Sie die zu bearbeitenden Webseiteninhalt aus:<br><br>";
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT webseitentitel, inhaltid
|
||||
FROM webseiteninhalt
|
||||
ORDER BY webseitentitel
|
||||
");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
echo "<input name='aktion' type='hidden' value='edit'>";
|
||||
echo "<select name='inhaltid' class='form-control'>";
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$id = (int)$row["inhaltid"];
|
||||
$titel = (string)($row["webseitentitel"] ?? "");
|
||||
echo "<option value='" . $id . "'>" . htmlspecialchars($titel, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . "</option>";
|
||||
}
|
||||
|
||||
echo "</select><br><br>";
|
||||
echo "<input type='submit' value='Bearbeiten' class='btn btn-primary btn'><br><br><br>";
|
||||
echo "</form>";
|
||||
|
||||
} catch (Throwable $e) {
|
||||
echo "<div class='infofenster'><h4>Fehler beim Laden der Liste.</h4></div>";
|
||||
// Optional debug:
|
||||
// echo "<pre>" . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "</pre>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include __DIR__ . "/templates/footer.inc.php";
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// WICHTIG: Pfade aus /admin heraus korrekt auflösen
|
||||
require_once __DIR__ . "/../inc/config.inc.php";
|
||||
require_once __DIR__ . "/../inc/functions.inc.php";
|
||||
|
||||
// Login prüfen
|
||||
$user = check_admin_user();
|
||||
|
||||
include __DIR__ . "/templates/header.inc.php";
|
||||
|
||||
$user = check_admin_user();
|
||||
$internUserId = (int)$_SESSION['auth']['id'];
|
||||
|
||||
if (!$user) { echo "<div class='container main-container'><h3>Erst anmelden: <a href=login.php>Login</a></h3><br>";
|
||||
|
||||
include("templates/footer.inc.php");
|
||||
exit; }
|
||||
?>
|
||||
<script src="js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
|
||||
<div class="container main-container">
|
||||
<?php
|
||||
|
||||
echo '<div style="float: right; width: 200px; ">';
|
||||
echo "<form action='" . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . "' id='formbenutzersuche' method='POST'>";
|
||||
echo '<input type="hidden" name="aktion" value="benutzersuche" />';
|
||||
echo '<input type="hidden" name="userid_input" id="userid_input" />';
|
||||
echo '<label>Benutzersuche Impfen:</label>
|
||||
<input type="text" id="user_input" name="skill_input" width="48"/>';
|
||||
echo "</form>";
|
||||
echo '</div>';
|
||||
|
||||
?>
|
||||
<h2>Administration - webseiteninhalt anpassen</h2>
|
||||
|
||||
Hallo <?php echo htmlspecialchars($user['vorname'] ?? '', ENT_QUOTES, 'UTF-8'); ?>,<br>
|
||||
Herzlich Willkommen im internen Bereich!<br><br>
|
||||
|
||||
<?php
|
||||
|
||||
$aktion = $_POST["aktion"] ?? null;
|
||||
$subaktion = $_POST["subaktion"] ?? null;
|
||||
|
||||
if (!check_worker()) {
|
||||
echo "Dieser Bereich ist nur für Bearbeiter freigeschaltet!<br><br><br>";
|
||||
} else {
|
||||
|
||||
// =========================
|
||||
// EDIT-MODUS
|
||||
// =========================
|
||||
if ($aktion === "edit") {
|
||||
|
||||
// ------- Speichern -------
|
||||
if ($subaktion === "save") {
|
||||
|
||||
$inhaltid = (int)($_POST["inhaltid"] ?? 0);
|
||||
$inhalt = $_POST["inhalt"] ?? "";
|
||||
$webseitentitel = $_POST["webseitentitel"] ?? "";
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
UPDATE webseiteninhalt
|
||||
SET inhalt = :inhalt,
|
||||
webseitentitel = :webseitentitel
|
||||
WHERE inhaltid = :inhaltid
|
||||
");
|
||||
$stmt->execute([
|
||||
':inhalt' => $inhalt,
|
||||
':webseitentitel' => $webseitentitel,
|
||||
':inhaltid' => $inhaltid,
|
||||
]);
|
||||
|
||||
echo "<div class='infofenster'><h4>Speicherung der Vorlage erfolgreich!</h4></div>";
|
||||
} catch (Throwable $e) {
|
||||
echo "<div class='infofenster'><h4>Fehler bei der Speicherung der Vorlage!</h4></div>";
|
||||
// Optional debug:
|
||||
// echo "<pre>" . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "</pre>";
|
||||
}
|
||||
}
|
||||
|
||||
// ------- Vorlage laden -------
|
||||
$inhaltid = (int)($_POST["inhaltid"] ?? 0);
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT webseitentitel, inhalt
|
||||
FROM webseiteninhalt
|
||||
WHERE inhaltid = ?
|
||||
LIMIT 1
|
||||
");
|
||||
$stmt->execute([$inhaltid]);
|
||||
$rowconfig = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$rowconfig) {
|
||||
echo "<div class='infofenster'><h4>Vorlage nicht gefunden.</h4></div>";
|
||||
} else {
|
||||
$webseitentitel = $rowconfig["webseitentitel"] ?? "";
|
||||
$inhalt = $rowconfig["inhalt"] ?? "";
|
||||
|
||||
echo "<h1>Webseiteninhalt bearbeiten</h1><br>";
|
||||
echo "<h4>Vorlage: " . htmlspecialchars($webseitentitel, ENT_QUOTES, 'UTF-8') . "</h4>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<form action='" . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . "' method='POST'>";
|
||||
echo "<input name='webseitentitel' type='hidden' value='" . htmlspecialchars($webseitentitel, ENT_QUOTES, 'UTF-8') . "'>";
|
||||
echo "<div id='my-editor'></div>";
|
||||
// Inhalt ist HTML -> bewusst NICHT escapen, sonst zerstörst du HTML im Editor
|
||||
echo "<textarea height='200' name='inhalt' id='trumbowyg-demo'>" . $inhalt . "</textarea>";
|
||||
echo "<input name='aktion' type='hidden' value='edit'>";
|
||||
echo "<input name='subaktion' type='hidden' value='save'>";
|
||||
echo "<input name='inhaltid' type='hidden' value='" . (int)$inhaltid . "'><br><br>";
|
||||
echo "<input type='submit' value='Speichern'><br>";
|
||||
echo "</form>";
|
||||
|
||||
echo "<br><br>";
|
||||
echo "<form action='" . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . "' method='POST'>";
|
||||
echo "<input type='submit' class='btn btn-primary btn-sm' value='zurück'>";
|
||||
echo "</form>";
|
||||
}
|
||||
|
||||
} catch (Throwable $e) {
|
||||
echo "<div class='infofenster'><h4>Fehler beim Laden der Vorlage.</h4></div>";
|
||||
// Optional debug:
|
||||
// echo "<pre>" . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "</pre>";
|
||||
}
|
||||
|
||||
// =========================
|
||||
// LISTE (Auswahl)
|
||||
// =========================
|
||||
} else {
|
||||
|
||||
echo "<form action='" . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . "' method='POST'>";
|
||||
echo "Wählen Sie die zu bearbeitenden Webseiteninhalt aus:<br><br>";
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT webseitentitel, inhaltid
|
||||
FROM webseiteninhalt
|
||||
ORDER BY webseitentitel
|
||||
");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
echo "<input name='aktion' type='hidden' value='edit'>";
|
||||
echo "<select name='inhaltid' class='form-control'>";
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$id = (int)$row["inhaltid"];
|
||||
$titel = (string)($row["webseitentitel"] ?? "");
|
||||
echo "<option value='" . $id . "'>" . htmlspecialchars($titel, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . "</option>";
|
||||
}
|
||||
|
||||
echo "</select><br><br>";
|
||||
echo "<input type='submit' value='Bearbeiten' class='btn btn-primary btn'><br><br><br>";
|
||||
echo "</form>";
|
||||
|
||||
} catch (Throwable $e) {
|
||||
echo "<div class='infofenster'><h4>Fehler beim Laden der Liste.</h4></div>";
|
||||
// Optional debug:
|
||||
// echo "<pre>" . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "</pre>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include __DIR__ . "/templates/footer.inc.php";
|
||||
?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user