list_mail.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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/mail/" class="button button-secondary js-button-create">
  7. <i class="fas fa-circle-plus icon-green"></i><?= _("Add Mail 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="<?= _("Sort items") ?>">
  14. <?= _("Sort by") ?>:
  15. <span class="u-text-bold">
  16. <?php if ($_SESSION['userSortOrder'] === 'name') { $label = _('Name'); } else { $label = _('Date'); } ?>
  17. <?= $label ?> <i class="fas fa-arrow-down-a-z"></i>
  18. </span>
  19. </button>
  20. <ul class="toolbar-sorting-menu animate__animated animate__fadeIn js-sorting-menu u-hidden">
  21. <li data-entity="sort-accounts" data-sort-as-int="1">
  22. <span class="name"><?= _("Accounts") ?> <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-date" data-sort-as-int="1">
  25. <span class="name <?php if ($_SESSION['userSortOrder'] === 'date') { echo 'active'; } ?>"><?= _("Date") ?> <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-disk" data-sort-as-int="1">
  28. <span class="name"><?= _("Disk") ?> <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'; } ?>"><?= _("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. </ul>
  34. <?php if ($read_only !== "true") { ?>
  35. <form x-data x-bind="BulkEdit" action="/bulk/mail/" method="post">
  36. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  37. <select class="form-select" name="action">
  38. <option value=""><?= _("Apply to selected") ?></option>
  39. <?php if ($_SESSION["userContext"] === "admin") { ?>
  40. <option value="rebuild"><?= _("Rebuild All") ?></option>
  41. <?php } ?>
  42. <option value="suspend"><?= _("Suspend") ?></option>
  43. <option value="unsuspend"><?= _("Unsuspend") ?></option>
  44. <option value="delete"><?= _("Delete") ?></option>
  45. </select>
  46. <button type="submit" class="toolbar-input-submit" title="<?= _("Apply to selected") ?>">
  47. <i class="fas fa-arrow-right"></i>
  48. </button>
  49. </form>
  50. <?php } ?>
  51. </div>
  52. <div class="toolbar-search">
  53. <form action="/search/" method="get">
  54. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  55. <input type="search" class="form-control js-search-input" name="q" value="<? echo isset($_POST['q']) ? htmlspecialchars($_POST['q']) : '' ?>" title="<?= _("Search") ?>">
  56. <button type="submit" class="toolbar-input-submit" title="<?= _("Search") ?>">
  57. <i class="fas fa-magnifying-glass"></i>
  58. </button>
  59. </form>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <!-- End toolbar -->
  65. <div class="container">
  66. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= _("Mail Domains") ?></h1>
  67. <div class="units-table js-units-container">
  68. <div class="units-table-header">
  69. <div class="units-table-cell">
  70. <input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
  71. </div>
  72. <div class="units-table-cell"><?= _("Name") ?></div>
  73. <div class="units-table-cell"></div>
  74. <div class="units-table-cell u-text-center"><?= _("Accounts") ?></div>
  75. <div class="units-table-cell u-text-center"><?= _("Disk") ?></div>
  76. <div class="units-table-cell u-text-center"><?= _("Anti-Virus") ?></div>
  77. <div class="units-table-cell u-text-center"><?= _("Spam Filter") ?></div>
  78. <div class="units-table-cell u-text-center"><?= _("DKIM") ?></div>
  79. <div class="units-table-cell u-text-center"><?= _("SSL") ?></div>
  80. </div>
  81. <!-- Begin mail domain list item loop -->
  82. <?php
  83. list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
  84. $webmail = "webmail";
  85. if (!empty($_SESSION['WEBMAIL_ALIAS'])) $webmail = $_SESSION['WEBMAIL_ALIAS'];
  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]['ANTIVIRUS'] == 'no') {
  96. $antivirus_icon = 'fa-circle-xmark';
  97. $antivirus_title = _('Disabled');
  98. } else {
  99. $antivirus_icon = 'fa-circle-check';
  100. $antivirus_title = _('Enabled');
  101. }
  102. if ($data[$key]['ANTISPAM'] == 'no') {
  103. $antispam_icon = 'fa-circle-xmark';
  104. $antispam_title = _('Disabled');
  105. } else {
  106. $antispam_icon = 'fa-circle-check';
  107. $antispam_title = _('Enabled');
  108. }
  109. if ($data[$key]['DKIM'] == 'no') {
  110. $dkim_icon = 'fa-circle-xmark';
  111. $dkim_title = _('Disabled');
  112. } else {
  113. $dkim_icon = 'fa-circle-check';
  114. $dkim_title = _('Enabled');
  115. }
  116. if ($data[$key]['SSL'] == 'no') {
  117. $ssl_icon = 'fa-circle-xmark';
  118. $ssl_title = _('Disabled');
  119. } else {
  120. $ssl_icon = 'fa-circle-check';
  121. $ssl_title = _('Enabled');
  122. }
  123. } else {
  124. $status = 'active';
  125. $spnd_action = 'suspend';
  126. $spnd_action_title = _('Suspend');
  127. $spnd_icon = 'fa-pause';
  128. $spnd_icon_class = 'icon-highlight';
  129. $spnd_confirmation = _('Are you sure you want to suspend domain %s?');
  130. if ($data[$key]['ANTIVIRUS'] == 'no') {
  131. $antivirus_icon = 'fa-circle-xmark icon-red';
  132. $antivirus_title = _('Disabled');
  133. } else {
  134. $antivirus_icon = 'fa-circle-check icon-green';
  135. $antivirus_title = _('Enabled');
  136. }
  137. if ($data[$key]['ANTISPAM'] == 'no') {
  138. $antispam_icon = 'fa-circle-xmark icon-red';
  139. $antispam_title = _('Disabled');
  140. } else {
  141. $antispam_icon = 'fa-circle-check icon-green';
  142. $antispam_title = _('Enabled');
  143. }
  144. if ($data[$key]['DKIM'] == 'no') {
  145. $dkim_icon = 'fa-circle-xmark icon-red';
  146. $dkim_title = _('Disabled');
  147. } else {
  148. $dkim_icon = 'fa-circle-check icon-green';
  149. $dkim_title = _('Enabled');
  150. }
  151. if ($data[$key]['SSL'] == 'no') {
  152. $ssl_icon = 'fa-circle-xmark icon-red';
  153. $ssl_title = _('Disabled');
  154. } else {
  155. $ssl_icon = 'fa-circle-check icon-green';
  156. $ssl_title = _('Enabled');
  157. }
  158. }
  159. if (empty($data[$key]['CATCHALL'])) {
  160. $data[$key]['CATCHALL'] = '/dev/null';
  161. }
  162. ?>
  163. <div class="units-table-row <?php if ($status == 'suspended') echo 'disabled'; ?> animate__animated animate__fadeIn js-unit"
  164. data-sort-date="<?= strtotime($data[$key]['DATE'].' '.$data[$key]['TIME']) ?>"
  165. data-sort-name="<?= $key ?>"
  166. data-sort-disk="<?= $data[$key]["U_DISK"] ?>"
  167. data-sort-accounts="<?= $data[$key]["ACCOUNTS"] ?>">
  168. <div class="units-table-cell">
  169. <div>
  170. <input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="domain[]" value="<?= $key ?>" <?= $display_mode ?>>
  171. <label for="check<?= $i ?>" class="u-hide-desktop"><?= _("Select") ?></label>
  172. </div>
  173. </div>
  174. <div class="units-table-cell units-table-heading-cell u-text-bold">
  175. <span class="u-hide-desktop"><?= _("Name") ?>:</span>
  176. <a href="?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>" title="<?= _("Mail Accounts") ?>: <?= $key ?>">
  177. <?= $key ?>
  178. </a>
  179. </div>
  180. <div class="units-table-cell">
  181. <ul class="units-table-row-actions">
  182. <?php if ($read_only === "true") { ?>
  183. <li class="units-table-row-action shortcut-l" data-key-action="href">
  184. <a
  185. class="units-table-row-action-link"
  186. href="?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  187. title="<?= _("Mail Accounts") ?>"
  188. >
  189. <i class="fas fa-users icon-blue"></i>
  190. <span class="u-hide-desktop"><?= _("Mail Accounts") ?></span>
  191. </a>
  192. </li>
  193. <li class="units-table-row-action shortcut-l" data-key-action="href">
  194. <a
  195. class="units-table-row-action-link"
  196. href="?domain=<?= $key ?>&dns=1&token=<?= $_SESSION["token"] ?>"
  197. title="<?= _("DNS Records") ?>"
  198. >
  199. <i class="fas fa-book-atlas icon-blue"></i>
  200. <span class="u-hide-desktop"><?= _("DNS Records") ?></span>
  201. </a>
  202. </li>
  203. <?php if ($data[$key]["SUSPENDED"] == "no") { ?>
  204. <li class="units-table-row-action" data-key-action="href">
  205. <a
  206. class="units-table-row-action-link"
  207. href="http://<?= $webmail ?>.<?= $key ?>/"
  208. target="_blank"
  209. title="<?= _("Open Webmail") ?>"
  210. >
  211. <i class="fas fa-paper-plane icon-lightblue"></i>
  212. <span class="u-hide-desktop"><?= _("Open Webmail") ?></span>
  213. </a>
  214. </li>
  215. <?php } ?>
  216. <?php } else { ?>
  217. <?php if ($data[$key]["SUSPENDED"] == "no") { ?>
  218. <li class="units-table-row-action shortcut-n" data-key-action="href">
  219. <a
  220. class="units-table-row-action-link"
  221. href="/add/mail/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  222. title="<?= _("Add Mail Account") ?>"
  223. >
  224. <i class="fas fa-circle-plus icon-green"></i>
  225. <span class="u-hide-desktop"><?= _("Add Mail Account") ?></span>
  226. </a>
  227. </li>
  228. <?php if ($_SESSION["WEBMAIL_SYSTEM"]) { ?>
  229. <?php if (!empty($data[$key]["WEBMAIL"])) { ?>
  230. <li class="units-table-row-action" data-key-action="href">
  231. <a
  232. class="units-table-row-action-link"
  233. href="http://<?= $webmail ?>.<?= $key ?>/"
  234. target="_blank"
  235. title="<?= _("Open Webmail") ?>"
  236. >
  237. <i class="fas fa-paper-plane icon-lightblue"></i>
  238. <span class="u-hide-desktop"><?= _("Open Webmail") ?></span>
  239. </a>
  240. </li>
  241. <?php } ?>
  242. <?php } ?>
  243. <li class="units-table-row-action shortcut-enter" data-key-action="href">
  244. <a
  245. class="units-table-row-action-link"
  246. href="/edit/mail/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  247. title="<?= _("Edit Mail Domain") ?>"
  248. >
  249. <i class="fas fa-pencil icon-orange"></i>
  250. <span class="u-hide-desktop"><?= _("Edit Mail Domain") ?></span>
  251. </a>
  252. </li>
  253. <?php } ?>
  254. <li class="units-table-row-action shortcut-l" data-key-action="href">
  255. <a
  256. class="units-table-row-action-link"
  257. href="?domain=<?= $key ?>&dns=1&token=<?= $_SESSION["token"] ?>"
  258. title="<?= _("DNS Records") ?>"
  259. >
  260. <i class="fas fa-book-atlas icon-blue"></i>
  261. <span class="u-hide-desktop"><?= _("DNS Records") ?></span>
  262. </a>
  263. </li>
  264. <li class="units-table-row-action shortcut-s" data-key-action="js">
  265. <a
  266. class="units-table-row-action-link data-controls js-confirm-action"
  267. href="/<?= $spnd_action ?>/mail/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  268. title="<?= $spnd_action_title ?>"
  269. data-confirm-title="<?= $spnd_action_title ?>"
  270. data-confirm-message="<?= sprintf($spnd_confirmation, $key) ?>"
  271. >
  272. <i class="fas <?= $spnd_icon ?> <?= $spnd_icon_class ?>"></i>
  273. <span class="u-hide-desktop"><?= $spnd_action_title ?></span>
  274. </a>
  275. </li>
  276. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  277. <a
  278. class="units-table-row-action-link data-controls js-confirm-action"
  279. href="/delete/mail/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  280. title="<?= _("Delete") ?>"
  281. data-confirm-title="<?= _("Delete") ?>"
  282. data-confirm-message="<?= sprintf(_("Are you sure you want to delete domain %s?"), $key) ?>"
  283. >
  284. <i class="fas fa-trash icon-red"></i>
  285. <span class="u-hide-desktop"><?= _("Delete") ?></span>
  286. </a>
  287. </li>
  288. <?php } ?>
  289. </ul>
  290. </div>
  291. <div class="units-table-cell u-text-center-desktop">
  292. <span class="u-hide-desktop u-text-bold"><?= _("Accounts") ?>:</span>
  293. <?php
  294. if ($data[$key]['ACCOUNTS']) {
  295. $mail_accounts = htmlentities($data[$key]['ACCOUNTS']);
  296. } else {
  297. $mail_accounts = '0';
  298. }
  299. ?>
  300. <?= $mail_accounts ?>
  301. </div>
  302. <div class="units-table-cell u-text-center-desktop">
  303. <span class="u-hide-desktop u-text-bold"><?= _("Disk") ?>:</span>
  304. <span class="u-text-bold">
  305. <?= humanize_usage_size($data[$key]["U_DISK"]) ?>
  306. </span>
  307. <span class="u-text-small">
  308. <?= humanize_usage_measure($data[$key]["U_DISK"]) ?>
  309. </span>
  310. </div>
  311. <div class="units-table-cell u-text-center-desktop">
  312. <span class="u-hide-desktop u-text-bold"><?= _("Anti-Virus") ?>:</span>
  313. <i class="fas <?= $antivirus_icon ?>" title="<?= $antivirus_title ?>"></i>
  314. </div>
  315. <div class="units-table-cell u-text-center-desktop">
  316. <span class="u-hide-desktop u-text-bold"><?= _("Spam Filter") ?>:</span>
  317. <i class="fas <?= $antispam_icon ?>" title="<?= $antispam_title ?>"></i>
  318. </div>
  319. <div class="units-table-cell u-text-center-desktop">
  320. <span class="u-hide-desktop u-text-bold"><?= _("DKIM") ?>:</span>
  321. <i class="fas <?= $dkim_icon ?>" title="<?= $dkim_title ?>"></i>
  322. </div>
  323. <div class="units-table-cell u-text-center-desktop">
  324. <span class="u-hide-desktop u-text-bold"><?= _("SSL") ?>:</span>
  325. <i class="fas <?= $ssl_icon ?>" title="<?= $ssl_title ?>"></i>
  326. </div>
  327. </div>
  328. <?php } ?>
  329. </div>
  330. </div>
  331. <footer class="app-footer">
  332. <div class="container app-footer-inner">
  333. <p>
  334. <?php printf(ngettext("%d mail domain", "%d mail domains", $i), $i); ?>
  335. </p>
  336. </div>
  337. </footer>