list_dns.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <!-- Begin toolbar -->
  2. <div class="toolbar">
  3. <div class="toolbar-inner">
  4. <div class="toolbar-buttons">
  5. <?php if ($read_only !== "true") { ?>
  6. <a href="/add/dns/" class="button button-secondary js-button-create">
  7. <i class="fas fa-circle-plus icon-green"></i><?= tohtml( _("Add DNS Domain")) ?>
  8. </a>
  9. <?php } ?>
  10. </div>
  11. <div class="toolbar-right">
  12. <div class="toolbar-sorting">
  13. <button class="toolbar-sorting-toggle js-toggle-sorting-menu" type="button" title="<?= tohtml( _("Sort items")) ?>">
  14. <?= tohtml( _("Sort by")) ?>:
  15. <span class="u-text-bold">
  16. <?php if ($_SESSION['userSortOrder'] === 'name') { $label = _('Name'); } else { $label = _('Date'); } ?>
  17. <?= tohtml($label) ?> <i class="fas fa-arrow-down-a-z"></i>
  18. </span>
  19. </button>
  20. <ul class="toolbar-sorting-menu js-sorting-menu u-hidden">
  21. <li data-entity="sort-date" data-sort-as-int="1">
  22. <span class="name <?php if ($_SESSION['userSortOrder'] === 'date') { echo 'active'; } ?>"><?= tohtml( _("Date")) ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  23. </li>
  24. <li data-entity="sort-expire" data-sort-as-int="1">
  25. <span class="name"><?= tohtml( _("Expire")) ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  26. </li>
  27. <li data-entity="sort-ip">
  28. <span class="name"><?= tohtml( _("IP Address")) ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  29. </li>
  30. <li data-entity="sort-name">
  31. <span class="name <?php if ($_SESSION['userSortOrder'] === 'name') { echo 'active'; } ?>"><?= tohtml( _("Name")) ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  32. </li>
  33. <li data-entity="sort-records">
  34. <span class="name"><?= tohtml( _("Records")) ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  35. </li>
  36. </ul>
  37. <?php if ($read_only !== "true") { ?>
  38. <form x-data x-bind="BulkEdit" action="/bulk/dns/" method="post">
  39. <input type="hidden" name="token" value="<?= tohtml($_SESSION["token"]) ?>">
  40. <select class="form-select" name="action">
  41. <option value=""><?= tohtml( _("Apply to selected")) ?></option>
  42. <?php if ($_SESSION["userContext"] === "admin") { ?>
  43. <option value="rebuild"><?= tohtml( _("Rebuild")) ?></option>
  44. <?php } ?>
  45. <option value="suspend"><?= tohtml( _("Suspend")) ?></option>
  46. <option value="unsuspend"><?= tohtml( _("Unsuspend")) ?></option>
  47. <option value="delete"><?= tohtml( _("Delete")) ?></option>
  48. </select>
  49. <button type="submit" class="toolbar-input-submit" title="<?= tohtml( _("Apply to selected")) ?>">
  50. <i class="fas fa-arrow-right"></i>
  51. </button>
  52. </form>
  53. <?php } ?>
  54. </div>
  55. <div class="toolbar-search">
  56. <form action="/search/" method="get">
  57. <input type="hidden" name="token" value="<?= tohtml($_SESSION["token"]) ?>">
  58. <input type="search" class="form-control js-search-input" name="q" value="<?= tohtml($_GET['q'] ?? '') ?>" title="<?= tohtml( _("Search")) ?>">
  59. <button type="submit" class="toolbar-input-submit" title="<?= tohtml( _("Search")) ?>">
  60. <i class="fas fa-magnifying-glass"></i>
  61. </button>
  62. </form>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <!-- End toolbar -->
  68. <div class="container">
  69. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= tohtml( _("DNS Records")) ?></h1>
  70. <div class="units-table js-units-container">
  71. <div class="units-table-header">
  72. <div class="units-table-cell">
  73. <input type="checkbox" class="js-toggle-all-checkbox" title="<?= tohtml( _("Select all")) ?>" <?= tohtml($display_mode) ?>>
  74. </div>
  75. <div class="units-table-cell"><?= tohtml( _("Name")) ?></div>
  76. <div class="units-table-cell"></div>
  77. <div class="units-table-cell u-text-center"><?= tohtml( _("Records")) ?></div>
  78. <div class="units-table-cell u-text-center"><?= tohtml( _("Template")) ?></div>
  79. <div class="units-table-cell u-text-center"><?= tohtml( _("TTL")) ?></div>
  80. <div class="units-table-cell u-text-center"><?= tohtml( _("SOA")) ?></div>
  81. <div class="units-table-cell u-text-center"><?= tohtml( _("DNSSEC")) ?></div>
  82. <div class="units-table-cell u-text-center"><?= tohtml( _("Expiration Date")) ?></div>
  83. </div>
  84. <!-- Begin DNS zone list item loop -->
  85. <?php
  86. foreach ($data as $key => $value) {
  87. ++$i;
  88. if ($data[$key]['SUSPENDED'] == 'yes') {
  89. $status = 'suspended';
  90. $spnd_action = 'unsuspend';
  91. $spnd_action_title = _('Unsuspend');
  92. $spnd_icon = 'fa-play';
  93. $spnd_icon_class = 'icon-green';
  94. $spnd_confirmation = _('Are you sure you want to unsuspend domain %s?');
  95. if ($data[$key]['DNSSEC'] !== 'yes') {
  96. $dnssec_icon = 'fa-circle-xmark';
  97. $dnssec_title = _('Disabled');
  98. } else {
  99. $dnssec_icon = 'fa-circle-check';
  100. $dnssec_title = _('Enabled');
  101. }
  102. } else {
  103. $status = 'active';
  104. $spnd_action = 'suspend';
  105. $spnd_action_title = _('Suspend');
  106. $spnd_icon = 'fa-pause';
  107. $spnd_icon_class = 'icon-highlight';
  108. $spnd_confirmation = _('Are you sure you want to suspend domain %s?');
  109. if ($data[$key]['DNSSEC'] !== 'yes') {
  110. $dnssec_icon = 'fa-circle-xmark icon-red';
  111. $dnssec_title = _('Disabled');
  112. } else {
  113. $dnssec_icon = 'fa-circle-check icon-green';
  114. $dnssec_title = _('Enabled');
  115. }
  116. }
  117. ?>
  118. <div class="units-table-row <?php if ($status == 'suspended') echo 'disabled'; ?> js-unit"
  119. data-sort-ip="<?= tohtml(str_replace('.', '', $data[$key]['IP'])) ?>"
  120. data-sort-date="<?= tohtml(strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])) ?>"
  121. data-sort-name="<?= tohtml($key) ?>"
  122. data-sort-expire="<?= tohtml(strtotime($data[$key]['EXP'])) ?>"
  123. data-sort-records="<?= tohtml((int)$data[$key]['RECORDS']) ?>">
  124. <div class="units-table-cell">
  125. <div>
  126. <input id="check<?= tohtml($i) ?>" class="js-unit-checkbox" type="checkbox" title="<?= tohtml( _("Select")) ?>" name="domain[]" value="<?= tohtml($key) ?>" <?= tohtml($display_mode) ?>>
  127. <label for="check<?= tohtml($i) ?>" class="u-hide-desktop"><?= tohtml( _("Select")) ?></label>
  128. </div>
  129. </div>
  130. <div class="units-table-cell units-table-heading-cell u-text-bold">
  131. <span class="u-hide-desktop"><?= tohtml( _("Name")) ?>:</span>
  132. <a href="/list/dns/?<?= tohtml(http_build_query(array("domain" => $key, "token" => $_SESSION["token"]))) ?>" title="<?= tohtml( _("DNS Records")) ?>: <?= tohtml($key) ?>">
  133. <?= tohtml($key) ?>
  134. </a>
  135. <?= empty($data[$key]["SRC"]) ? "" : '<br>⇢ <span class="u-text-small">' . tohtml($data[$key]["SRC"]) . "</span>" ?>
  136. </div>
  137. <div class="units-table-cell">
  138. <?php if (!$read_only) { ?>
  139. <ul class="units-table-row-actions">
  140. <?php if ($data[$key]["SUSPENDED"] == "no") { ?>
  141. <li class="units-table-row-action shortcut-n" data-key-action="href">
  142. <a
  143. class="units-table-row-action-link"
  144. href="/add/dns/?<?= tohtml(http_build_query(array("domain" => $key, "token" => $_SESSION["token"]))) ?>"
  145. title="<?= tohtml( _("Add DNS Record")) ?>"
  146. >
  147. <i class="fas fa-circle-plus icon-green"></i>
  148. <span class="u-hide-desktop"><?= tohtml( _("Add DNS Record")) ?></span>
  149. </a>
  150. </li>
  151. <li class="units-table-row-action shortcut-enter" data-key-action="href">
  152. <a
  153. class="units-table-row-action-link"
  154. href="/edit/dns/?<?= tohtml(http_build_query(array("domain" => $key, "token" => $_SESSION["token"]))) ?>"
  155. title="<?= tohtml( _("Edit DNS Domain")) ?>"
  156. >
  157. <i class="fas fa-pencil icon-orange"></i>
  158. <span class="u-hide-desktop"><?= tohtml( _("Edit DNS Domain")) ?></span>
  159. </a>
  160. </li>
  161. <?php if ($data[$key]["DNSSEC"] == "yes") { ?>
  162. <li class="units-table-row-action shortcut-enter" data-key-action="href">
  163. <a
  164. class="units-table-row-action-link"
  165. href="/list/dns/?<?= tohtml(http_build_query(array("domain" => $key, "action" => "dnssec", "token" => $_SESSION["token"]))) ?>"
  166. title="<?= tohtml( _("View Public DNSSEC Key")) ?>"
  167. >
  168. <i class="fas fa-key icon-orange"></i>
  169. <span class="u-hide-desktop"><?= tohtml( _("View Public DNSSEC Key")) ?></span>
  170. </a>
  171. </li>
  172. <?php } ?>
  173. <?php } ?>
  174. <li class="units-table-row-action shortcut-l" data-key-action="href">
  175. <a
  176. class="units-table-row-action-link"
  177. href="/list/dns/?<?= tohtml(http_build_query(array("domain" => $key, "token" => $_SESSION["token"]))) ?>"
  178. title="<?= tohtml( _("DNS Records")) ?>"
  179. >
  180. <i class="fas fa-list icon-lightblue"></i>
  181. <span class="u-hide-desktop"><?= tohtml( _("DNS Records")) ?></span>
  182. </a>
  183. </li>
  184. <li class="units-table-row-action shortcut-s" data-key-action="js">
  185. <a
  186. class="units-table-row-action-link data-controls js-confirm-action"
  187. href="/<?= tohtml($spnd_action) ?>/dns/?<?= tohtml(http_build_query(array("domain" => $key, "token" => $_SESSION["token"]))) ?>"
  188. title="<?= tohtml($spnd_action_title) ?>"
  189. data-confirm-title="<?= tohtml($spnd_action_title) ?>"
  190. data-confirm-message="<?= tohtml(sprintf($spnd_confirmation, $key)) ?>"
  191. >
  192. <i class="fas <?= tohtml($spnd_icon) ?> <?= tohtml($spnd_icon_class) ?>"></i>
  193. <span class="u-hide-desktop"><?= tohtml($spnd_action_title) ?></span>
  194. </a>
  195. </li>
  196. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  197. <a
  198. class="units-table-row-action-link data-controls js-confirm-action"
  199. href="/delete/dns/?<?= tohtml(http_build_query(array("domain" => $key, "token" => $_SESSION["token"]))) ?>"
  200. title="<?= tohtml( _("Delete")) ?>"
  201. data-confirm-title="<?= tohtml( _("Delete")) ?>"
  202. data-confirm-message="<?= tohtml(sprintf(_("Are you sure you want to delete domain %s?"), $key)) ?>"
  203. >
  204. <i class="fas fa-trash icon-red"></i>
  205. <span class="u-hide-desktop"><?= tohtml( _("Delete")) ?></span>
  206. </a>
  207. </li>
  208. </ul>
  209. <?php } ?>
  210. </div>
  211. <div class="units-table-cell u-text-center-desktop">
  212. <span class="u-hide-desktop u-text-bold"><?= tohtml( _("Records")) ?>:</span>
  213. <?php if ($data[$key]['RECORDS']) {
  214. echo '<span>'.$data[$key]['RECORDS'].'</span>';
  215. } else {
  216. echo '<span>0</span>';
  217. } ?>
  218. </div>
  219. <div class="units-table-cell u-text-center-desktop">
  220. <span class="u-hide-desktop u-text-bold"><?= tohtml( _("Template")) ?>:</span>
  221. <span class="u-text-bold">
  222. <?= tohtml($data[$key]["TPL"]) ?>
  223. </span>
  224. </div>
  225. <div class="units-table-cell u-text-center-desktop">
  226. <span class="u-hide-desktop u-text-bold"><?= tohtml( _("TTL")) ?>:</span>
  227. <?= tohtml($data[$key]["TTL"]) ?>
  228. </div>
  229. <div class="units-table-cell u-text-center-desktop">
  230. <span class="u-hide-desktop u-text-bold"><?= tohtml( _("SOA")) ?>:</span>
  231. <?= tohtml($data[$key]["SOA"]) ?>
  232. </div>
  233. <div class="units-table-cell u-text-center-desktop">
  234. <span class="u-hide-desktop u-text-bold"><?= tohtml( _("DNSSEC")) ?>:</span>
  235. <i class="fas <?= tohtml($dnssec_icon) ?>" title="<?= tohtml($dnssec_title) ?>"></i>
  236. </div>
  237. <div class="units-table-cell u-text-center-desktop">
  238. <span class="u-hide-desktop u-text-bold"><?= tohtml( _("Expiration Date")) ?>:</span>
  239. <time class="u-text-bold" datetime="<?= tohtml($data[$key]["EXP"]) ?>">
  240. <?= tohtml($data[$key]["EXP"]) ?>
  241. </time>
  242. </div>
  243. </div>
  244. <?php } ?>
  245. </div>
  246. <div class="units-table-footer">
  247. <p>
  248. <?php printf(ngettext("%d DNS zone", "%d DNS zones", $i), $i); ?>
  249. </p>
  250. </div>
  251. </div>