sync.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php declare(strict_types=1); ?>
  2. <p>
  3. <?= sprintf(_('AAAA, A and CAA records are regularly copied from the source domain to the target domain. Their TTLs are set to %s seconds.'), NS_SYNC_TTL) ?>
  4. </p>
  5. <p>
  6. <?= _('Source domains that are not signed with DNSSEC are not synchronized. Synchronizations that remain broken may be deleted.') ?>
  7. </p>
  8. <p>
  9. <?= _('This is meant to be used for apex domains, where CNAME records are not allowed. For non-apex domains, CNAME records should be used instead.') ?>
  10. </p>
  11. <form method="post">
  12. <?php
  13. foreach (array_slice(array_merge(query('select', 'ns-syncs', ['username' => $_SESSION['id'] ?? '']), [['source' => '', 'destination' => '—']]), 0, 8) as $i => $sync) {
  14. ?>
  15. <fieldset>
  16. <legend><?= ($sync['source'] === '') ? _('Add new domain records to be synchronized') : _('Synchronized domain') ?></legend>
  17. <div>
  18. <label for="source<?= $i ?>"><?= _('Source domain') ?></label><br>
  19. <input placeholder="provider.<?= PLACEHOLDER_DOMAIN ?>." id="source<?= $i ?>" name="syncs[<?= $i ?>][source]" value="<?= $sync['source'] ?>" type="text">
  20. </div>
  21. <div>
  22. <label for="destination<?= $i ?>"><?= _('Target domain') ?></label>
  23. <br>
  24. <select required="" name="syncs[<?= $i ?>][destination]" id="destination<?= $i ?>">
  25. <option <?= (($sync['destination'] === '') ? 'value="" disabled=""' : 'value="' . $sync['destination'] . '"') ?> selected=""><?= $sync['destination'] ?></option>
  26. <?php
  27. foreach (array_diff(nsListUserZones(), query('select', 'ns-syncs', ['username' => $_SESSION['id'] ?? ''], ['destination'])) as $zone)
  28. echo "<option value='" . $zone . "'>" . $zone . "</option>";
  29. ?>
  30. </select>
  31. </div>
  32. </fieldset>
  33. <?php
  34. }
  35. ?>
  36. <input type="submit" value="<?= _('Update') ?>">
  37. </form>