update: variable control service
This commit is contained in:
1 parent
3f94566d06
commit
49c39b532e
5 files changed
+392
-3
No files matched your search
+10
-3
@@ -36,12 +36,13 @@ $serviceGroups = array (
|
||||
),
|
||||
'System' =>
|
||||
array (
|
||||
'label' => 'Administration',
|
||||
'label' => 'Verwaltung',
|
||||
'defaultOpen' => true,
|
||||
'services' =>
|
||||
array (
|
||||
0 => 'services_control',
|
||||
1 => 'user_control',
|
||||
2 => 'variablen_control',
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -91,7 +92,7 @@ $services = array (
|
||||
),
|
||||
'services_control' =>
|
||||
array (
|
||||
'name' => 'Seitenverwaltung',
|
||||
'name' => 'Seiten',
|
||||
'active' => true,
|
||||
'adminOnly' => true,
|
||||
),
|
||||
@@ -109,10 +110,16 @@ $services = array (
|
||||
),
|
||||
'user_control' =>
|
||||
array (
|
||||
'name' => 'Benutzerverwaltung',
|
||||
'name' => 'Benutzer',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'variablen_control' =>
|
||||
array (
|
||||
'name' => 'Variablen',
|
||||
'active' => true,
|
||||
'adminOnly' => true,
|
||||
),
|
||||
);
|
||||
|
||||
$linkGroups = array (
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
<?php
|
||||
|
||||
$superuser = array (
|
||||
'admin' =>
|
||||
array (
|
||||
'password' => 'bBHofurUJWKzPE8Z:',
|
||||
'active' => true,
|
||||
),
|
||||
);
|
||||
|
||||
$serviceGroups = array (
|
||||
'Info' =>
|
||||
array (
|
||||
'label' => 'Home',
|
||||
'defaultOpen' => true,
|
||||
'services' =>
|
||||
array (
|
||||
0 => 'home_info',
|
||||
1 => 'links',
|
||||
2 => 'berichte_arbeit',
|
||||
3 => 'berichte_arbeit_gen',
|
||||
),
|
||||
),
|
||||
'Logs' =>
|
||||
array (
|
||||
'label' => 'Webserver',
|
||||
'defaultOpen' => true,
|
||||
'services' =>
|
||||
array (
|
||||
0 => 'public_request_logs',
|
||||
1 => 'public_request_chart',
|
||||
2 => 'backend_request_logs',
|
||||
3 => 'backend_request_chart',
|
||||
4 => 'personal_request_logs',
|
||||
),
|
||||
),
|
||||
'System' =>
|
||||
array (
|
||||
'label' => 'Administration',
|
||||
'defaultOpen' => true,
|
||||
'services' =>
|
||||
array (
|
||||
0 => 'services_control',
|
||||
1 => 'user_control',
|
||||
2 => 'test',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$services = array (
|
||||
'home_info' =>
|
||||
array (
|
||||
'name' => 'Home',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'links' =>
|
||||
array (
|
||||
'name' => 'Externe Links',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'public_request_logs' =>
|
||||
array (
|
||||
'name' => 'Public Logs',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'public_request_chart' =>
|
||||
array (
|
||||
'name' => 'Public Statistik',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'backend_request_logs' =>
|
||||
array (
|
||||
'name' => 'Backend Logs',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'backend_request_chart' =>
|
||||
array (
|
||||
'name' => 'Backend Statistik',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'personal_request_logs' =>
|
||||
array (
|
||||
'name' => 'Persönliche Logs',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'services_control' =>
|
||||
array (
|
||||
'name' => 'Seitenverwaltung',
|
||||
'active' => true,
|
||||
'adminOnly' => true,
|
||||
),
|
||||
'berichte_arbeit' =>
|
||||
array (
|
||||
'name' => 'Arbeitsberichte',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'berichte_arbeit_gen' =>
|
||||
array (
|
||||
'name' => 'Arbeitsberichte PDF',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'user_control' =>
|
||||
array (
|
||||
'name' => 'Benutzerverwaltung',
|
||||
'active' => true,
|
||||
'adminOnly' => false,
|
||||
),
|
||||
'test' =>
|
||||
array (
|
||||
'name' => 'Test Seite',
|
||||
'active' => true,
|
||||
'adminOnly' => true,
|
||||
),
|
||||
);
|
||||
|
||||
$linkGroups = array (
|
||||
'info' =>
|
||||
array (
|
||||
'label' => 'Informationen',
|
||||
'color' => '#3498db',
|
||||
'defaultOpen' => false,
|
||||
),
|
||||
'tools' =>
|
||||
array (
|
||||
'label' => 'IoT',
|
||||
'color' => '#2ecc71',
|
||||
'defaultOpen' => false,
|
||||
),
|
||||
'admin' =>
|
||||
array (
|
||||
'label' => 'Administration',
|
||||
'color' => '#e74c3c',
|
||||
'defaultOpen' => false,
|
||||
),
|
||||
'devices' =>
|
||||
array (
|
||||
'label' => 'Geräte',
|
||||
'color' => '#b7db33',
|
||||
'defaultOpen' => false,
|
||||
),
|
||||
);
|
||||
|
||||
$linkButtons = array (
|
||||
0 =>
|
||||
array (
|
||||
'label' => 'Gitea',
|
||||
'url' => 'http://gitea.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'admin',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'label' => 'HAProxy',
|
||||
'url' => 'http://stats.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'admin',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'label' => 'Public',
|
||||
'url' => 'https://blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'info',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'label' => 'NAS-1',
|
||||
'url' => 'http://nas-1.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'devices',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'label' => 'NAS-2',
|
||||
'url' => 'http://nas-2.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'devices',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'label' => 'FritzBox-1',
|
||||
'url' => 'http://fritzbox-1.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'devices',
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'label' => 'FritzBox-2',
|
||||
'url' => 'http://fritzbox-2.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'devices',
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'label' => 'GS1910-24',
|
||||
'url' => 'http://switch.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'admin',
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'label' => 'NWA5121-NI Innen',
|
||||
'url' => 'http://ap-1.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'devices',
|
||||
),
|
||||
9 =>
|
||||
array (
|
||||
'label' => 'NWA5121-NI Aussen',
|
||||
'url' => 'http://ap-2.blackpi.ipv64.net',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'devices',
|
||||
),
|
||||
10 =>
|
||||
array (
|
||||
'label' => 'ZyWALL 110',
|
||||
'url' => 'http://10.233.1248',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'admin',
|
||||
),
|
||||
11 =>
|
||||
array (
|
||||
'label' => 'Ender 3 V3 KE',
|
||||
'url' => 'http://10.233.1.52',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'tools',
|
||||
),
|
||||
12 =>
|
||||
array (
|
||||
'label' => 'Ubuntu NAS',
|
||||
'url' => 'http://10.233.1.32:9000',
|
||||
'newTab' => true,
|
||||
'adminOnly' => false,
|
||||
'group' => 'tools',
|
||||
),
|
||||
);
|
||||
@@ -43,6 +43,16 @@ if (!$useCustom) {
|
||||
";
|
||||
}
|
||||
|
||||
if (isset($_POST['delete_logs'])) {
|
||||
DatabaseDelete(
|
||||
"logs",
|
||||
"CLIENT_IP = ?",
|
||||
(new getSpecificData())->getClientIP()
|
||||
);
|
||||
header("Location: " . (new getSpecificData())->getReferer());
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h1>📊 Logs</h1>
|
||||
@@ -62,6 +72,11 @@ if ($erg = $conn->query($sql)) {
|
||||
<?php else: ?>
|
||||
|
||||
<div style="overflow-x:auto;">
|
||||
<?php if ((new getSpecificData())->getIsAdmin()): ?>
|
||||
<form method="post">
|
||||
<button name="delete_logs" class="btn-delete" style="margin-bottom: 10px">Lösche Logs</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse;width:100%;">
|
||||
<tr>
|
||||
<?php foreach ($daten[0] as $key => $_): ?>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
if (isset($_POST['toggle_variable'])) {
|
||||
|
||||
$name = $_POST['variablenname'];
|
||||
|
||||
$current = (new getSpecificData())->getLoggingStatus($name)[0]['WERT'];
|
||||
$newValue = ($current === "ON") ? "OFF" : "ON";
|
||||
|
||||
DatabaseUpdate(
|
||||
"Variablen",
|
||||
"WERT = ?",
|
||||
"VARIABLENNAME = ?",
|
||||
$newValue,
|
||||
$name
|
||||
);
|
||||
header("Location: " . (new getSpecificData())->getReferer());
|
||||
exit;
|
||||
}
|
||||
|
||||
$variablen = DatabaseShow(
|
||||
"Variablen",
|
||||
"VARIABLENNAME, WERT, ANZEIGENAME"
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<div class="admin-grid">
|
||||
|
||||
<?php foreach ($variablen as $var): ?>
|
||||
<div class="admin-card toggle-card">
|
||||
|
||||
<div class="toggle-header">
|
||||
<strong><?= htmlspecialchars($var['ANZEIGENAME']) ?></strong>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<input type="hidden" name="variablenname" value="<?= htmlspecialchars($var['VARIABLENNAME']) ?>">
|
||||
|
||||
<button type="submit" name="toggle_variable"
|
||||
class="toggle-switch <?= $var['WERT'] === 'ON' ? 'active' : '' ?>">
|
||||
<span class="toggle-slider"></span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="toggle-status">
|
||||
Status:
|
||||
<span class="badge">
|
||||
<?= htmlspecialchars($var['WERT']) ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
@@ -844,4 +844,59 @@ body.dark-mode .user-table .btn-primary:hover {
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
/* ===== Toggle Switch ===== */
|
||||
|
||||
.toggle-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.toggle-header {
|
||||
font-size: 1rem;
|
||||
text-align: center;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.toggle-switch {
|
||||
width: 60px;
|
||||
height: 32px;
|
||||
background: #ccc;
|
||||
border-radius: 50px;
|
||||
position: relative;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.toggle-switch.active {
|
||||
background: #28a745;
|
||||
}
|
||||
|
||||
.toggle-slider {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
background: white;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 4px;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.toggle-switch.active .toggle-slider {
|
||||
transform: translateX(28px);
|
||||
}
|
||||
|
||||
/* Dark Mode Anpassung */
|
||||
body.dark-mode .toggle-switch {
|
||||
background: #444;
|
||||
}
|
||||
|
||||
body.dark-mode .toggle-switch.active {
|
||||
background: #28a745;
|
||||
}
|
||||
Reference in new issue
Block a user