list_web.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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/web/" class="button button-secondary js-button-create">
  7. <i class="fas fa-circle-plus icon-green"></i><?= _("Add Web 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-bandwidth" data-sort-as-int="1">
  22. <span class="name"><?= _("Bandwidth") ?> <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. <li data-entity="sort-ip" data-sort-as-int="1">
  34. <span class="name"><?= _("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>
  35. </li>
  36. </ul>
  37. <?php if ($read_only !== "true") { ?>
  38. <form x-data x-bind="BulkEdit" action="/bulk/web/" method="post">
  39. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  40. <select class="form-select" name="action">
  41. <option value=""><?= _("Apply to selected") ?></option>
  42. <?php if ($_SESSION["userContext"] === "admin") { ?>
  43. <option value="rebuild"><?= _("Rebuild") ?></option>
  44. <?php } ?>
  45. <option value="suspend"><?= _("Suspend") ?></option>
  46. <option value="unsuspend"><?= _("Unsuspend") ?></option>
  47. <option value="delete"><?= _("Delete") ?></option>
  48. </select>
  49. <button type="submit" class="toolbar-input-submit" title="<?= _("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="<?= $_SESSION["token"] ?>">
  58. <input type="search" class="form-control js-search-input" name="q" value="<? echo isset($_POST['q']) ? htmlspecialchars($_POST['q']) : '' ?>" title="<?= _("Search") ?>">
  59. <button type="submit" class="toolbar-input-submit" title="<?= _("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"><?= _("Web Domains") ?></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="<?= _("Select all") ?>" <?= $display_mode ?>>
  74. </div>
  75. <div class="units-table-cell"><?= _("Name") ?></div>
  76. <div class="units-table-cell"></div>
  77. <div class="units-table-cell u-text-center"><?= _("IP Address") ?></div>
  78. <div class="units-table-cell u-text-center"><?= _("Disk") ?></div>
  79. <div class="units-table-cell u-text-center"><?= _("Bandwidth") ?></div>
  80. <div class="units-table-cell u-text-center"><?= _("SSL") ?></div>
  81. <div class="units-table-cell u-text-center"><?= _("Statistics") ?></div>
  82. </div>
  83. <!-- Begin web domain list item loop -->
  84. <?php
  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. } else {
  95. $status = 'active';
  96. $spnd_action = 'suspend';
  97. $spnd_action_title = _('Suspend');
  98. $spnd_icon = 'fa-pause';
  99. $spnd_icon_class = 'icon-highlight';
  100. $spnd_confirmation = _('Are you sure you want to suspend domain %s?');
  101. }
  102. if (!empty($data[$key]['SSL_HOME'])) {
  103. if ($data[$key]['SSL_HOME'] == 'same') {
  104. $ssl_home = 'public_html';
  105. } else {
  106. $ssl_home = 'public_shtml';
  107. }
  108. } else {
  109. $ssl_home = '';
  110. }
  111. $web_stats='no';
  112. if (!empty($data[$key]['STATS'])) {
  113. $web_stats=$data[$key]['STATS'];
  114. }
  115. $ftp_user='no';
  116. if (!empty($data[$key]['FTP_USER'])) {
  117. $ftp_user=$data[$key]['FTP_USER'];
  118. }
  119. if (strlen($ftp_user) > 24 ) {
  120. $ftp_user = str_replace(':', ', ', $ftp_user);
  121. $ftp_user = substr($ftp_user, 0, 24);
  122. $ftp_user = trim($ftp_user, ":");
  123. $ftp_user = str_replace(':', ', ', $ftp_user);
  124. $ftp_user = $ftp_user.", ...";
  125. } else {
  126. $ftp_user = str_replace(':', ', ', $ftp_user);
  127. }
  128. $backend_support='no';
  129. if (!empty($data[$key]['BACKEND'])) {
  130. $backend_support='yes';
  131. }
  132. $proxy_support='no';
  133. if (!empty($data[$key]['PROXY'])) {
  134. $proxy_support='yes';
  135. }
  136. if (strlen($data[$key]['PROXY_EXT']) > 24 ) {
  137. $proxy_ext_title = str_replace(',', ', ', $data[$key]['PROXY_EXT']);
  138. $proxy_ext = substr($data[$key]['PROXY_EXT'], 0, 24);
  139. $proxy_ext = trim($proxy_ext, ",");
  140. $proxy_ext = str_replace(',', ', ', $proxy_ext);
  141. $proxy_ext = $proxy_ext.", ...";
  142. } else {
  143. $proxy_ext_title = '';
  144. $proxy_ext = str_replace(',', ', ', $data[$key]['PROXY_EXT']);
  145. }
  146. if ($data[$key]['SUSPENDED'] === 'yes') {
  147. if ($data[$key]['SSL'] == 'no') {
  148. $icon_ssl = 'fas fa-circle-xmark';
  149. $title_ssl = _('Disabled');
  150. }
  151. if ($data[$key]['SSL'] == 'yes') {
  152. $icon_ssl = 'fas fa-circle-check';
  153. $title_ssl = _('Enabled');
  154. }
  155. if ($web_stats == 'no') {
  156. $icon_webstats = 'fas fa-circle-xmark';
  157. $title_webstats = _('Disabled');
  158. } else {
  159. $icon_webstats = 'fas fa-circle-check';
  160. $title_webstats = _('Enabled');
  161. }
  162. } else {
  163. if ($data[$key]['SSL'] == 'no') {
  164. $icon_ssl = 'fas fa-circle-xmark icon-red';
  165. $title_ssl = _('Disabled');
  166. }
  167. if ($data[$key]['SSL'] == 'yes') {
  168. $icon_ssl = 'fas fa-circle-check icon-green';
  169. $title_ssl = _('Enabled');
  170. }
  171. if ($web_stats == 'no') {
  172. $icon_webstats = 'fas fa-circle-xmark icon-red';
  173. $title_webstats = _('Disabled');
  174. } else {
  175. $icon_webstats = 'fas fa-circle-check icon-green';
  176. $title_webstats = _('Enabled');
  177. }
  178. }
  179. ?>
  180. <div class="units-table-row <?php if ($data[$key]['SUSPENDED'] == 'yes') echo 'disabled'; ?> animate__animated animate__fadeIn js-unit"
  181. data-sort-ip="<?= str_replace('.', '', $data[$key]['IP']) ?>"
  182. data-sort-date="<?= strtotime($data[$key]['DATE'].' '.$data[$key]['TIME']) ?>"
  183. data-sort-name="<?= $key ?>"
  184. data-sort-bandwidth="<?= $data[$key]['U_BANDWIDTH'] ?>"
  185. data-sort-disk="<?= $data[$key]['U_DISK'] ?>">
  186. <div class="units-table-cell">
  187. <div>
  188. <input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="domain[]" value="<?= $key ?>" <?= $display_mode ?>>
  189. <label for="check<?= $i ?>" class="u-hide-desktop"><?= _("Select") ?></label>
  190. </div>
  191. </div>
  192. <div class="units-table-cell units-table-heading-cell u-text-bold">
  193. <span class="u-hide-desktop"><?= _("Name") ?>:</span>
  194. <?php if ($read_only === "true") { ?>
  195. <?= $key ?>
  196. <?php } else {
  197. $aliases = explode(',', $data[$key]['ALIAS']);
  198. $alias_new = array();
  199. foreach($aliases as $alias){
  200. if ($alias != 'www.'.$key) {
  201. $alias_new[] = trim($alias);
  202. }
  203. }
  204. ?>
  205. <a href="/edit/web/?domain=<?= $key ?>&token=<?= $_SESSION['token'] ?>" title="<?= _("Edit Domain") ?>: <?= $key ?>">
  206. <?= $key ?>
  207. <?php
  208. if (!empty($alias_new) && !empty($data[$key]['ALIAS'])) {
  209. $aliases = implode(', ', $alias_new);
  210. echo "<p class='hint u-max-width300 u-text-truncate'>($aliases)</p>";
  211. }
  212. ?>
  213. </a>
  214. <?php } ?>
  215. </div>
  216. <div class="units-table-cell">
  217. <ul class="units-table-row-actions">
  218. <?php if (!empty($data[$key]["STATS"])) { ?>
  219. <li class="units-table-row-action shortcut-w" data-key-action="href">
  220. <a
  221. class="units-table-row-action-link"
  222. href="http://<?= $key ?>/vstats/"
  223. target="_blank"
  224. rel="noopener"
  225. title="<?= _("Statistics") ?>"
  226. >
  227. <i class="fas fa-chart-bar icon-maroon"></i>
  228. <span class="u-hide-desktop"><?= _("Statistics") ?></span>
  229. </a>
  230. </li>
  231. <?php } ?>
  232. <li class="units-table-row-action" data-key-action="href">
  233. <a
  234. class="units-table-row-action-link"
  235. href="http://<?= $key ?>/"
  236. target="_blank"
  237. rel="noopener"
  238. title="<?= _("Visit") ?>"
  239. >
  240. <i class="fas fa-square-up-right icon-lightblue"></i>
  241. <span class="u-hide-desktop"><?= _("Visit") ?></span>
  242. </a>
  243. </li>
  244. <?php if ($read_only !== "true") { ?>
  245. <?php if ($data[$key]["SUSPENDED"] == "no") { ?>
  246. <li class="units-table-row-action shortcut-enter" data-key-action="href">
  247. <a
  248. class="units-table-row-action-link"
  249. href="/edit/web/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  250. title="<?= _("Edit Domain") ?>"
  251. >
  252. <i class="fas fa-pencil icon-orange"></i>
  253. <span class="u-hide-desktop"><?= _("Edit Domain") ?></span>
  254. </a>
  255. </li>
  256. <?php } ?>
  257. <li class="units-table-row-action shortcut-l" data-key-action="href">
  258. <a
  259. class="units-table-row-action-link"
  260. href="/list/web-log/?domain=<?= $key ?>&type=access#"
  261. title="<?= _("Access Log") ?>"
  262. >
  263. <i class="fas fa-binoculars icon-purple"></i>
  264. <span class="u-hide-desktop"><?= _("Access Log") ?></span>
  265. </a>
  266. </li>
  267. <li class="units-table-row-action shortcut-s" data-key-action="js">
  268. <a
  269. class="units-table-row-action-link data-controls js-confirm-action"
  270. href="/<?= $spnd_action ?>/web/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  271. title="<?= $spnd_action_title ?>"
  272. data-confirm-title="<?= $spnd_action_title ?>"
  273. data-confirm-message="<?= sprintf($spnd_confirmation, $key) ?>"
  274. >
  275. <i class="fas <?= $spnd_icon ?> <?= $spnd_icon_class ?>"></i>
  276. <span class="u-hide-desktop"><?= $spnd_action_title ?></span>
  277. </a>
  278. </li>
  279. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  280. <a
  281. class="units-table-row-action-link data-controls js-confirm-action"
  282. href="/delete/web/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  283. title="<?= _("Delete") ?>"
  284. data-confirm-title="<?= _("Delete") ?>"
  285. data-confirm-message="<?= sprintf(_("Are you sure you want to delete domain %s?"), $key) ?>"
  286. >
  287. <i class="fas fa-trash icon-red"></i>
  288. <span class="u-hide-desktop"><?= _("Delete") ?></span>
  289. </a>
  290. </li>
  291. <?php } ?>
  292. </ul>
  293. </div>
  294. <div class="units-table-cell u-text-center-desktop">
  295. <span class="u-hide-desktop u-text-bold"><?= _("IP Address") ?>:</span>
  296. <?= empty($ips[$data[$key]["IP"]]["NAT"]) ? $data[$key]["IP"] : "{$ips[$data[$key]["IP"]]["NAT"]}" ?>
  297. </div>
  298. <div class="units-table-cell u-text-center-desktop">
  299. <span class="u-hide-desktop u-text-bold"><?= _("Disk") ?>:</span>
  300. <span class="u-text-bold">
  301. <?= humanize_usage_size($data[$key]["U_DISK"]) ?>
  302. </span>
  303. <span class="u-text-small">
  304. <?= humanize_usage_measure($data[$key]["U_DISK"]) ?>
  305. </span>
  306. </div>
  307. <div class="units-table-cell u-text-center-desktop">
  308. <span class="u-hide-desktop u-text-bold"><?= _("Bandwidth") ?>:</span>
  309. <span class="u-text-bold">
  310. <?= humanize_usage_size($data[$key]["U_BANDWIDTH"]) ?>
  311. </span>
  312. <span class="u-text-small">
  313. <?= humanize_usage_measure($data[$key]["U_BANDWIDTH"]) ?>
  314. </span>
  315. </div>
  316. <div class="units-table-cell u-text-center-desktop">
  317. <span class="u-hide-desktop u-text-bold"><?= _("SSL") ?>:</span>
  318. <i class="fas <?= $icon_ssl ?>" title="<?= $title_ssl ?>"></i>
  319. </div>
  320. <div class="units-table-cell u-text-center-desktop">
  321. <span class="u-hide-desktop u-text-bold"><?= _("Statistics") ?>:</span>
  322. <i class="fas <?= $icon_webstats ?>" title="<?= $title_webstats ?>"></i>
  323. </div>
  324. </div>
  325. <?php } ?>
  326. </div>
  327. </div>
  328. <footer class="app-footer">
  329. <div class="container app-footer-inner">
  330. <p>
  331. <?php printf(ngettext("%d web domain", "%d web domains", $i), $i); ?>
  332. </p>
  333. </div>
  334. </footer>