| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /**
- * Contact page editor: heading, intro text and contact methods shown on the
- * public contact.php page.
- */
- require dirname(__DIR__) . '/app/bootstrap.php';
- auth_require();
- $site = site_get();
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- csrf_verify();
- $site['contact_title'] = trim((string)($_POST['contact_title'] ?? ''));
- $site['contact_text'] = trim((string)($_POST['contact_text'] ?? ''));
- $site['contact_email'] = trim((string)($_POST['contact_email'] ?? ''));
- $site['contact_phone'] = trim((string)($_POST['contact_phone'] ?? ''));
- $site['contact_instagram'] = trim((string)($_POST['contact_instagram'] ?? ''));
- site_save($site);
- flash_set('Contact page saved.');
- redirect('contact.php');
- }
- admin_header('Contact', 'contact');
- flash_render();
- ?>
- <h1>Contact page</h1>
- <form method="post" class="card">
- <?= csrf_field() ?>
- <label for="ct">Heading</label>
- <input type="text" id="ct" name="contact_title" value="<?= e($site['contact_title'] ?? '') ?>">
- <label for="cx">Intro text</label>
- <textarea id="cx" name="contact_text"><?= e($site['contact_text'] ?? '') ?></textarea>
- <p class="help">Shown below the heading. Line breaks are kept.</p>
- <label for="ce">Email</label>
- <input type="text" id="ce" name="contact_email" value="<?= e($site['contact_email'] ?? '') ?>" placeholder="hello@example.com">
- <label for="cp">Phone</label>
- <input type="text" id="cp" name="contact_phone" value="<?= e($site['contact_phone'] ?? '') ?>" placeholder="+49 30 1234567">
- <label for="ci">Instagram</label>
- <input type="text" id="ci" name="contact_instagram" value="<?= e($site['contact_instagram'] ?? '') ?>" placeholder="@handle or full URL">
- <p class="help">Leave a field empty to hide it on the contact page.</p>
- <button type="submit">Save</button>
- <a class="btn btn-ghost" href="../contact.php" target="_blank" rel="noopener" style="margin-left:.6rem">View page ↗</a>
- </form>
- <?php admin_footer(); ?>
|