list_web.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. <b>
  16. <?php if ($_SESSION['userSortOrder'] === 'name') { $label = ('Name'); } else { $label = _('Date'); } ?>
  17. <?=$label?> <i class="fas fa-arrow-down-a-z"></i>
  18. </b>
  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. <div class="units">
  70. <!-- Table header -->
  71. <div class="header units-header">
  72. <div class="l-unit__col l-unit__col--right">
  73. <div class="clearfix l-unit__stat-col--left super-compact">
  74. <input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
  75. </div>
  76. <div class="clearfix l-unit__stat-col--left wide-4"><b><?= _("Name") ?></b></div>
  77. <div class="clearfix l-unit__stat-col--left compact-4 u-text-right"><b>&nbsp;</b></div>
  78. <div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("IP Address") ?></b></div>
  79. <div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("Disk") ?></b></div>
  80. <div class="clearfix l-unit__stat-col--left u-text-center compact"><b><?= _("Bandwidth") ?></b></div>
  81. <div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("SSL") ?></b></div>
  82. <div class="clearfix l-unit__stat-col--left u-text-center compact"><b><?= _("Statistics") ?></b></div>
  83. </div>
  84. </div>
  85. <!-- Begin web domain list item loop -->
  86. <?php
  87. foreach ($data as $key => $value) {
  88. ++$i;
  89. if ($data[$key]['SUSPENDED'] == 'yes') {
  90. $status = 'suspended';
  91. $spnd_action = 'unsuspend';
  92. $spnd_action_title = _('Unsuspend');
  93. $spnd_icon = 'fa-play';
  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_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. }
  150. if ($data[$key]['SSL'] == 'yes') {
  151. $icon_ssl = 'fas fa-circle-check';
  152. }
  153. if ($web_stats == 'no') {
  154. $icon_webstats = 'fas fa-circle-xmark';
  155. } else {
  156. $icon_webstats = 'fas fa-circle-check';
  157. }
  158. } else {
  159. if ($data[$key]['SSL'] == 'no') {
  160. $icon_ssl = 'fas fa-circle-xmark icon-red';
  161. }
  162. if ($data[$key]['SSL'] == 'yes') {
  163. $icon_ssl = 'fas fa-circle-check icon-green';
  164. }
  165. if ($web_stats == 'no') {
  166. $icon_webstats = 'fas fa-circle-xmark icon-red';
  167. } else {
  168. $icon_webstats = 'fas fa-circle-check icon-green';
  169. }
  170. }
  171. ?>
  172. <div class="l-unit <?php if ($data[$key]['SUSPENDED'] == 'yes') echo 'l-unit--suspended'; ?> animate__animated animate__fadeIn js-unit"
  173. data-sort-ip="<?=str_replace('.', '', $data[$key]['IP'])?>"
  174. data-sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>"
  175. data-sort-name="<?=$key?>"
  176. data-sort-bandwidth="<?=$data[$key]['U_BANDWIDTH']?>"
  177. data-sort-disk="<?=$data[$key]['U_DISK']?>">
  178. <div class="l-unit__col l-unit__col--right">
  179. <div class="clearfix l-unit__stat-col--left super-compact">
  180. <input id="check<?=$i?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="domain[]" value="<?=$key?>" <?=$display_mode;?>>
  181. </div>
  182. <div class="clearfix l-unit__stat-col--left wide-4 truncate">
  183. <b>
  184. <?php if ($read_only === 'true') {?>
  185. <?=$key?>
  186. <?php } else {
  187. $aliases = explode(',', $data[$key]['ALIAS']);
  188. $alias_new = array();
  189. foreach($aliases as $alias){
  190. if($alias != 'www.'.$key){
  191. $alias_new[] = trim($alias);
  192. }
  193. }
  194. ?>
  195. <a href="/edit/web/?domain=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?= _("Edit Domain") ?>: <?=$key?>"><?=$key?><?php if( !empty($alias_new) && !empty($data[$key]['ALIAS']) ){ echo " <span class=\"hint\">(".implode(',',$alias_new).")"; } ?></a>
  196. <?php } ?>
  197. </b>
  198. </div>
  199. <!-- START QUICK ACTION TOOLBAR AREA -->
  200. <div class="clearfix l-unit__stat-col--left compact-4 u-text-right">
  201. <div class="l-unit-toolbar__col l-unit-toolbar__col--right u-noselect">
  202. <div class="actions-panel clearfix">
  203. <?php if (!empty($data[$key]['STATS'])) { ?>
  204. <div class="actions-panel__col actions-panel__logs shortcut-w" data-key-action="href"><a href="http://<?=$key?>/vstats/" rel="noopener" target="_blank" rel="noopener" title="<?= _("Statistics") ?>"><i class="fas fa-chart-bar icon-maroon icon-dim"></i></a></div>
  205. <?php } ?>
  206. <div class="actions-panel__col actions-panel__view" data-key-action="href"><a href="http://<?=$key?>/" rel="noopener" target="_blank"><i class="fas fa-square-up-right icon-lightblue icon-dim"></i></a></div>
  207. <?php if ($read_only === 'true') {?>
  208. <!-- Restrict ability to edit, delete, or suspend web domains when impersonating the 'admin' account -->
  209. &nbsp;
  210. <?php } else { ?>
  211. <?php if ($data[$key]['SUSPENDED'] == 'no') {?>
  212. <div class="actions-panel__col actions-panel__edit shortcut-enter" data-key-action="href"><a href="/edit/web/?domain=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?= _("Edit Domain") ?>"><i class="fas fa-pencil icon-orange icon-dim"></i></a></div>
  213. <?php } ?>
  214. <div class="actions-panel__col actions-panel__logs shortcut-l" data-key-action="href"><a href="/list/web-log/?domain=<?=$key?>&type=access#" title="<?= _("Access Log") ?>"><i class="fas fa-binoculars icon-purple icon-dim"></i></a></div>
  215. <div class="actions-panel__col actions-panel__suspend shortcut-s" data-key-action="js">
  216. <a
  217. class="data-controls js-confirm-action"
  218. href="/<?=$spnd_action?>/web/?domain=<?=$key?>&token=<?=$_SESSION['token']?>"
  219. data-confirm-title="<?= $spnd_action_title ?>"
  220. data-confirm-message="<?= sprintf($spnd_confirmation, $key) ?>"
  221. >
  222. <i class="fas <?= $spnd_icon ?> icon-highlight icon-dim"></i>
  223. </a>
  224. </div>
  225. <div class="actions-panel__col actions-panel__delete shortcut-delete" data-key-action="js">
  226. <a
  227. class="data-controls js-confirm-action"
  228. href="/delete/web/?domain=<?=$key?>&token=<?=$_SESSION['token']?>"
  229. data-confirm-title="<?= _("Delete") ?>"
  230. data-confirm-message="<?= sprintf(_('Are you sure you want to delete domain %s?'), $key) ?>"
  231. >
  232. <i class="fas fa-trash icon-red icon-dim"></i>
  233. </a>
  234. </div>
  235. <?php } ?>
  236. </div>
  237. </div>
  238. </div>
  239. <!-- END QUICK ACTION TOOLBAR AREA -->
  240. <div class="clearfix l-unit__stat-col--left u-text-center"><?=empty($ips[$data[$key]['IP']]['NAT']) ? $data[$key]['IP'] : "{$ips[$data[$key]['IP']]['NAT']}"; ?></div>
  241. <div class="clearfix l-unit__stat-col--left u-text-center"><b><?=humanize_usage_size($data[$key]['U_DISK'])?></b> <span class="u-text-small"><?=humanize_usage_measure($data[$key]['U_DISK'])?></span></div>
  242. <div class="clearfix l-unit__stat-col--left u-text-center compact"><b><?=humanize_usage_size($data[$key]['U_BANDWIDTH'])?></b> <span class="u-text-small"><?=humanize_usage_measure($data[$key]['U_BANDWIDTH'])?></span></div>
  243. <div class="clearfix l-unit__stat-col--left u-text-center">
  244. <i class="fas <?=$icon_ssl;?>"></i>
  245. </div>
  246. <div class="clearfix l-unit__stat-col--left u-text-center compact">
  247. <i class="fas <?=$icon_webstats;?>"></i>
  248. </div>
  249. </div>
  250. </div>
  251. <?php } ?>
  252. </div>
  253. </div>
  254. <footer class="app-footer">
  255. <div class="container app-footer-inner">
  256. <p>
  257. <?php printf(ngettext("%d web domain", "%d web domains", $i), $i); ?>
  258. </p>
  259. </div>
  260. </footer>