index.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. require_once __DIR__ . '/../include/utils.php';
  3. render_page_header(get_string('settings.title'));
  4. ?>
  5. <div class="container container-small">
  6. <h1 class="center"><?= get_string('settings.title') ?></h1>
  7. <?php if (SSFW_ONLY || SFW_ONLY) { ?>
  8. <div class="notice">
  9. <p><?= get_string(SSFW_ONLY ? 'settings.ssfw-notice' : 'settings.sfw-notice') ?></p>
  10. </div>
  11. <?php } ?>
  12. <form method="post" action="save.php" class="options">
  13. <input type="hidden" name="from"
  14. value="<?= isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : (BASE_URL . '/') ?>"
  15. ><?php
  16. foreach ($settings_entries as $entry) switch ($entry['type']) {
  17. case 'checkbox': ?>
  18. <div>
  19. <label for="<?= $entry['id'] ?>"><?= get_string('settings.' . $entry['id']) ?></label>
  20. <input type="hidden" value="off" name="<?= $entry['id'] ?>">
  21. <input type="checkbox" class="switch" autocomplete="off"
  22. name="<?= $entry['id'] ?>" id="<?= $entry['id'] ?>"
  23. <?php if ($settings[$entry['id']] == 'on') echo 'checked'; ?>
  24. >
  25. </div><?php
  26. break;
  27. case 'dropdown': ?>
  28. <div>
  29. <label><?= get_string('settings.' . $entry['id']) ?></label>
  30. <select name="<?= $entry['id'] ?>" autocomplete="off">
  31. <?php foreach ($entry['options'] as $option) { ?>
  32. <option value="<?= $option ?>"
  33. <?php if ($settings[$entry['id']] == $option) echo 'selected' ?>
  34. ><?= get_string('settings.' . $option) ?: $option ?></option>
  35. <?php } ?>
  36. </select>
  37. </div><?php
  38. break;
  39. }
  40. ?>
  41. <p class="center">
  42. <button type="submit"><?= get_string('settings.save') ?></button>
  43. </p>
  44. </form>
  45. </div>
  46. <?php
  47. render_page_footer();