|
@@ -1,12 +1,23 @@
|
|
|
<?php
|
|
<?php
|
|
|
/**
|
|
/**
|
|
|
- * Settings: online admin password change (rewrites config/credentials.php).
|
|
|
|
|
|
|
+ * Settings: admin password change plus the legal pages (Impressum /
|
|
|
|
|
+ * Datenschutz), which are stored as basic Markdown in data/site.json.
|
|
|
*/
|
|
*/
|
|
|
require dirname(__DIR__) . '/app/bootstrap.php';
|
|
require dirname(__DIR__) . '/app/bootstrap.php';
|
|
|
auth_require();
|
|
auth_require();
|
|
|
|
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
csrf_verify();
|
|
csrf_verify();
|
|
|
|
|
+
|
|
|
|
|
+ if (($_POST['section'] ?? '') === 'legal') {
|
|
|
|
|
+ $site = site_get();
|
|
|
|
|
+ $site['impressum'] = trim((string)($_POST['impressum'] ?? ''));
|
|
|
|
|
+ $site['datenschutz'] = trim((string)($_POST['datenschutz'] ?? ''));
|
|
|
|
|
+ site_save($site);
|
|
|
|
|
+ flash_set('Legal pages saved.');
|
|
|
|
|
+ redirect('settings.php');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$new = (string)($_POST['new_password'] ?? '');
|
|
$new = (string)($_POST['new_password'] ?? '');
|
|
|
if ($new !== (string)($_POST['new_password2'] ?? '')) {
|
|
if ($new !== (string)($_POST['new_password2'] ?? '')) {
|
|
|
flash_set('New passwords do not match.', 'error');
|
|
flash_set('New passwords do not match.', 'error');
|
|
@@ -17,10 +28,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
redirect('settings.php');
|
|
redirect('settings.php');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+$site = site_get();
|
|
|
|
|
+
|
|
|
admin_header('Settings', 'settings');
|
|
admin_header('Settings', 'settings');
|
|
|
flash_render();
|
|
flash_render();
|
|
|
?>
|
|
?>
|
|
|
<h1>Settings</h1>
|
|
<h1>Settings</h1>
|
|
|
|
|
+
|
|
|
<form method="post" class="card" style="max-width:26rem">
|
|
<form method="post" class="card" style="max-width:26rem">
|
|
|
<?= csrf_field() ?>
|
|
<?= csrf_field() ?>
|
|
|
<h2 style="margin-top:0">Change password</h2>
|
|
<h2 style="margin-top:0">Change password</h2>
|
|
@@ -33,6 +47,25 @@ flash_render();
|
|
|
<p class="help">At least 8 characters. Written to config/credentials.php.</p>
|
|
<p class="help">At least 8 characters. Written to config/credentials.php.</p>
|
|
|
<button type="submit">Change password</button>
|
|
<button type="submit">Change password</button>
|
|
|
</form>
|
|
</form>
|
|
|
|
|
+
|
|
|
|
|
+<form method="post" class="card">
|
|
|
|
|
+ <?= csrf_field() ?>
|
|
|
|
|
+ <input type="hidden" name="section" value="legal">
|
|
|
|
|
+ <h2 style="margin-top:0">Legal pages</h2>
|
|
|
|
|
+ <p class="help" style="margin-top:0">
|
|
|
|
|
+ Basic Markdown is supported: <code># Heading</code>, <code>- list item</code>,
|
|
|
|
|
+ <code>**bold**</code>, <code>*italic*</code>, <code>[text](https://…)</code>.
|
|
|
|
|
+ </p>
|
|
|
|
|
+
|
|
|
|
|
+ <label for="imp">Impressum <a href="../impressum.php" target="_blank" rel="noopener">view ↗</a></label>
|
|
|
|
|
+ <textarea id="imp" name="impressum" style="min-height:14rem"><?= e($site['impressum'] ?? '') ?></textarea>
|
|
|
|
|
+
|
|
|
|
|
+ <label for="dsg">Datenschutz <a href="../datenschutz.php" target="_blank" rel="noopener">view ↗</a></label>
|
|
|
|
|
+ <textarea id="dsg" name="datenschutz" style="min-height:14rem"><?= e($site['datenschutz'] ?? '') ?></textarea>
|
|
|
|
|
+
|
|
|
|
|
+ <button type="submit">Save legal pages</button>
|
|
|
|
|
+</form>
|
|
|
|
|
+
|
|
|
<p class="help">
|
|
<p class="help">
|
|
|
Username and S3 settings are edited directly in the files under <code>config/</code>.
|
|
Username and S3 settings are edited directly in the files under <code>config/</code>.
|
|
|
</p>
|
|
</p>
|