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" 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 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 units">
  69. <!-- Table header -->
  70. <div class="header table-header">
  71. <div class="l-unit__col l-unit__col--right">
  72. <div class="clearfix l-unit__stat-col--left super-compact">
  73. <input type="checkbox" class="js-toggle-all" title="<?= _("Select all") ?>" <?= $display_mode ?>>
  74. </div>
  75. <div class="clearfix l-unit__stat-col--left wide-4"><b><?= _("Name") ?></b></div>
  76. <div class="clearfix l-unit__stat-col--left compact-4 u-text-right"><b>&nbsp;</b></div>
  77. <div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("IP Address") ?></b></div>
  78. <div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("Disk") ?></b></div>
  79. <div class="clearfix l-unit__stat-col--left u-text-center compact"><b><?= _("Bandwidth") ?></b></div>
  80. <div class="clearfix l-unit__stat-col--left u-text-center"><b><?= _("SSL") ?></b></div>
  81. <div class="clearfix l-unit__stat-col--left u-text-center compact"><b><?= _("Statistics") ?></b></div>
  82. </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_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_confirmation = _('Are you sure you want to suspend domain %s?');
  100. }
  101. if (!empty($data[$key]['SSL_HOME'])) {
  102. if ($data[$key]['SSL_HOME'] == 'same') {
  103. $ssl_home = 'public_html';
  104. } else {
  105. $ssl_home = 'public_shtml';
  106. }
  107. } else {
  108. $ssl_home = '';
  109. }
  110. $web_stats='no';
  111. if (!empty($data[$key]['STATS'])) {
  112. $web_stats=$data[$key]['STATS'];
  113. }
  114. $ftp_user='no';
  115. if (!empty($data[$key]['FTP_USER'])) {
  116. $ftp_user=$data[$key]['FTP_USER'];
  117. }
  118. if (strlen($ftp_user) > 24 ) {
  119. $ftp_user = str_replace(':', ', ', $ftp_user);
  120. $ftp_user = substr($ftp_user, 0, 24);
  121. $ftp_user = trim($ftp_user, ":");
  122. $ftp_user = str_replace(':', ', ', $ftp_user);
  123. $ftp_user = $ftp_user.", ...";
  124. } else {
  125. $ftp_user = str_replace(':', ', ', $ftp_user);
  126. }
  127. $backend_support='no';
  128. if (!empty($data[$key]['BACKEND'])) {
  129. $backend_support='yes';
  130. }
  131. $proxy_support='no';
  132. if (!empty($data[$key]['PROXY'])) {
  133. $proxy_support='yes';
  134. }
  135. if (strlen($data[$key]['PROXY_EXT']) > 24 ) {
  136. $proxy_ext_title = str_replace(',', ', ', $data[$key]['PROXY_EXT']);
  137. $proxy_ext = substr($data[$key]['PROXY_EXT'], 0, 24);
  138. $proxy_ext = trim($proxy_ext, ",");
  139. $proxy_ext = str_replace(',', ', ', $proxy_ext);
  140. $proxy_ext = $proxy_ext.", ...";
  141. } else {
  142. $proxy_ext_title = '';
  143. $proxy_ext = str_replace(',', ', ', $data[$key]['PROXY_EXT']);
  144. }
  145. if ($data[$key]['SUSPENDED'] === 'yes') {
  146. if ($data[$key]['SSL'] == 'no') {
  147. $icon_ssl = 'fas fa-circle-xmark';
  148. }
  149. if ($data[$key]['SSL'] == 'yes') {
  150. $icon_ssl = 'fas fa-circle-check';
  151. }
  152. if ($web_stats == 'no') {
  153. $icon_webstats = 'fas fa-circle-xmark';
  154. } else {
  155. $icon_webstats = 'fas fa-circle-check';
  156. }
  157. } else {
  158. if ($data[$key]['SSL'] == 'no') {
  159. $icon_ssl = 'fas fa-circle-xmark icon-red';
  160. }
  161. if ($data[$key]['SSL'] == 'yes') {
  162. $icon_ssl = 'fas fa-circle-check icon-green';
  163. }
  164. if ($web_stats == 'no') {
  165. $icon_webstats = 'fas fa-circle-xmark icon-red';
  166. } else {
  167. $icon_webstats = 'fas fa-circle-check icon-green';
  168. }
  169. }
  170. ?>
  171. <div class="l-unit <?php if ($data[$key]['SUSPENDED'] == 'yes') echo 'l-unit--suspended';?> animate__animated animate__fadeIn"
  172. id="web-unit-<?=$i?>"
  173. sort-ip="<?=str_replace('.', '', $data[$key]['IP'])?>"
  174. sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>"
  175. sort-name="<?=$key?>" sort-bandwidth="<?=$data[$key]['U_BANDWIDTH']?>"
  176. sort-disk="<?=$data[$key]['U_DISK']?>">
  177. <div class="l-unit__col l-unit__col--right">
  178. <div class="clearfix l-unit__stat-col--left super-compact">
  179. <input id="check<?=$i?>" class="ch-toggle" type="checkbox" title="<?= _("Select") ?>" name="domain[]" value="<?=$key?>" <?=$display_mode;?>>
  180. </div>
  181. <div class="clearfix l-unit__stat-col--left wide-4 truncate">
  182. <b>
  183. <?php if ($read_only === 'true') {?>
  184. <?=$key?>
  185. <?php } else {
  186. $aliases = explode(',', $data[$key]['ALIAS']);
  187. $alias_new = array();
  188. foreach($aliases as $alias){
  189. if($alias != 'www.'.$key){
  190. $alias_new[] = trim($alias);
  191. }
  192. }
  193. ?>
  194. <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>
  195. <?php } ?>
  196. </b>
  197. </div>
  198. <!-- START QUICK ACTION TOOLBAR AREA -->
  199. <div class="clearfix l-unit__stat-col--left compact-4 u-text-right">
  200. <div class="l-unit-toolbar__col l-unit-toolbar__col--right u-noselect">
  201. <div class="actions-panel clearfix">
  202. <?php if (!empty($data[$key]['STATS'])) { ?>
  203. <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>
  204. <?php } ?>
  205. <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>
  206. <?php if ($read_only === 'true') {?>
  207. <!-- Restrict ability to edit, delete, or suspend web domains when impersonating the 'admin' account -->
  208. &nbsp;
  209. <?php } else { ?>
  210. <?php if ($data[$key]['SUSPENDED'] == 'no') {?>
  211. <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>
  212. <?php } ?>
  213. <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>
  214. <div class="actions-panel__col actions-panel__suspend shortcut-s" data-key-action="js">
  215. <a
  216. class="data-controls js-confirm-action"
  217. href="/<?=$spnd_action?>/web/?domain=<?=$key?>&token=<?=$_SESSION['token']?>"
  218. data-confirm-title="<?= $spnd_action_title ?>"
  219. data-confirm-message="<?= sprintf($spnd_confirmation, $key) ?>"
  220. >
  221. <i class="fas <?= $spnd_icon ?> icon-highlight icon-dim"></i>
  222. </a>
  223. </div>
  224. <div class="actions-panel__col actions-panel__delete shortcut-delete" data-key-action="js">
  225. <a
  226. class="data-controls js-confirm-action"
  227. href="/delete/web/?domain=<?=$key?>&token=<?=$_SESSION['token']?>"
  228. data-confirm-title="<?= _("Delete") ?>"
  229. data-confirm-message="<?= sprintf(_('Are you sure you want to delete domain %s?'), $key) ?>"
  230. >
  231. <i class="fas fa-trash icon-red icon-dim"></i>
  232. </a>
  233. </div>
  234. <?php } ?>
  235. </div>
  236. </div>
  237. </div>
  238. <!-- END QUICK ACTION TOOLBAR AREA -->
  239. <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>
  240. <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>
  241. <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>
  242. <div class="clearfix l-unit__stat-col--left u-text-center">
  243. <i class="fas <?=$icon_ssl;?>"></i>
  244. </div>
  245. <div class="clearfix l-unit__stat-col--left u-text-center compact">
  246. <i class="fas <?=$icon_webstats;?>"></i>
  247. </div>
  248. </div>
  249. </div>
  250. <?php } ?>
  251. </div>
  252. </div>
  253. <footer class="app-footer">
  254. <div class="container app-footer-inner">
  255. <p>
  256. <?php printf(ngettext("%d web domain", "%d web domains", $i), $i); ?>
  257. </p>
  258. </div>
  259. </footer>