list_mail.php 13 KB

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