| Server IP : 193.86.120.172 / Your IP : 216.73.216.215 Web Server : Apache/2.4.63 (Unix) System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64 User : kubec ( 1026) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /volume1/web/hotellesnizatisi_cz/new/ |
Upload File : |
<?php
require_once __DIR__ . '/includes/auth.php';
$user = require_section('obsah');
require_once __DIR__ . '/includes/layout.php';
$id = (int)($_GET['id'] ?? 0);
$stmt = db()->prepare('SELECT * FROM web_sekce WHERE id = ?');
$stmt->execute([$id]);
$s = $stmt->fetch();
if (!$s) {
set_flash('error', 'Sekce nebyla nalezena.');
header('Location: obsah.php');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$stmt = db()->prepare('
UPDATE web_sekce SET
nadpis_cs = ?, text_cs = ?,
nadpis_en = ?, text_en = ?,
nadpis_de = ?, text_de = ?,
poradi = ?, aktivni = ?,
upraveno_kym = ?, upraveno_kdy = NOW()
WHERE id = ?
');
$stmt->execute([
trim($_POST['nadpis_cs'] ?? ''),
trim($_POST['text_cs'] ?? ''),
trim($_POST['nadpis_en'] ?? ''),
trim($_POST['text_en'] ?? ''),
trim($_POST['nadpis_de'] ?? ''),
trim($_POST['text_de'] ?? ''),
(int)($_POST['poradi'] ?? 0),
isset($_POST['aktivni']) ? 1 : 0,
$user['id'],
$id,
]);
set_flash('success', 'Sekce „' . $s['klic'] . '“ byla uložena.');
header('Location: obsah.php');
exit;
}
admin_layout_start('obsah', 'Upravit sekci: ' . $s['klic'], '', $user);
?>
<form method="post" class="card" style="padding:26px 28px;max-width:680px;">
<h3 style="font-size:.9rem;margin-bottom:14px;">Čeština</h3>
<div class="field">
<label for="nadpis_cs">Nadpis</label>
<input type="text" id="nadpis_cs" name="nadpis_cs" value="<?= htmlspecialchars($s['nadpis_cs'] ?? '') ?>">
</div>
<div class="field">
<label for="text_cs">Text</label>
<textarea id="text_cs" name="text_cs"><?= htmlspecialchars($s['text_cs'] ?? '') ?></textarea>
</div>
<h3 style="font-size:.9rem;margin:24px 0 14px;border-top:1px solid var(--border);padding-top:20px;">English</h3>
<div class="field">
<label for="nadpis_en">Nadpis</label>
<input type="text" id="nadpis_en" name="nadpis_en" value="<?= htmlspecialchars($s['nadpis_en'] ?? '') ?>">
</div>
<div class="field">
<label for="text_en">Text</label>
<textarea id="text_en" name="text_en"><?= htmlspecialchars($s['text_en'] ?? '') ?></textarea>
</div>
<h3 style="font-size:.9rem;margin:24px 0 14px;border-top:1px solid var(--border);padding-top:20px;">Deutsch</h3>
<div class="field">
<label for="nadpis_de">Nadpis</label>
<input type="text" id="nadpis_de" name="nadpis_de" value="<?= htmlspecialchars($s['nadpis_de'] ?? '') ?>">
</div>
<div class="field">
<label for="text_de">Text</label>
<textarea id="text_de" name="text_de"><?= htmlspecialchars($s['text_de'] ?? '') ?></textarea>
</div>
<div class="field" style="margin-top:24px;border-top:1px solid var(--border);padding-top:20px;max-width:140px;">
<label for="poradi">Pořadí</label>
<input type="number" id="poradi" name="poradi" value="<?= (int)$s['poradi'] ?>">
</div>
<div class="toggle-row">
<label for="aktivni">Zobrazit na webu</label>
<input type="checkbox" id="aktivni" name="aktivni" <?= $s['aktivni'] ? 'checked' : '' ?>>
<label class="switch" for="aktivni"></label>
</div>
<div style="display:flex;gap:10px;margin-top:26px;">
<button type="submit" class="btn btn-primary">Uložit</button>
<a href="obsah.php" class="btn btn-secondary">Zrušit</a>
</div>
</form>
<?php admin_layout_end(); ?>