Backend-Editoren admin-geschuetzt (admin_gate) + Admin-Hub auf Admin-Seite; save_map admin-oder-lehrer; foto-upload admin-bypass (PIN bleibt)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,11 @@
|
||||
<FilesMatch "\.(sh|sql|bak)$">
|
||||
Require all denied
|
||||
</FilesMatch>
|
||||
# Backend-Editor-UI (statisch) nicht direkt ausliefern — nur über die
|
||||
# admin-geschützte Route /stadt-editor (pages/stadt-editor.php) erreichbar.
|
||||
<Files "stadt-editor.html">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
RewriteEngine On
|
||||
# Kein RewriteBase — Apache nutzt den Request-Pfad automatisch.
|
||||
|
||||
@@ -48,6 +48,17 @@
|
||||
</div>
|
||||
|
||||
<div class="wrap">
|
||||
<div class="card">
|
||||
<div class="card-h">🛠️ Backend-Werkzeuge (nur Admin)</div>
|
||||
<div style="display:flex;flex-wrap:wrap;gap:.5rem">
|
||||
<a class="btn btn-outline" href="sims/tourismusregion/editor.php">🗺️ Tourismus-Karten-Editor (Region)</a>
|
||||
<a class="btn btn-outline" href="sims/tourismustal/editor.php">🏠 Tourismustal-Sprite-Editor</a>
|
||||
<a class="btn btn-outline" href="stadt-editor">🏙️ Stadt-Raumplanung-Editor</a>
|
||||
<a class="btn btn-outline" href="foto-upload">📷 Schulbuch-Bildupload</a>
|
||||
</div>
|
||||
<div style="font-size:.66rem;color:#8a8a8a;margin-top:.55rem">Alle nur mit Admin-Login erreichbar. Schulbuch-Upload zusätzlich per PIN (0815). Heli-Audio-Werkzeuge liegen nur lokal (<code>.LocalDeveloperTools</code>) und sind nicht auf dem Server.</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="stat-row">
|
||||
<div class="stat"><div class="n" id="stat-total">—</div><div class="l">Gesamt</div></div>
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
require_once __DIR__ . '/../php/config/app.php';
|
||||
$bp = BASE_PATH;
|
||||
|
||||
/* ---------- Zugang: eingeloggte:r Admin ODER PIN (Ausnahme, vorläufig) ---------- */
|
||||
require_once __DIR__ . '/../php/lib/Session.php';
|
||||
Session::start();
|
||||
$__isAdmin = !empty($_SESSION['admin_id']);
|
||||
|
||||
/* ---------- PIN-Schranke (im Browser gespeichert, 1 Jahr) ---------- */
|
||||
$PIN = '0815';
|
||||
$pinFehler = false;
|
||||
@@ -24,7 +29,7 @@ if (isset($_POST['pin'])) {
|
||||
}
|
||||
$pinFehler = true;
|
||||
}
|
||||
if (($_COOKIE['ggs_foto_pin'] ?? '') !== $PIN) {
|
||||
if (!$__isAdmin && ($_COOKIE['ggs_foto_pin'] ?? '') !== $PIN) {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
<?php renderPage('stadt-editor.html');
|
||||
<?php
|
||||
require __DIR__ . '/../php/lib/admin_gate.php';
|
||||
renderPage('stadt-editor.html');
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin-Gate für Backend-Werkzeuge (Editoren, Uploads).
|
||||
* Nur mit gültiger Super-Admin-Session erreichbar — sonst Redirect zur Admin-Login-Seite.
|
||||
*
|
||||
* Standalone einbindbar: lädt eigene Abhängigkeiten (BASE_PATH + Session), weil diese
|
||||
* Werkzeuge z. T. als eigenständige .php ausgeliefert werden (nicht über den Front-Controller).
|
||||
*
|
||||
* Einbinden ganz am Anfang der zu schützenden Datei:
|
||||
* require __DIR__ . '/…/php/lib/admin_gate.php';
|
||||
*/
|
||||
if (!defined('BASE_PATH')) {
|
||||
require_once __DIR__ . '/../config/app.php';
|
||||
}
|
||||
if (!class_exists('Session')) {
|
||||
require_once __DIR__ . '/Session.php';
|
||||
}
|
||||
Session::start();
|
||||
|
||||
if (empty($_SESSION['admin_id'])) {
|
||||
$base = defined('BASE_PATH') ? BASE_PATH : '';
|
||||
header('Location: ' . $base . '/admin.html');
|
||||
exit;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
# Direkter Zugriff auf die Editor-UI gesperrt — nur über den admin-geschützten
|
||||
# editor.php (Admin-Gate) erreichbar. editor.php liest editor.html serverseitig.
|
||||
<Files "editor.html">
|
||||
Require all denied
|
||||
</Files>
|
||||
@@ -14,8 +14,13 @@ require_once __DIR__ . '/../../../php/config/app.php';
|
||||
require_once __DIR__ . '/../../../php/lib/Database.php';
|
||||
require_once __DIR__ . '/../../../php/lib/Response.php';
|
||||
require_once __DIR__ . '/../../../php/lib/Session.php';
|
||||
Session::start(); // Session laden, sonst ist $_SESSION leer → requireTeacher wirft immer 401
|
||||
Session::requireTeacher();
|
||||
Session::start(); // Session laden, sonst ist $_SESSION leer → Auth-Check wirft immer 401
|
||||
// Backend-Editor: Admin ODER eingeloggte Lehrperson darf speichern.
|
||||
if (empty($_SESSION['admin_id']) && !Session::teacherId()) {
|
||||
http_response_code(401);
|
||||
echo json_encode(['ok' => false, 'error' => 'Nicht eingeloggt (Admin oder Lehrperson erforderlich).']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$raw = file_get_contents('php://input');
|
||||
$data = json_decode($raw, true);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin-geschützter Zugang zum Tourismusregion-Karten-Editor.
|
||||
* Nur mit Admin-Session erreichbar; die eigentliche UI liegt in editor.html
|
||||
* (per .htaccess vor direktem Zugriff gesperrt) und wird hier ausgeliefert.
|
||||
*/
|
||||
require __DIR__ . '/../../php/lib/admin_gate.php';
|
||||
readfile(__DIR__ . '/editor.html');
|
||||
@@ -0,0 +1,5 @@
|
||||
# Direkter Zugriff auf die Editor-UI gesperrt — nur über den admin-geschützten
|
||||
# editor.php (Admin-Gate) erreichbar. editor.php liest editor.html serverseitig.
|
||||
<Files "editor.html">
|
||||
Require all denied
|
||||
</Files>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin-geschützter Zugang zum Tourismustal-Sprite-Editor.
|
||||
* Nur mit Admin-Session erreichbar; die UI liegt in editor.html
|
||||
* (per .htaccess vor direktem Zugriff gesperrt) und wird hier ausgeliefert.
|
||||
*/
|
||||
require __DIR__ . '/../../php/lib/admin_gate.php';
|
||||
readfile(__DIR__ . '/editor.html');
|
||||
Reference in New Issue
Block a user