forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_packages.php
More file actions
223 lines (220 loc) · 11.5 KB
/
list_packages.php
File metadata and controls
223 lines (220 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!-- Begin toolbar -->
<div class="toolbar">
<div class="toolbar-inner">
<div class="toolbar-buttons">
<a class="button button-secondary" id="btn-back" href="/list/user/"><i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?></a>
<a href="/add/package/" class="button button-secondary" id="btn-create"><i class="fas fa-circle-plus icon-green"></i><?= _("Add Package") ?></a>
</div>
<div class="toolbar-right">
<div class="toolbar-sorting">
<button class="toolbar-sorting-toggle" type="button" title="<?= _("Sort items") ?>">
<?= _("sort by") ?>:
<b>
<?php if ($_SESSION['userSortOrder'] === 'name') { $label = _('Name'); } else { $label = _('Date'); } ?>
<?=$label;?> <i class="fas fa-arrow-down-a-z"></i>
</b>
</button>
<ul class="toolbar-sorting-menu animate__animated animate__fadeIn u-hidden">
<li entity="sort-date" sort_as_int="1"><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></li>
<li entity="sort-name"><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></li>
</ul>
<form x-data x-bind="BulkEdit" action="/bulk/package/" method="post">
<input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
<select class="form-select" name="action">
<option value=""><?= _("apply to selected") ?></option>
<option value="delete"><?= _("delete") ?></option>
</select>
<button type="submit" class="toolbar-input-submit" title="<?= _("apply to selected") ?>">
<i class="fas fa-arrow-right"></i>
</button>
</form>
</div>
</div>
</div>
</div>
<!-- End toolbar -->
<div class="container units">
<div class="table-header">
<div class="l-unit__col l-unit__col--right">
<div class="clearfix l-unit__stat-col--left super-compact">
<input type="checkbox" class="js-toggle-all" title="<?= _("Select all") ?>">
</div>
<div class="clearfix l-unit__stat-col--left wide"><b><?= _("Package") ?></b></div>
<div class="clearfix l-unit__stat-col--left compact-3 u-text-right"><b> </b></div>
<div class="clearfix l-unit__stat-col--left u-text-center compact"><b><i class="fas fa-terminal" title="<?= _("Shell") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center compact-2"><b><i class="fas fa-hard-drive" title="<?= _("Quota") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center compact-2"><b><i class="fas fa-right-left" title="<?= _("Bandwidth") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-earth-americas" title="<?= _("Web Domains") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-link" title="<?= _("Web Aliases") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-book-atlas" title="<?= _("DNS Domains") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-globe" title="<?= _("DNS Records") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-envelopes-bulk" title="<?= _("Mail Domains") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-inbox" title="<?= _("Mail Accounts") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-database" title="<?= _("Databases") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-clock" title="<?= _("Cron Jobs") ?>"></i></b></div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact"><b><i class="fas fa-file-zipper" title="<?= _("Backups") ?>"></i></b></div>
</div>
</div>
<!-- Begin package list item loop -->
<?php
foreach ($data as $key => $value) {
++$i;
?>
<div class="l-unit animate__animated animate__fadeIn" v_section="user"
v_unit_id="<?=$key?>" sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>" sort-name="<?=$key?>"
sort-bandwidth="<?=$data[$key]['BANDWIDTH']?>" sort-disk="<?=$data[$key]['DISK_QUOTA']?>">
<div class="l-unit__col l-unit__col--right">
<div class="clearfix l-unit__stat-col--left super-compact">
<input id="check<?=$i?>" class="ch-toggle" type="checkbox" title="<?= _("Select") ?>" name="package[]" value="<?=$key?>">
</div>
<?php if ($key == 'system'){ ?>
<div class="clearfix l-unit__stat-col--left wide truncate"><b><?=$key?></b></div>
<?php } else { ?>
<div class="clearfix l-unit__stat-col--left wide truncate">
<b><a href="/edit/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?= _("Editing Package") ?>: <?=$key?>"><?=$key?></a></b>
</div>
<?php } ?>
<!-- START QUICK ACTION TOOLBAR AREA -->
<div class="clearfix l-unit__stat-col--left u-text-right compact-3">
<div class="l-unit-toolbar__col l-unit-toolbar__col--right u-noselect">
<div class="actions-panel clearfix">
<?php if (($key == 'system')) { ?>
<!-- Restrict editing system package -->
<?php } else {?>
<div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href"><a href="/edit/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?= _("Editing Package") ?>"><i class="fas fa-pencil icon-orange icon-dim"></i></a></div>
<?php } ?>
<div class="actions-panel__col actions-panel__edit" key-action="href"><a href="/copy/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?= _("Copy") ?>"><i class="fas fa-clone icon-teal icon-dim"></i></a></div>
<?php if ($key == 'system') { ?>
<!-- Restrict deleting system package -->
<?php } else {?>
<div class="actions-panel__col actions-panel__delete shortcut-delete" key-action="js">
<a id="delete_link_<?=$i?>" class="data-controls do_delete" title="<?= _("Delete") ?>">
<i class="fas fa-trash icon-red icon-dim do_delete"></i>
<input type="hidden" name="delete_url" value="/delete/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>">
</a>
<dialog id="delete_dialog_<?= $i ?>" class="modal js-confirm-dialog-delete">
<p><?=sprintf(_('DELETE_PACKAGE_CONFIRMATION'),$key)?></p>
</dialog>
</div>
<?php } ?>
</div>
</div>
</div>
<!-- END QUICK ACTION TOOLBAR AREA -->
<div class="clearfix l-unit__stat-col--left u-text-center compact">
<?php if ($data[$key]["SHELL"] == "nologin") { ?>
<i class="fas fa-circle-minus icon-large" title="<?= _("SSH Access") ?>: <?= $data[$key]["SHELL"] ?>"> </i>
<?php } else { ?>
<i class="fas fa-circle-check icon-green icon-large"></i>
<?php } ?>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center compact-2">
<span title="<?= _("Quota") ?>: <?= humanize_usage_size($data[$key]["DISK_QUOTA"]) ?> <?= humanize_usage_measure($data[$key]["DISK_QUOTA"]) ?>">
<?php if (preg_match("/[a-z]/i", $data[$key]["DISK_QUOTA"])): ?>
<b>∞</b>
<?php else: ?>
<b><?= humanize_usage_size($data[$key]["DISK_QUOTA"]) ?></b> <span class="u-text-small"><?= humanize_usage_measure($data[$key]["DISK_QUOTA"]) ?></span>
<?php endif; ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center compact-2">
<span title="<?= _("Bandwidth") ?>: <?= humanize_usage_size($data[$key]["BANDWIDTH"]) ?> <?= humanize_usage_measure($data[$key]["BANDWIDTH"]) ?>">
<?php if ($data[$key]["BANDWIDTH"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= humanize_usage_size($data[$key]["BANDWIDTH"]) ?></b> <span class="u-text-small"><?= humanize_usage_measure($data[$key]["BANDWIDTH"]) ?></span>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("Web Domains") ?>: <?= $data[$key]["WEB_DOMAINS"] ?>">
<?php if ($data[$key]["WEB_DOMAINS"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["WEB_DOMAINS"] ?></b>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("Web Aliases") ?>: <?= $data[$key]["WEB_ALIASES"] ?>">
<?php if ($data[$key]["WEB_ALIASES"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["WEB_ALIASES"] ?></b>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("DNS Domains") ?>: <?= $data[$key]["DNS_DOMAINS"] ?>">
<?php if ($data[$key]["DNS_DOMAINS"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["DNS_DOMAINS"] ?></b>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("DNS Records") ?>: <?= $data[$key]["DNS_RECORDS"] ?>">
<?php if ($data[$key]["DNS_RECORDS"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["DNS_RECORDS"] ?></b>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("Mail Domains") ?>: <?= $data[$key]["MAIL_DOMAINS"] ?>">
<?php if ($data[$key]["MAIL_DOMAINS"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["MAIL_DOMAINS"] ?></b>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("Mail Accounts") ?>: <?= $data[$key]["MAIL_ACCOUNTS"] ?>">
<?php if ($data[$key]["MAIL_ACCOUNTS"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["MAIL_ACCOUNTS"] ?></b>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("Databases") ?>: <?= $data[$key]["DATABASES"] ?>">
<?php if ($data[$key]["DATABASES"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["DATABASES"] ?></b>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("Cron Jobs") ?>: <?= $data[$key]["CRON_JOBS"] ?>">
<?php if ($data[$key]["CRON_JOBS"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["CRON_JOBS"] ?></b>
<?php } ?>
</span>
</div>
<div class="clearfix l-unit__stat-col--left u-text-center super-compact">
<span class="badge" title="<?= _("Backups") ?>: <?= $data[$key]["BACKUPS"] ?>">
<?php if ($data[$key]["BACKUPS"] == "unlimited") { ?>
<b>∞</b>
<?php } else { ?>
<b><?= $data[$key]["BACKUPS"] ?></b>
<?php } ?>
</span>
</div>
</div>
</div>
<?php } ?>
</div>
<footer class="app-footer">
<div class="container app-footer-inner">
<p>
<?php printf(ngettext("%d package", "%d packages", $i), $i); ?>
</p>
</div>
</footer>