fixes
This commit is contained in:
1 parent
a5fd709a89
commit
27a6a4bf7c
3 files changed
+253
-114
No files matched your search
@@ -50,6 +50,10 @@ class getSpecificData {
|
||||
return $_SERVER['HTTP_REFERER'] ?? 'Unbekannt';
|
||||
}
|
||||
|
||||
public function getWebsite(): string {
|
||||
return $_SERVER['HTTP_HOST'] ?? 'Unbekannt';
|
||||
}
|
||||
|
||||
public function getDatabase(): string {
|
||||
$conn = db_connect();
|
||||
return $conn->host_info;
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
<?php
|
||||
// logging();
|
||||
function redirectToWebsite(string $website): void
|
||||
{
|
||||
$website = trim($website);
|
||||
|
||||
if (!isset($_GET['website'])) {
|
||||
die("Fehlender Parameter: website");
|
||||
}
|
||||
|
||||
$website = trim($_GET['website']);
|
||||
|
||||
$blocked_schemes = ['javascript:', 'data:', 'file:'];
|
||||
foreach ($blocked_schemes as $scheme) {
|
||||
if (stripos($website, $scheme) === 0) {
|
||||
if ($website === '') {
|
||||
die("Ungültige URL.");
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/^https?:\/\//i', $website)) {
|
||||
header("Location: " . $website);
|
||||
$blocked_schemes = ['javascript:', 'data:', 'file:'];
|
||||
foreach ($blocked_schemes as $scheme) {
|
||||
if (stripos($website, $scheme) === 0) {
|
||||
die("Ungültige URL.");
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/^https?:\/\//i', $website)) {
|
||||
header("Location: " . $website);
|
||||
exit;
|
||||
}
|
||||
|
||||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$website = ltrim($website, "/");
|
||||
$redirectUrl = $protocol . $domain . "/" . $website;
|
||||
|
||||
header("Location: " . $redirectUrl);
|
||||
exit;
|
||||
}
|
||||
|
||||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$website = ltrim($website, "/");
|
||||
|
||||
$redirectUrl = $protocol . $domain . "/" . $website;
|
||||
|
||||
header("Location: " . $redirectUrl);
|
||||
exit;
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
$configFile = 'config.php';
|
||||
$backupDir = 'config_backups';
|
||||
@@ -105,107 +104,241 @@ unset($_SESSION['status_message']);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Admin Site Control</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style>
|
||||
body { display: flex; flex-direction: column; height: 100vh; margin: 0; background: #0b0b0b; color: #eee; font-family: sans-serif; }
|
||||
.main { display: flex; flex: 1; overflow: hidden; }
|
||||
.content { flex: 1; padding: 10px; overflow-y: auto; }
|
||||
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; margin-bottom: 40px; }
|
||||
.admin-card { background: #161616; border: 1px solid #333; border-radius: 10px; padding: 18px; position: relative; }
|
||||
.admin-card.new-item { border: 1px dashed #28a745; background: #1a231a; }
|
||||
input[type="text"], select { width: 100%; margin: 8px 0; padding: 10px; background: #222; border: 1px solid #444; color: #fff; border-radius: 5px; box-sizing: border-box; }
|
||||
input[type="color"] { width: 100%; height: 45px; border: 1px solid #444; background: #222; cursor: pointer; border-radius: 5px; margin: 8px 0; padding: 2px;}
|
||||
.status-msg { background: #28a745; padding: 15px; border-radius: 5px; margin-bottom: 20px; text-align: center; font-weight: bold; }
|
||||
.save-bar { position: sticky; bottom: -20px; background: #0b0b0b; padding: 25px; border-top: 1px solid #333; text-align: center; z-index: 100; }
|
||||
.btn-save { background: #007bff; color: white; padding: 14px 80px; border: none; border-radius: 6px; cursor: pointer; font-size: 1rem; font-weight: bold; }
|
||||
.btn-add { background: #28a745; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; }
|
||||
h2 { border-bottom: 1px solid #333; padding-bottom: 12px; margin-top: 40px; display: flex; justify-content: space-between; align-items: center; color: #007bff; }
|
||||
.badge { background: #333; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; color: #aaa; }
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
background: #0b0b0b;
|
||||
color: #eee;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.admin-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.admin-card {
|
||||
background: #161616;
|
||||
border: 1px solid #333;
|
||||
border-radius: 10px;
|
||||
padding: 18px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.admin-card.new-item {
|
||||
border: 1px dashed #28a745;
|
||||
background: #1a231a;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
select {
|
||||
width: 100%;
|
||||
margin: 8px 0;
|
||||
padding: 10px;
|
||||
background: #222;
|
||||
border: 1px solid #444;
|
||||
color: #fff;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
input[type="color"] {
|
||||
width: 100%;
|
||||
height: 45px;
|
||||
border: 1px solid #444;
|
||||
background: #222;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
margin: 8px 0;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.status-msg {
|
||||
background: #28a745;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.save-bar {
|
||||
position: sticky;
|
||||
bottom: -20px;
|
||||
background: #0b0b0b;
|
||||
padding: 25px;
|
||||
border-top: 1px solid #333;
|
||||
text-align: center;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.btn-save {
|
||||
background: #007bff;
|
||||
color: white;
|
||||
padding: 14px 80px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.btn-add {
|
||||
background: #28a745;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 16px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
border-bottom: 1px solid #333;
|
||||
padding-bottom: 12px;
|
||||
margin-top: 40px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: #007bff;
|
||||
}
|
||||
|
||||
.badge {
|
||||
background: #333;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.8rem;
|
||||
color: #aaa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="dark-mode">
|
||||
<div class="main">
|
||||
<?php if (!($_SESSION['logged_in'] ?? false)): ?>
|
||||
<div style="margin: auto; width: 320px; padding: 40px; background: #161616; border-radius: 12px; border: 1px solid #333;">
|
||||
<form method="post">
|
||||
<h2>🔐 Login</h2>
|
||||
<input type="password" name="password" placeholder="Passwort" required>
|
||||
<button type="submit" style="width:100%; padding:12px; background:#007bff; border:none; color:white; border-radius:5px; cursor:pointer; margin-top:10px;">Einloggen</button>
|
||||
</form>
|
||||
</div>
|
||||
<div
|
||||
style="margin: auto; width: 320px; padding: 40px; background: #161616; border-radius: 12px; border: 1px solid #333;">
|
||||
<form method="post">
|
||||
<h2>🔐 Login</h2>
|
||||
<input type="password" name="password" placeholder="Passwort" required>
|
||||
<button type="submit"
|
||||
style="width:100%; padding:12px; background:#007bff; border:none; color:white; border-radius:5px; cursor:pointer; margin-top:10px;">Einloggen</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="content">
|
||||
<?php if($message): ?><div class="status-msg"><?= $message ?></div><?php endif; ?>
|
||||
<div class="content">
|
||||
<?php if($message): ?><div class="status-msg"><?= $message ?></div><?php endif; ?>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<h2>📦 Sidebar Gruppen <button type="button" class="btn-add" onclick="addNew('serviceGroup')">+ Neue Gruppe</button></h2>
|
||||
<div class="admin-grid" id="container-serviceGroup">
|
||||
<?php foreach ($serviceGroups as $id => $group): ?>
|
||||
<div class="admin-card">
|
||||
<div style="margin-bottom:10px;"><span class="badge">ID: <?= htmlspecialchars($id) ?></span></div>
|
||||
<input type="text" name="serviceGroups[<?= $id ?>][label]" value="<?= htmlspecialchars($group['label']) ?>" placeholder="Anzeigename">
|
||||
<label><input type="checkbox" name="serviceGroups[<?= $id ?>][defaultOpen]" <?= ($group['defaultOpen'] ?? false) ? 'checked' : '' ?>> Offen</label>
|
||||
<form method="post">
|
||||
|
||||
<h2>📦 Sidebar Gruppen <button type="button" class="btn-add" onclick="addNew('serviceGroup')">+ Neue
|
||||
Gruppe</button></h2>
|
||||
<div class="admin-grid" id="container-serviceGroup">
|
||||
<?php foreach ($serviceGroups as $id => $group): ?>
|
||||
<div class="admin-card">
|
||||
<div style="margin-bottom:10px;"><span class="badge">ID: <?= htmlspecialchars($id) ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<input type="text" name="serviceGroups[<?= $id ?>][label]"
|
||||
value="<?= htmlspecialchars($group['label']) ?>" placeholder="Anzeigename">
|
||||
<label><input type="checkbox" name="serviceGroups[<?= $id ?>][defaultOpen]"
|
||||
<?= ($group['defaultOpen'] ?? false) ? 'checked' : '' ?>> Offen</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<h2>🖥 Sidebar Services <button type="button" class="btn-add" onclick="addNew('service')">+ Neuer Service</button></h2>
|
||||
<div class="admin-grid" id="container-service">
|
||||
<?php foreach ($services as $id => $s): ?>
|
||||
<div class="admin-card">
|
||||
<div style="margin-bottom:10px;"><span class="badge">Datei: <?= htmlspecialchars($id) ?>.php</span></div>
|
||||
<input type="text" name="services[<?= $id ?>][name]" value="<?= htmlspecialchars($s['name']) ?>" placeholder="Name">
|
||||
<label>Sidebar-Gruppe:</label>
|
||||
<select name="services[<?= $id ?>][targetGroup]">
|
||||
<?php foreach ($serviceGroups as $gid => $g): ?>
|
||||
<option value="<?= $gid ?>" <?= (isset($g['services']) && in_array($id, $g['services'])) ? 'selected' : '' ?>><?= htmlspecialchars($g['label']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<label><input type="checkbox" name="services[<?= $id ?>][active]" <?= ($s['active'] ?? false) ? 'checked' : '' ?>> Aktiv</label> |
|
||||
<label><input type="checkbox" name="services[<?= $id ?>][adminOnly]" <?= ($s['adminOnly'] ?? false) ? 'checked' : '' ?>>Nur Admins</label>
|
||||
<h2>🖥 Sidebar Services <button type="button" class="btn-add" onclick="addNew('service')">+ Neuer
|
||||
Service</button></h2>
|
||||
<div class="admin-grid" id="container-service">
|
||||
<?php foreach ($services as $id => $s): ?>
|
||||
<div class="admin-card">
|
||||
<div style="margin-bottom:10px;"><span class="badge">Datei:
|
||||
<?= htmlspecialchars($id) ?>.php</span></div>
|
||||
<input type="text" name="services[<?= $id ?>][name]" value="<?= htmlspecialchars($s['name']) ?>"
|
||||
placeholder="Name">
|
||||
<label>Sidebar-Gruppe:</label>
|
||||
<select name="services[<?= $id ?>][targetGroup]">
|
||||
<?php foreach ($serviceGroups as $gid => $g): ?>
|
||||
<option value="<?= $gid ?>"
|
||||
<?= (isset($g['services']) && in_array($id, $g['services'])) ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($g['label']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<label><input type="checkbox" name="services[<?= $id ?>][active]"
|
||||
<?= ($s['active'] ?? false) ? 'checked' : '' ?>> Aktiv</label> |
|
||||
<label><input type="checkbox" name="services[<?= $id ?>][adminOnly]"
|
||||
<?= ($s['adminOnly'] ?? false) ? 'checked' : '' ?>>Nur Admins</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<h2>🎨 Dashboard Kategorien <button type="button" class="btn-add" onclick="addNew('linkGroup')">+ Neue
|
||||
Kategorie</button></h2>
|
||||
<div class="admin-grid" id="container-linkGroup">
|
||||
<?php foreach ($linkGroups as $id => $lg): ?>
|
||||
<div class="admin-card">
|
||||
<div style="margin-bottom:10px;"><span class="badge">ID: <?= htmlspecialchars($id) ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<input type="text" name="linkGroups[<?= $id ?>][label]"
|
||||
value="<?= htmlspecialchars($lg['label']) ?>" placeholder="Gruppen-Label">
|
||||
<label>Farbe:</label>
|
||||
<input type="color" name="linkGroups[<?= $id ?>][color]"
|
||||
value="<?= $lg['color'] ?? '#3498db' ?>">
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<h2>🎨 Dashboard Kategorien <button type="button" class="btn-add" onclick="addNew('linkGroup')">+ Neue Kategorie</button></h2>
|
||||
<div class="admin-grid" id="container-linkGroup">
|
||||
<?php foreach ($linkGroups as $id => $lg): ?>
|
||||
<div class="admin-card">
|
||||
<div style="margin-bottom:10px;"><span class="badge">ID: <?= htmlspecialchars($id) ?></span></div>
|
||||
<input type="text" name="linkGroups[<?= $id ?>][label]" value="<?= htmlspecialchars($lg['label']) ?>" placeholder="Gruppen-Label">
|
||||
<label>Farbe:</label>
|
||||
<input type="color" name="linkGroups[<?= $id ?>][color]" value="<?= $lg['color'] ?? '#3498db' ?>">
|
||||
<h2>🔘 Dashboard Kacheln <button type="button" class="btn-add" onclick="addNew('linkButton')">+ Neue
|
||||
Kachel</button></h2>
|
||||
<div class="admin-grid" id="container-linkButton">
|
||||
<?php foreach ($linkButtons as $key => $btn): ?>
|
||||
<div class="admin-card">
|
||||
<input type="text" name="linkButtons[<?= $key ?>][label]"
|
||||
value="<?= htmlspecialchars($btn['label']) ?>" placeholder="Name">
|
||||
<input type="text" name="linkButtons[<?= $key ?>][url]"
|
||||
value="<?= htmlspecialchars($btn['url']) ?>" placeholder="URL">
|
||||
<label>Dashboard Kategorie:</label>
|
||||
<select name="linkButtons[<?= $key ?>][group]">
|
||||
<?php foreach ($linkGroups as $id => $lg): ?>
|
||||
<option value="<?= $id ?>" <?= ($btn['group'] == $id) ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($lg['label']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div style="margin-top:5px;">
|
||||
<label><input type="checkbox" name="linkButtons[<?= $key ?>][newTab]"
|
||||
<?= ($btn['newTab'] ?? false) ? 'checked' : '' ?>> Neuer Tab</label> |
|
||||
<label><input type="checkbox" name="linkButtons[<?= $key ?>][adminOnly]"
|
||||
<?= ($btn['adminOnly'] ?? false) ? 'checked' : '' ?>>Nur Admins</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<h2>🔘 Dashboard Kacheln <button type="button" class="btn-add" onclick="addNew('linkButton')">+ Neue Kachel</button></h2>
|
||||
<div class="admin-grid" id="container-linkButton">
|
||||
<?php foreach ($linkButtons as $key => $btn): ?>
|
||||
<div class="admin-card">
|
||||
<input type="text" name="linkButtons[<?= $key ?>][label]" value="<?= htmlspecialchars($btn['label']) ?>" placeholder="Name">
|
||||
<input type="text" name="linkButtons[<?= $key ?>][url]" value="<?= htmlspecialchars($btn['url']) ?>" placeholder="URL">
|
||||
<label>Dashboard Kategorie:</label>
|
||||
<select name="linkButtons[<?= $key ?>][group]">
|
||||
<?php foreach ($linkGroups as $id => $lg): ?>
|
||||
<option value="<?= $id ?>" <?= ($btn['group'] == $id) ? 'selected' : '' ?>><?= htmlspecialchars($lg['label']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div style="margin-top:5px;">
|
||||
<label><input type="checkbox" name="linkButtons[<?= $key ?>][newTab]" <?= ($btn['newTab'] ?? false) ? 'checked' : '' ?>> Neuer Tab</label> |
|
||||
<label><input type="checkbox" name="linkButtons[<?= $key ?>][adminOnly]" <?= ($btn['adminOnly'] ?? false) ? 'checked' : '' ?>>Nur Admins</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="save-bar"><button type="submit" name="save" class="btn-save">💾 Gesamte Konfiguration speichern</button></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="save-bar"><button type="submit" name="save" class="btn-save">💾 Gesamte Konfiguration
|
||||
speichern</button></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
@@ -216,26 +349,25 @@ unset($_SESSION['status_message']);
|
||||
const card = document.createElement('div');
|
||||
card.className = 'admin-card new-item';
|
||||
|
||||
let html = `<div style="margin-bottom:10px;"><span class="badge" style="background:#28a745;color:white;">Neu hinzufügen</span></div>`;
|
||||
let html =
|
||||
`<div style="margin-bottom:10px;"><span class="badge" style="background:#28a745;color:white;">Neu hinzufügen</span></div>`;
|
||||
|
||||
if (type === 'serviceGroup') {
|
||||
html += `<input type="text" name="serviceGroups[${tempId}][new_id]" placeholder="ID (z.B. media)">
|
||||
html +=
|
||||
`<input type="text" name="serviceGroups[${tempId}][new_id]" placeholder="ID (z.B. media)">
|
||||
<input type="text" name="serviceGroups[${tempId}][label]" placeholder="Name">
|
||||
<label><input type="checkbox" name="serviceGroups[${tempId}][defaultOpen]" checked> Ausgeklappt</label>`;
|
||||
}
|
||||
else if (type === 'service') {
|
||||
} else if (type === 'service') {
|
||||
html += `<input type="text" name="services[${tempId}][new_id]" placeholder="Datei ohne .php (z.B. plex)">
|
||||
<input type="text" name="services[${tempId}][name]" placeholder="Anzeigename">
|
||||
<label>Gruppe:</label><select name="services[${tempId}][targetGroup]">
|
||||
<?php foreach ($serviceGroups as $gid => $gl): ?><option value="<?= $gid ?>"><?= $gl['label'] ?></option><?php endforeach; ?></select>
|
||||
<label><input type="checkbox" name="services[${tempId}][active]" checked> Aktiv</label>`;
|
||||
}
|
||||
else if (type === 'linkGroup') {
|
||||
} else if (type === 'linkGroup') {
|
||||
html += `<input type="text" name="linkGroups[${tempId}][new_id]" placeholder="ID (z.B. social)">
|
||||
<input type="text" name="linkGroups[${tempId}][label]" placeholder="Label">
|
||||
<input type="color" name="linkGroups[${tempId}][color]" value="#3498db">`;
|
||||
}
|
||||
else if (type === 'linkButton') {
|
||||
} else if (type === 'linkButton') {
|
||||
html += `<input type="text" name="linkButtons[${tempId}][label]" placeholder="Anzeigename">
|
||||
<input type="text" name="linkButtons[${tempId}][url]" placeholder="https://...">
|
||||
<label>Kategorie:</label><select name="linkButtons[${tempId}][group]">
|
||||
@@ -246,8 +378,11 @@ unset($_SESSION['status_message']);
|
||||
|
||||
card.innerHTML = html;
|
||||
container.appendChild(card);
|
||||
card.scrollIntoView({ behavior: 'smooth' });
|
||||
card.scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user