list_mail_acc.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <?php
  2. $v_webmail_alias = "webmail";
  3. if (!empty($_SESSION["WEBMAIL_ALIAS"])) {
  4. $v_webmail_alias = $_SESSION["WEBMAIL_ALIAS"];
  5. }
  6. ?>
  7. <!-- Begin toolbar -->
  8. <div class="toolbar">
  9. <div class="toolbar-inner">
  10. <div class="toolbar-buttons">
  11. <a class="button button-secondary button-back js-button-back" href="/list/mail/">
  12. <i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
  13. </a>
  14. <?php if ($read_only !== "true") { ?>
  15. <a href="/add/mail/?domain=<?= htmlentities($_GET["domain"]) ?>" class="button button-secondary js-button-create">
  16. <i class="fas fa-circle-plus icon-green"></i><?= _("Add Mail Account") ?>
  17. </a>
  18. <a href="/edit/mail/?domain=<?= htmlentities($_GET["domain"]) ?>" class="button button-secondary js-button-create">
  19. <i class="fas fa-pencil icon-blue"></i><?= _("Edit Mail Domain") ?>
  20. </a>
  21. <?php } ?>
  22. </div>
  23. <div class="toolbar-right">
  24. <div class="toolbar-sorting">
  25. <button class="toolbar-sorting-toggle js-toggle-sorting-menu" type="button" title="<?= _("Sort items") ?>">
  26. <?= _("Sort by") ?>:
  27. <span class="u-text-bold">
  28. <?php if ($_SESSION['userSortOrder'] === 'name') { $label = _('Name'); } else { $label = _('Date'); } ?>
  29. <?= $label ?> <i class="fas fa-arrow-down-a-z"></i>
  30. </span>
  31. </button>
  32. <ul class="toolbar-sorting-menu animate__animated animate__fadeIn js-sorting-menu u-hidden">
  33. <li data-entity="sort-date" data-sort-as-int="1">
  34. <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>
  35. </li>
  36. <li data-entity="sort-disk" data-sort-as-int="1">
  37. <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>
  38. </li>
  39. <li data-entity="sort-name">
  40. <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>
  41. </li>
  42. <li data-entity="sort-quota" data-sort-as-int="1">
  43. <span class="name"><?= _("Quota") ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  44. </li>
  45. </ul>
  46. <?php if ($read_only !== "true") { ?>
  47. <form x-data x-bind="BulkEdit" action="/bulk/mail/" method="post">
  48. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  49. <input type="hidden" value="<?= htmlspecialchars($_GET["domain"]) ?>" name="domain">
  50. <select class="form-select" name="action">
  51. <option value=""><?= _("Apply to selected") ?></option>
  52. <option value="suspend"><?= _("Suspend") ?></option>
  53. <option value="unsuspend"><?= _("Unsuspend") ?></option>
  54. <option value="delete"><?= _("Delete") ?></option>
  55. </select>
  56. <button type="submit" class="toolbar-input-submit" title="<?= _("Apply to selected") ?>">
  57. <i class="fas fa-arrow-right"></i>
  58. </button>
  59. </form>
  60. <?php } ?>
  61. </div>
  62. <div class="toolbar-search">
  63. <form action="/search/" method="get">
  64. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  65. <input type="search" class="form-control js-search-input" name="q" value="<? echo isset($_POST['q']) ? htmlspecialchars($_POST['q']) : '' ?>" title="<?= _("Search") ?>">
  66. <button type="submit" class="toolbar-input-submit" title="<?= _("Search") ?>">
  67. <i class="fas fa-magnifying-glass"></i>
  68. </button>
  69. </form>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <!-- End toolbar -->
  75. <div class="container">
  76. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= _("Mail Accounts") ?></h1>
  77. <div class="units-table js-units-container">
  78. <div class="units-table-header">
  79. <div class="units-table-cell">
  80. <input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
  81. </div>
  82. <div class="units-table-cell"><?= _("Name") ?></div>
  83. <div class="units-table-cell"></div>
  84. <div class="units-table-cell u-text-center"><?= _("Disk") ?></div>
  85. <div class="units-table-cell u-text-center"><?= _("Quota") ?></div>
  86. <div class="units-table-cell u-text-center"><?= _("Aliases") ?></div>
  87. <div class="units-table-cell u-text-center"><?= _("Forwarding") ?></div>
  88. <div class="units-table-cell u-text-center"><?= _("Auto Reply") ?></div>
  89. </div>
  90. <!-- Begin mail account list item loop -->
  91. <?php
  92. foreach ($data as $key => $value) {
  93. ++$i;
  94. if ($data[$key]['SUSPENDED'] == 'yes') {
  95. $status = 'suspended';
  96. $spnd_action = 'unsuspend';
  97. $spnd_action_title = _('Unsuspend');
  98. $spnd_icon = 'fa-play';
  99. $spnd_icon_class = 'icon-green';
  100. $spnd_confirmation = _('Are you sure you want to unsuspend %s?');
  101. if ($data[$key]['ALIAS'] == '') {
  102. $alias_icon = 'fa-circle-minus';
  103. $alias_title = _('No aliases');
  104. } else {
  105. $alias_icon = 'fa-circle-check';
  106. $alias_title = _('Aliases used');
  107. }
  108. if ($data[$key]['FWD'] == '') {
  109. $fwd_icon = 'fa-circle-minus';
  110. $fwd_title = _('Disabled');
  111. } else {
  112. $fwd_icon = 'fa-circle-check';
  113. $fwd_title = _('Enabled');
  114. }
  115. if ($data[$key]['AUTOREPLY'] == 'no') {
  116. $autoreply_icon = 'fa-circle-minus';
  117. $autoreply_title = _('Disabled');
  118. } else {
  119. $autoreply_icon = 'fa-circle-check';
  120. $autoreply_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 %s?');
  129. if ($data[$key]['ALIAS'] == '') {
  130. $alias_icon = 'fa-circle-minus';
  131. $alias_title = _('No aliases');
  132. } else {
  133. $alias_icon = 'fa-circle-check icon-green';
  134. $alias_title = _('Aliases used');
  135. }
  136. if ($data[$key]['FWD'] == '') {
  137. $fwd_icon = 'fa-circle-minus';
  138. $fwd_title = _('Disabled');
  139. } else {
  140. $fwd_icon = 'fa-circle-check icon-green';
  141. $fwd_title = _('Enabled');
  142. }
  143. if ($data[$key]['AUTOREPLY'] == 'no') {
  144. $autoreply_icon = 'fa-circle-minus';
  145. $autoreply_title = _('Disabled');
  146. } else {
  147. $autoreply_icon = 'fa-circle-check icon-green';
  148. $autoreply_title = _('Enabled');
  149. }
  150. }
  151. ?>
  152. <div class="units-table-row <?php if ($status == 'suspended') echo 'disabled'; ?> animate__animated animate__fadeIn js-unit"
  153. data-sort-date="<?= strtotime($data[$key]['DATE'].' '.$data[$key]['TIME']) ?>"
  154. data-sort-name="<?= $key ?>"
  155. data-sort-disk="<?= $data[$key]["U_DISK"] ?>"
  156. data-sort-quota="<?= $data[$key]["QUOTA"] ?>">
  157. <div class="units-table-cell">
  158. <div>
  159. <input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="account[]" value="<?= $key ?>" <?= $display_mode ?>>
  160. <label for="check<?= $i ?>" class="u-hide-desktop"><?= _("Select") ?></label>
  161. </div>
  162. </div>
  163. <div class="units-table-cell units-table-heading-cell u-text-bold">
  164. <span class="u-hide-desktop"><?= _("Name") ?>:</span>
  165. <?php if ($read_only === "true" || $data[$key]["SUSPENDED"] == "yes") { ?>
  166. <?= $key . "@" . htmlentities($_GET["domain"]) ?>
  167. <?php } else { ?>
  168. <a href="/edit/mail/?domain=<?= htmlspecialchars($_GET['domain']) ?>&account=<?= $key ?>&token=<?= $_SESSION['token'] ?>" title="<?= _("Edit Mail Account") ?>: <?= $key ?>@<?= htmlspecialchars($_GET['domain']) ?>">
  169. <?= $key."@".htmlentities($_GET['domain']); ?>
  170. </a>
  171. <?php } ?>
  172. </div>
  173. <div class="units-table-cell">
  174. <ul class="units-table-row-actions">
  175. <?php if ($read_only === "true") { ?>
  176. <!-- Restrict the ability to edit, delete, or suspend domain items when impersonating 'admin' account -->
  177. <?php if ($data[$key]["SUSPENDED"] != "yes") { ?>
  178. <li class="units-table-row-action" data-key-action="href">
  179. <a
  180. class="units-table-row-action-link"
  181. href="http://<?= $v_webmail_alias ?>.<?= htmlspecialchars($_GET["domain"]) ?>/?_user=<?= $key ?>@<?= htmlspecialchars($_GET["domain"]) ?>"
  182. target="_blank"
  183. title="<?= _("Open Webmail") ?>"
  184. >
  185. <i class="fas fa-envelope-open-text icon-maroon"></i>
  186. <span class="u-hide-desktop"><?= _("Open Webmail") ?></span>
  187. </a>
  188. </li>
  189. <?php } ?>
  190. <?php } else { ?>
  191. <?php if ($data[$key]["SUSPENDED"] == "no") { ?>
  192. <?php if ($_SESSION["WEBMAIL_SYSTEM"]) { ?>
  193. <?php if (!empty($data[$key]["WEBMAIL"])) { ?>
  194. <li class="units-table-row-action" data-key-action="href">
  195. <a
  196. class="units-table-row-action-link"
  197. href="http://<?= $v_webmail_alias ?>.<?= htmlspecialchars($_GET["domain"]) ?>/?_user=<?= $key ?>@<?= htmlspecialchars($_GET["domain"]) ?>"
  198. target="_blank"
  199. title="<?= _("Open Webmail") ?>"
  200. >
  201. <i class="fas fa-envelope-open-text icon-maroon"></i>
  202. <span class="u-hide-desktop"><?= _("Open Webmail") ?></span>
  203. </a>
  204. </li>
  205. <?php } ?>
  206. <?php } ?>
  207. <li class="units-table-row-action shortcut-enter" data-key-action="href">
  208. <a
  209. class="units-table-row-action-link"
  210. href="/edit/mail/?domain=<?= htmlspecialchars($_GET["domain"]) ?>&account=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  211. title="<?= _("Edit Mail Account") ?>"
  212. >
  213. <i class="fas fa-pencil icon-orange"></i>
  214. <span class="u-hide-desktop"><?= _("Edit Mail Account") ?></span>
  215. </a>
  216. </li>
  217. <?php } ?>
  218. <li class="units-table-row-action shortcut-s" data-key-action="js">
  219. <a
  220. class="units-table-row-action-link data-controls js-confirm-action"
  221. href="/<?= $spnd_action ?>/mail/?domain=<?= htmlspecialchars($_GET["domain"]) ?>&account=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  222. title="<?= $spnd_action_title ?>"
  223. data-confirm-title="<?= $spnd_action_title ?>"
  224. data-confirm-message="<?= sprintf($spnd_confirmation, $key) ?>"
  225. >
  226. <i class="fas <?= $spnd_icon ?> <?= $spnd_icon_class ?>"></i>
  227. <span class="u-hide-desktop"><?= $spnd_action_title ?></span>
  228. </a>
  229. </li>
  230. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  231. <a
  232. class="units-table-row-action-link data-controls js-confirm-action"
  233. href="/delete/mail/?domain=<?= htmlspecialchars($_GET["domain"]) ?>&account=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  234. title="<?= _("Delete") ?>"
  235. data-confirm-title="<?= _("Delete") ?>"
  236. data-confirm-message="<?= sprintf(_("Are you sure you want to delete %s?"), $key) ?>"
  237. >
  238. <i class="fas fa-trash icon-red"></i>
  239. <span class="u-hide-desktop"><?= _("Delete") ?></span>
  240. </a>
  241. </li>
  242. <?php } ?>
  243. </ul>
  244. </div>
  245. <div class="units-table-cell u-text-center-desktop">
  246. <span class="u-hide-desktop u-text-bold"><?= _("Disk") ?>:</span>
  247. <span class="u-text-bold">
  248. <?= humanize_usage_size($data[$key]["U_DISK"]) ?>
  249. </span>
  250. <span class="u-text-small">
  251. <?= humanize_usage_measure($data[$key]["U_DISK"]) ?>
  252. </span>
  253. </div>
  254. <div class="units-table-cell u-text-center-desktop">
  255. <span class="u-hide-desktop u-text-bold"><?= _("Quota") ?>:</span>
  256. <span class="u-text-bold">
  257. <?= humanize_usage_size($data[$key]["QUOTA"]) ?>
  258. </span>
  259. <span class="u-text-small">
  260. <?= humanize_usage_measure($data[$key]["QUOTA"]) ?>
  261. </span>
  262. </div>
  263. <div class="units-table-cell u-text-center-desktop">
  264. <span class="u-hide-desktop u-text-bold"><?= _("Aliases") ?>:</span>
  265. <i class="fas <?= $alias_icon ?>" title="<?= $alias_title ?>"></i>
  266. </div>
  267. <div class="units-table-cell u-text-center-desktop">
  268. <span class="u-hide-desktop u-text-bold"><?= _("Forwarding") ?>:</span>
  269. <i class="fas <?= $fwd_icon ?>" title="<?= $fwd_title ?>"></i>
  270. </div>
  271. <div class="units-table-cell u-text-center-desktop">
  272. <span class="u-hide-desktop u-text-bold"><?= _("Auto Reply") ?>:</span>
  273. <i class="fas <?= $autoreply_icon ?>" title="<?= $autoreply_title ?>"></i>
  274. </div>
  275. </div>
  276. <?php } ?>
  277. </div>
  278. </div>
  279. <footer class="app-footer">
  280. <div class="container app-footer-inner">
  281. <p>
  282. <?php printf(ngettext("%d mail account", "%d mail accounts", $i), $i); ?>
  283. </p>
  284. </div>
  285. </footer>