list_web.php 14 KB

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