list_web.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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 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="purge"><?= _('Purge Nginx Cache');?></option>
  48. <option value="delete"><?= _("Delete") ?></option>
  49. </select>
  50. <button type="submit" class="toolbar-input-submit" title="<?= _("Apply to selected") ?>">
  51. <i class="fas fa-arrow-right"></i>
  52. </button>
  53. </form>
  54. <?php } ?>
  55. </div>
  56. <div class="toolbar-search">
  57. <form action="/search/" method="get">
  58. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  59. <input type="search" class="form-control js-search-input" name="q" value="<? echo isset($_POST['q']) ? htmlspecialchars($_POST['q']) : '' ?>" title="<?= _("Search") ?>">
  60. <button type="submit" class="toolbar-input-submit" title="<?= _("Search") ?>">
  61. <i class="fas fa-magnifying-glass"></i>
  62. </button>
  63. </form>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <!-- End toolbar -->
  69. <div class="container">
  70. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= _("Web Domains") ?></h1>
  71. <div class="units-table js-units-container">
  72. <div class="units-table-header">
  73. <div class="units-table-cell">
  74. <input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
  75. </div>
  76. <div class="units-table-cell"><?= _("Name") ?></div>
  77. <div class="units-table-cell"></div>
  78. <div class="units-table-cell u-text-center"><?= _("IP Address") ?></div>
  79. <div class="units-table-cell u-text-center"><?= _("Disk") ?></div>
  80. <div class="units-table-cell u-text-center"><?= _("Bandwidth") ?></div>
  81. <div class="units-table-cell u-text-center"><?= _("SSL") ?></div>
  82. <div class="units-table-cell u-text-center"><?= _("Statistics") ?></div>
  83. </div>
  84. <!-- Begin web domain list item loop -->
  85. <?php
  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. } else {
  96. $status = 'active';
  97. $spnd_action = 'suspend';
  98. $spnd_action_title = _('Suspend');
  99. $spnd_icon = 'fa-pause';
  100. $spnd_icon_class = 'icon-highlight';
  101. $spnd_confirmation = _('Are you sure you want to suspend domain %s?');
  102. }
  103. if (!empty($data[$key]['SSL_HOME'])) {
  104. if ($data[$key]['SSL_HOME'] == 'same') {
  105. $ssl_home = 'public_html';
  106. } else {
  107. $ssl_home = 'public_shtml';
  108. }
  109. } else {
  110. $ssl_home = '';
  111. }
  112. $web_stats='no';
  113. if (!empty($data[$key]['STATS'])) {
  114. $web_stats=$data[$key]['STATS'];
  115. }
  116. $ftp_user='no';
  117. if (!empty($data[$key]['FTP_USER'])) {
  118. $ftp_user=$data[$key]['FTP_USER'];
  119. }
  120. if (strlen($ftp_user) > 24 ) {
  121. $ftp_user = str_replace(':', ', ', $ftp_user);
  122. $ftp_user = substr($ftp_user, 0, 24);
  123. $ftp_user = trim($ftp_user, ":");
  124. $ftp_user = str_replace(':', ', ', $ftp_user);
  125. $ftp_user = $ftp_user.", ...";
  126. } else {
  127. $ftp_user = str_replace(':', ', ', $ftp_user);
  128. }
  129. $backend_support='no';
  130. if (!empty($data[$key]['BACKEND'])) {
  131. $backend_support='yes';
  132. }
  133. $proxy_support='no';
  134. if (!empty($data[$key]['PROXY'])) {
  135. $proxy_support='yes';
  136. }
  137. if (strlen($data[$key]['PROXY_EXT']) > 24 ) {
  138. $proxy_ext_title = str_replace(',', ', ', $data[$key]['PROXY_EXT']);
  139. $proxy_ext = substr($data[$key]['PROXY_EXT'], 0, 24);
  140. $proxy_ext = trim($proxy_ext, ",");
  141. $proxy_ext = str_replace(',', ', ', $proxy_ext);
  142. $proxy_ext = $proxy_ext.", ...";
  143. } else {
  144. $proxy_ext_title = '';
  145. $proxy_ext = str_replace(',', ', ', $data[$key]['PROXY_EXT']);
  146. }
  147. if ($data[$key]['SUSPENDED'] === 'yes') {
  148. if ($data[$key]['SSL'] == 'no') {
  149. $icon_ssl = 'fas fa-circle-xmark';
  150. $title_ssl = _('Disabled');
  151. }
  152. if ($data[$key]['SSL'] == 'yes') {
  153. $icon_ssl = 'fas fa-circle-check';
  154. $title_ssl = _('Enabled');
  155. }
  156. if ($web_stats == 'no') {
  157. $icon_webstats = 'fas fa-circle-xmark';
  158. $title_webstats = _('Disabled');
  159. } else {
  160. $icon_webstats = 'fas fa-circle-check';
  161. $title_webstats = _('Enabled');
  162. }
  163. } else {
  164. if ($data[$key]['SSL'] == 'no') {
  165. $icon_ssl = 'fas fa-circle-xmark icon-red';
  166. $title_ssl = _('Disabled');
  167. }
  168. if ($data[$key]['SSL'] == 'yes') {
  169. $icon_ssl = 'fas fa-circle-check icon-green';
  170. $title_ssl = _('Enabled');
  171. }
  172. if ($web_stats == 'no') {
  173. $icon_webstats = 'fas fa-circle-xmark icon-red';
  174. $title_webstats = _('Disabled');
  175. } else {
  176. $icon_webstats = 'fas fa-circle-check icon-green';
  177. $title_webstats = _('Enabled');
  178. }
  179. }
  180. ?>
  181. <div class="units-table-row <?php if ($data[$key]['SUSPENDED'] == 'yes') echo 'disabled'; ?> js-unit"
  182. data-sort-ip="<?= str_replace('.', '', $data[$key]['IP']) ?>"
  183. data-sort-date="<?= strtotime($data[$key]['DATE'].' '.$data[$key]['TIME']) ?>"
  184. data-sort-name="<?= $key ?>"
  185. data-sort-bandwidth="<?= $data[$key]['U_BANDWIDTH'] ?>"
  186. data-sort-disk="<?= $data[$key]['U_DISK'] ?>">
  187. <div class="units-table-cell">
  188. <div>
  189. <input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="domain[]" value="<?= $key ?>" <?= $display_mode ?>>
  190. <label for="check<?= $i ?>" class="u-hide-desktop"><?= _("Select") ?></label>
  191. </div>
  192. </div>
  193. <div class="units-table-cell units-table-heading-cell u-text-bold">
  194. <span class="u-hide-desktop"><?= _("Name") ?>:</span>
  195. <?php if ($read_only === "true") { ?>
  196. <?= $key ?>
  197. <?php } else {
  198. $aliases = explode(',', $data[$key]['ALIAS']);
  199. $alias_new = array();
  200. foreach($aliases as $alias){
  201. if ($alias != 'www.'.$key) {
  202. $alias_new[] = trim($alias);
  203. }
  204. }
  205. ?>
  206. <a href="/edit/web/?domain=<?= $key ?>&token=<?= $_SESSION['token'] ?>" title="<?= _("Edit Domain") ?>: <?= $key ?>">
  207. <?= $key ?>
  208. <?php
  209. if (!empty($alias_new) && !empty($data[$key]['ALIAS'])) {
  210. $aliases = implode(', ', $alias_new);
  211. echo "<p class='hint u-max-width300 u-text-truncate'>($aliases)</p>";
  212. }
  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. <li class="units-table-row-action" data-key-action="href">
  258. <a
  259. class="units-table-row-action-link"
  260. href="/download/site/?site=<?=$key?>&token=<?= $_SESSION['token'] ?>"
  261. title="<?= _("Download Site") ?>"
  262. >
  263. <i class="fas fa-download icon-orange"></i>
  264. <span class="u-hide-desktop"><?= _("Download Site") ?></span>
  265. </a>
  266. </li>
  267. <?php } ?>
  268. <li class="units-table-row-action shortcut-l" data-key-action="href">
  269. <a
  270. class="units-table-row-action-link"
  271. href="/list/web-log/?domain=<?= $key ?>&type=access#"
  272. title="<?= _("Access Log") ?>"
  273. >
  274. <i class="fas fa-binoculars icon-purple"></i>
  275. <span class="u-hide-desktop"><?= _("Access Log") ?></span>
  276. </a>
  277. </li>
  278. <li class="units-table-row-action shortcut-s" data-key-action="js">
  279. <a
  280. class="units-table-row-action-link data-controls js-confirm-action"
  281. href="/<?= $spnd_action ?>/web/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  282. title="<?= $spnd_action_title ?>"
  283. data-confirm-title="<?= $spnd_action_title ?>"
  284. data-confirm-message="<?= sprintf($spnd_confirmation, $key) ?>"
  285. >
  286. <i class="fas <?= $spnd_icon ?> <?= $spnd_icon_class ?>"></i>
  287. <span class="u-hide-desktop"><?= $spnd_action_title ?></span>
  288. </a>
  289. </li>
  290. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  291. <a
  292. class="units-table-row-action-link data-controls js-confirm-action"
  293. href="/delete/web/?domain=<?= $key ?>&token=<?= $_SESSION["token"] ?>"
  294. title="<?= _("Delete") ?>"
  295. data-confirm-title="<?= _("Delete") ?>"
  296. data-confirm-message="<?= sprintf(_("Are you sure you want to delete domain %s?"), $key) ?>"
  297. >
  298. <i class="fas fa-trash icon-red"></i>
  299. <span class="u-hide-desktop"><?= _("Delete") ?></span>
  300. </a>
  301. </li>
  302. <?php } ?>
  303. </ul>
  304. </div>
  305. <div class="units-table-cell u-text-center-desktop">
  306. <span class="u-hide-desktop u-text-bold"><?= _("IP Address") ?>:</span>
  307. <?= empty($ips[$data[$key]["IP"]]["NAT"]) ? $data[$key]["IP"] : "{$ips[$data[$key]["IP"]]["NAT"]}" ?>
  308. </div>
  309. <div class="units-table-cell u-text-center-desktop">
  310. <span class="u-hide-desktop u-text-bold"><?= _("Disk") ?>:</span>
  311. <span class="u-text-bold">
  312. <?= humanize_usage_size($data[$key]["U_DISK"]) ?>
  313. </span>
  314. <span class="u-text-small">
  315. <?= humanize_usage_measure($data[$key]["U_DISK"]) ?>
  316. </span>
  317. </div>
  318. <div class="units-table-cell u-text-center-desktop">
  319. <span class="u-hide-desktop u-text-bold"><?= _("Bandwidth") ?>:</span>
  320. <span class="u-text-bold">
  321. <?= humanize_usage_size($data[$key]["U_BANDWIDTH"]) ?>
  322. </span>
  323. <span class="u-text-small">
  324. <?= humanize_usage_measure($data[$key]["U_BANDWIDTH"]) ?>
  325. </span>
  326. </div>
  327. <div class="units-table-cell u-text-center-desktop">
  328. <span class="u-hide-desktop u-text-bold"><?= _("SSL") ?>:</span>
  329. <i class="fas <?= $icon_ssl ?>" title="<?= $title_ssl ?>"></i>
  330. </div>
  331. <div class="units-table-cell u-text-center-desktop">
  332. <span class="u-hide-desktop u-text-bold"><?= _("Statistics") ?>:</span>
  333. <i class="fas <?= $icon_webstats ?>" title="<?= $title_webstats ?>"></i>
  334. </div>
  335. </div>
  336. <?php } ?>
  337. </div>
  338. </div>
  339. <footer class="app-footer">
  340. <div class="container app-footer-inner">
  341. <p>
  342. <?php printf(ngettext("%d web domain", "%d web domains", $i), $i); ?>
  343. </p>
  344. </div>
  345. </footer>