blob: f2d6cfb47b77ff6ffcdf505360e6188e5e5b5de7 [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
3
4if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admin") {
5require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
6$_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
7$tfa_data = get_tfa();
8$fido2_data = fido2(array("action" => "get_friendly_names"));
9if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CACHE')) {
10 $_SESSION['gal'] = json_decode($license_cache, true);
11}
12?>
13<div class="container">
14
15 <ul class="nav nav-tabs" role="tablist">
16 <li role="presentation" class="active"><a href="#tab-access" aria-controls="tab-access" role="tab" data-toggle="tab"><?=$lang['admin']['access'];?></a></li>
17 <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['admin']['configuration'];?>
18 <span class="caret"></span></a>
19 <ul class="dropdown-menu">
20 <li role="presentation"><a href="#tab-config-dkim" aria-controls="tab-config-dkim" role="tab" data-toggle="tab"><?=$lang['admin']['dkim_keys'];?></a></li>
21 <li role="presentation"><a href="#tab-config-fwdhosts" aria-controls="tab-config-fwdhosts" role="tab" data-toggle="tab"><?=$lang['admin']['forwarding_hosts'];?></a></li>
22 <li role="presentation"><a href="#tab-config-f2b" aria-controls="tab-config-f2b" role="tab" data-toggle="tab"><?=$lang['admin']['f2b_parameters'];?></a></li>
23 <li role="presentation"><a href="#tab-config-quarantine" aria-controls="tab-config-quarantine" role="tab" data-toggle="tab"><?=$lang['admin']['quarantine'];?></a></li>
24 <li role="presentation"><a href="#tab-config-quota" aria-controls="tab-config-quota" role="tab" data-toggle="tab"><?=$lang['admin']['quota_notifications'];?></a></li>
25 <li role="presentation"><a href="#tab-config-rsettings" aria-controls="tab-config-rsettings" role="tab" data-toggle="tab"><?=$lang['admin']['rspamd_settings_map'];?></a></li>
26 <li role="presentation"><a href="#tab-config-customize" aria-controls="tab-config-customize" role="tab" data-toggle="tab"><?=$lang['admin']['customize'];?></a></li>
27 </ul>
28 </li>
29 <li role="presentation"><a href="#tab-routing" aria-controls="tab-routing" role="tab" data-toggle="tab"><?=$lang['admin']['routing'];?></a></li>
30 <li role="presentation"><a href="#tab-sys-mails" aria-controls="tab-sys-mails" role="tab" data-toggle="tab"><?=$lang['admin']['sys_mails'];?></a></li>
31 <li role="presentation"><a href="#tab-mailq" aria-controls="tab-mailq" role="tab" data-toggle="tab"><?=$lang['admin']['queue_manager'];?></a></li>
32 <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['admin']['rspamd_global_filters'];?>
33 <span class="caret"></span></a>
34 <ul class="dropdown-menu">
35 <li role="presentation"><a href="#tab-globalfilter-regex" aria-controls="tab-globalfilter-regex" role="tab" data-toggle="tab"><?=$lang['admin']['regex_maps'];?></a></li>
36 </ul>
37 </li>
38 </ul>
39
40 <div class="row">
41 <div class="col-md-12">
42 <div class="tab-content" style="padding-top:20px">
43 <div role="tabpanel" class="tab-pane active" id="tab-access">
44 <div class="panel panel-danger">
45 <div class="panel-heading"><?=$lang['admin']['admin_details'];?></div>
46 <div class="panel-body">
47 <div class="table-responsive">
48 <table class="table table-striped table-condensed" id="adminstable"></table>
49 </div>
50 <div class="mass-actions-admin">
51 <div class="btn-group">
52 <a class="btn btn-sm btn-default" id="toggle_multi_select_all" data-id="admins" href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></a>
53 <a class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
54 <ul class="dropdown-menu">
55 <li><a data-action="edit_selected" data-id="admins" data-api-url='edit/admin' data-api-attr='{"active":"1"}' href="#"><?=$lang['mailbox']['activate'];?></a></li>
56 <li><a data-action="edit_selected" data-id="admins" data-api-url='edit/admin' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
57 <li role="separator" class="divider"></li>
58 <li><a data-action="edit_selected" data-id="admins" data-api-url='edit/admin' data-api-attr='{"disable_tfa":"1"}' href="#"><?=$lang['tfa']['disable_tfa'];?></a></li>
59 <li role="separator" class="divider"></li>
60 <li><a data-action="delete_selected" data-id="admins" data-api-url='delete/admin' href="#"><?=$lang['mailbox']['remove'];?></a></li>
61 </ul>
62 <a class="btn btn-sm btn-success" data-id="add_admin" data-toggle="modal" data-target="#addAdminModal" href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['admin']['add_admin'];?></a>
63 </div>
64 </div>
65
66 <? // TFA ?>
67 <legend style="margin-top:20px">
68 <?=$lang['tfa']['tfa'];?>
69 </legend>
70 <div class="row">
71 <div class="col-sm-3 col-xs-5 text-right"><?=$lang['tfa']['tfa'];?>:</div>
72 <div class="col-sm-9 col-xs-7">
73 <p id="tfa_pretty"><?=$tfa_data['pretty'];?></p>
74 <div id="tfa_keys">
75 <?php
76 if (!empty($tfa_data['additional'])) {
77 foreach ($tfa_data['additional'] as $key_info) {
78 ?>
79 <form style="display:inline;" method="post">
80 <input type="hidden" name="unset_tfa_key" value="<?=$key_info['id'];?>" />
81 <div style="padding:4px;margin:4px" class="label label-keys label-<?=($_SESSION['tfa_id'] == $key_info['id']) ? 'success' : 'default'; ?>">
82 <?=$key_info['key_id'];?>
83 <a href="#" style="font-weight:bold;color:white" onClick="$(this).closest('form').submit()">[<?=strtolower($lang['admin']['remove']);?>]</a>
84 </div>
85 </form>
86 <?php
87 }
88 }
89 ?>
90 </div>
91 <br>
92 </div>
93 </div>
94 <div class="row">
95 <div class="col-sm-3 col-xs-5 text-right"><?=$lang['tfa']['set_tfa'];?>:</div>
96 <div class="col-sm-9 col-xs-7">
97 <select data-style="btn btn-sm dropdown-toggle bs-placeholder btn-default" data-width="fit" id="selectTFA" class="selectpicker" title="<?=$lang['tfa']['select'];?>">
98 <option value="yubi_otp"><?=$lang['tfa']['yubi_otp'];?></option>
99 <option value="u2f"><?=$lang['tfa']['u2f'];?></option>
100 <option value="totp"><?=$lang['tfa']['totp'];?></option>
101 <option value="none"><?=$lang['tfa']['none'];?></option>
102 </select>
103 </div>
104 </div>
105
106 <? // FIDO2 ?>
107 <legend style="margin-top:20px">
108 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="margin-bottom: -5px;">
109 <path d="M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2-.13-.24-.04-.55.2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67-.09.18-.26.28-.44.28zM3.5 9.72c-.1 0-.2-.03-.29-.09-.23-.16-.28-.47-.12-.7.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25.16.22.11.54-.12.7-.23.16-.54.11-.7-.12-.9-1.26-2.04-2.25-3.39-2.94-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21zm6.25 12.07c-.13 0-.26-.05-.35-.15-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39-2.57 0-4.66 1.97-4.66 4.39 0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15zm7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12zM14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1-1.4-1.39-2.17-3.24-2.17-5.22 0-1.62 1.38-2.94 3.08-2.94 1.7 0 3.08 1.32 3.08 2.94 0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29-.49-1.31-.73-2.61-.73-3.96 0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38z"/>
110 </svg>
111 <?=$lang['fido2']['fido2_auth'];?></legend>
112 <div class="row">
113 <div class="col-sm-3 col-xs-5 text-right"><?=$lang['fido2']['known_ids'];?>:</div>
114 <div class="col-sm-9 col-xs-7">
115 <div class="table-responsive">
116 <table class="table table-striped table-hover table-condensed" id="fido2_keys">
117 <tr>
118 <th>ID</th>
119 <th style="min-width:240px;text-align: right"><?=$lang['admin']['action'];?></th>
120 </tr>
121 <?php
122 if (!empty($fido2_data)) {
123 foreach ($fido2_data as $key_info) {
124 ?>
125 <tr>
126 <td>
127 <?=($_SESSION['fido2_cid'] == $key_info['cid']) ? '→ ' : NULL; ?><?=(!empty($key_info['fn']))?$key_info['fn']:$key_info['subject'];?>
128 </td>
129 <td style="min-width:240px;text-align: right">
130 <form style="display:inline;" method="post">
131 <input type="hidden" name="unset_fido2_key" value="<?=$key_info['cid'];?>" />
132 <div class="btn-group">
133 <a href="#" class="btn btn-xs btn-default" data-cid="<?=$key_info['cid'];?>" data-subject="<?=base64_encode($key_info['subject']);?>" data-toggle="modal" data-target="#fido2ChangeFn"><span class="glyphicon glyphicon-pencil"></span> <?=strtolower($lang['fido2']['rename']);?></a>
134 <a href="#" onClick='return confirm("<?=$lang['admin']['ays'];?>")?$(this).closest("form").submit():"";' class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> <?=strtolower($lang['admin']['remove']);?></a>
135 </form>
136 </div>
137 </td>
138 </tr>
139 <?php
140 }
141 }
142 ?>
143 </table>
144 </div>
145 <br>
146 </div>
147 </div>
148 <div class="row">
149 <div class="col-sm-offset-3 col-sm-9">
150 <button class="btn btn-sm btn-primary" id="register-fido2"><?=$lang['fido2']['set_fido2'];?></button>
151 </div>
152 </div>
153 <br>
154 <div class="row" id="status-fido2">
155 <div class="col-sm-3 col-xs-5 text-right"><?=$lang['fido2']['register_status'];?>:</div>
156 <div class="col-sm-9 col-xs-7">
157 <div id="fido2-alerts">-</div>
158 </div>
159 <br>
160 </div>
161
162 <legend style="cursor:pointer;margin-top:40px" data-target="#license" class="arrow-toggle" unselectable="on" data-toggle="collapse">
163 <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> <?=$lang['admin']['guid_and_license'];?>
164 </legend>
165 <div id="license" class="collapse">
166 <form class="form-horizontal" autocapitalize="none" autocorrect="off" role="form" method="post">
167 <div class="form-group">
168 <label class="control-label col-sm-3" for="guid"><?=$lang['admin']['guid'];?>:</label>
169 <div class="col-sm-9">
170 <div class="input-group">
171 <span class="input-group-addon">
172 <span class="glyphicon <?=(isset($_SESSION['gal']['valid']) && $_SESSION['gal']['valid'] === "true") ? 'glyphicon-heart text-danger' : 'glyphicon-remove';?>" aria-hidden="true"></span>
173 </span>
174 <input type="text" id="guid" class="form-control" value="<?=license('guid');?>" readonly>
175 </div>
176 <p class="help-block">
177 <?=$lang['admin']['customer_id'];?>: <?=(isset($_SESSION['gal']['c'])) ? $_SESSION['gal']['c'] : '?';?> -
178 <?=$lang['admin']['service_id'];?>: <?=(isset($_SESSION['gal']['s'])) ? $_SESSION['gal']['s'] : '?';?> -
179 <?=$lang['admin']['sal_level'];?>: <?=(isset($_SESSION['gal']['m'])) ? $_SESSION['gal']['m'] : '?';?>
180 </p>
181 </div>
182 </div>
183 <div class="form-group">
184 <div class="col-sm-offset-3 col-sm-9">
185 <p class="help-block"><?=$lang['admin']['license_info'];?></p>
186 <div class="btn-group">
187 <button class="btn btn-sm btn-success" name="license_validate_now" type="submit" href="#"><?=$lang['admin']['validate_license_now'];?></button>
188 </div>
189 </div>
190 </div>
191 </form>
192 </div>
193
194 <legend style="cursor:pointer;" data-target="#admin_api" class="arrow-toggle" unselectable="on" data-toggle="collapse">
195 <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> API
196 </legend>
197 <div id="admin_api" class="collapse">
198 <div class="row">
199 <?php
200 $api_ro = admin_api('ro', 'get');
201 $api_rw = admin_api('rw', 'get');
202 ?>
203 <div class="col-lg-12">
204 <p class="help-block"><?=$lang['admin']['api_info'];?></p>
205 </div>
206 <div class="col-lg-6">
207 <div class="panel panel-default">
208 <div class="panel-heading">
209 <h4 class="panel-title">⇇ Read-Only Access</h4>
210 </div>
211 <div class="panel-body">
212 <form class="form-horizontal" autocapitalize="none" autocorrect="off" role="form" method="post">
213 <div class="form-group">
214 <label class="control-label col-sm-3" for="allow_from_ro"><?=$lang['admin']['api_allow_from'];?>:</label>
215 <div class="col-sm-9">
216 <textarea class="form-control textarea-code" rows="7" name="allow_from" id="allow_from_ro" <?=($api_ro['skip_ip_check'] == 1) ? 'disabled' : null;?> required><?=htmlspecialchars($api_ro['allow_from']);?></textarea>
217 </div>
218 </div>
219 <div class="form-group">
220 <div class="col-sm-offset-3 col-sm-9">
221 <label>
222 <input type="checkbox" name="skip_ip_check" id="skip_ip_check_ro" <?=($api_ro['skip_ip_check'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['api_skip_ip_check'];?>
223 </label>
224 </div>
225 </div>
226 <div class="form-group">
227 <label class="control-label col-sm-3"><?=$lang['admin']['api_key'];?>:</label>
228 <div class="col-sm-9">
229 <pre><?=(empty($api_ro['api_key'])) ? '-' : htmlspecialchars($api_ro['api_key']);?></pre>
230 </div>
231 </div>
232 <div class="form-group">
233 <div class="col-sm-offset-3 col-sm-9">
234 <label>
235 <input type="checkbox" name="active" <?=($api_ro['active'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['activate_api'];?>
236 </label>
237 </div>
238 </div>
239 <div class="form-group">
240 <div class="col-sm-offset-3 col-sm-9">
241 <div class="btn-group">
242 <button class="btn btn-sm btn-success" name="admin_api[ro]" type="submit" href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
243 <button class="btn btn-sm btn-default admin-ays-dialog" name="admin_api_regen_key[ro]" type="submit" href="#" <?=(!empty($api_ro['api_key'])) ?: 'disabled';?>><?=$lang['admin']['regen_api_key'];?></button>
244 </div>
245 </div>
246 </div>
247 </form>
248 </div>
249 </div>
250 </div>
251 <div class="col-lg-6">
252 <div class="panel panel-default">
253 <div class="panel-heading">
254 <h4 class="panel-title">⇄ Read-Write Access</h4>
255 </div>
256 <div class="panel-body">
257 <form class="form-horizontal" autocapitalize="none" autocorrect="off" role="form" method="post">
258 <div class="form-group">
259 <label class="control-label col-sm-3" for="allow_from_rw"><?=$lang['admin']['api_allow_from'];?>:</label>
260 <div class="col-sm-9">
261 <textarea class="form-control textarea-code" rows="7" name="allow_from" id="allow_from_rw" <?=($api_rw['skip_ip_check'] == 1) ? 'disabled' : null;?> required><?=htmlspecialchars($api_rw['allow_from']);?></textarea>
262 </div>
263 </div>
264 <div class="form-group">
265 <div class="col-sm-offset-3 col-sm-9">
266 <label>
267 <input type="checkbox" name="skip_ip_check" id="skip_ip_check_rw" <?=($api_rw['skip_ip_check'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['api_skip_ip_check'];?>
268 </label>
269 </div>
270 </div>
271 <div class="form-group">
272 <label class="control-label col-sm-3" for="admin_api_key"><?=$lang['admin']['api_key'];?>:</label>
273 <div class="col-sm-9">
274 <pre><?=(empty($api_rw['api_key'])) ? '-' : htmlspecialchars($api_rw['api_key']);?></pre>
275 </div>
276 </div>
277 <div class="form-group">
278 <div class="col-sm-offset-3 col-sm-9">
279 <label>
280 <input type="checkbox" name="active" <?=($api_rw['active'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['activate_api'];?>
281 </label>
282 </div>
283 </div>
284 <div class="form-group">
285 <div class="col-sm-offset-3 col-sm-9">
286 <div class="btn-group">
287 <button class="btn btn-sm btn-success" name="admin_api[rw]" type="submit" href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
288 <button class="btn btn-sm btn-default admin-ays-dialog" name="admin_api_regen_key[rw]" type="submit" <?=(!empty($api_rw['api_key'])) ?: 'disabled';?> href="#"><?=$lang['admin']['regen_api_key'];?></button>
289 </div>
290 </div>
291 </div>
292 </form>
293 </div>
294 </div>
295 </div>
296 </div>
297 </div>
298 </div>
299 </div>
300
301 <div class="panel panel-default">
302 <div class="panel-heading"><?=$lang['admin']['domain_admins'];?></div>
303 <div class="panel-body">
304 <div class="table-responsive">
305 <table class="table table-striped table-condensed" id="domainadminstable"></table>
306 </div>
307 <div class="mass-actions-admin">
308 <div class="btn-group">
309 <a class="btn btn-sm btn-default" id="toggle_multi_select_all" data-id="domain_admins" href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></a>
310 <a class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
311 <ul class="dropdown-menu">
312 <li><a data-action="edit_selected" data-id="domain_admins" data-api-url='edit/domain-admin' data-api-attr='{"active":"1"}' href="#"><?=$lang['mailbox']['activate'];?></a></li>
313 <li><a data-action="edit_selected" data-id="domain_admins" data-api-url='edit/domain-admin' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
314 <li role="separator" class="divider"></li>
315 <li><a data-action="edit_selected" data-id="domain_admins" data-api-url='edit/domain-admin' data-api-attr='{"disable_tfa":"1"}' href="#"><?=$lang['tfa']['disable_tfa'];?></a></li>
316 <li role="separator" class="divider"></li>
317 <li><a data-action="delete_selected" data-id="domain_admins" data-api-url='delete/domain-admin' href="#"><?=$lang['mailbox']['remove'];?></a></li>
318 </ul>
319 <a class="btn btn-sm btn-success" data-id="add_domain_admin" data-toggle="modal" data-target="#addDomainAdminModal" href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['admin']['add_domain_admin'];?></a>
320 </div>
321 </div>
322 </div>
323 </div>
324
325 <div class="panel panel-default">
326 <div class="panel-heading">OAuth2 Apps</div>
327 <div class="panel-body">
328 <p><?=$lang['admin']['oauth2_info'];?></p>
329 <div class="table-responsive">
330 <table class="table table-striped" id="oauth2clientstable"></table>
331 </div>
332 <div class="mass-actions-admin">
333 <div class="btn-group">
334 <a class="btn btn-sm btn-default" id="toggle_multi_select_all" data-id="oauth2_clients" href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></a>
335 <a class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
336 <ul class="dropdown-menu">
337 <li><a data-action="delete_selected" data-id="oauth2_clients" data-api-url='delete/oauth2-client' href="#"><?=$lang['mailbox']['remove'];?></a></li>
338 <li role="separator" class="divider"></li>
339 <li><a data-action="edit_selected" data-id="oauth2_clients" data-api-url='edit/oauth2-client' data-api-attr='{"revoke_tokens":"1"}' href="#"><?=$lang['admin']['oauth2_revoke_tokens'];?></a></li>
340 <li role="separator" class="divider"></li>
341 <li><a data-action="edit_selected" data-id="oauth2_clients" data-api-url='edit/oauth2-client' data-api-attr='{"renew_secret":"1"}' href="#"><?=$lang['admin']['oauth2_renew_secret'];?></a></li>
342 </ul>
343 <a class="btn btn-sm btn-success" data-id="add_oauth2_client" data-toggle="modal" data-target="#addOAuth2ClientModal" href="#"><span class="glyphicon glyphicon-plus"></span> Add OAuth2 client</a>
344 </div>
345 </div>
346 </div>
347 </div>
348
349 <div class="panel panel-default">
350 <div class="panel-heading">
351 <h3 class="panel-title">Rspamd UI</h3>
352 </div>
353 <div class="panel-body">
354 <div class="row">
355 <div class="col-sm-9">
356 <form class="form-horizontal" autocapitalize="none" data-id="admin" autocorrect="off" role="form" method="post">
357 <div class="form-group">
358 <div class="col-sm-offset-3 col-sm-9">
359 <label>
360 <a href="/rspamd/" target="_blank"><span class="glyphicon glyphicon-new-window" aria-hidden="true"></span> Rspamd UI</a>
361 </label>
362 </div>
363 </div>
364 <div class="form-group">
365 <label class="control-label col-sm-3" for="rspamd_ui_pass"><?=$lang['admin']['password'];?>:</label>
366 <div class="col-sm-9">
367 <input type="password" class="form-control" name="rspamd_ui_pass" autocomplete="new-password" required>
368 </div>
369 </div>
370 <div class="form-group">
371 <label class="control-label col-sm-3" for="rspamd_ui_pass2"><?=$lang['admin']['password_repeat'];?>:</label>
372 <div class="col-sm-9">
373 <input type="password" class="form-control" name="rspamd_ui_pass2" autocomplete="new-password" required>
374 </div>
375 </div>
376 <div class="form-group">
377 <div class="col-sm-offset-3 col-sm-9">
378 <button type="submit" class="btn btn-sm btn-success" id="rspamd_ui" name="rspamd_ui" href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
379 </div>
380 </div>
381 </form>
382 </div>
383 <div class="col-sm-3">
384 <img class="img-responsive" src="/img/rspamd_logo.png" alt="Rspamd UI" />
385 </div>
386 </div>
387 </div>
388 </div>
389 </div>
390
391 <div role="tabpanel" class="tab-pane" id="tab-routing">
392 <div class="panel panel-default">
393 <div class="panel-heading"><?=$lang['admin']['relayhosts'];?></div>
394 <div class="panel-body">
395 <p style="margin-bottom:40px"><?=$lang['admin']['relayhosts_hint'];?></p>
396 <div class="table-responsive">
397 <table class="table table-striped table-condensed" id="relayhoststable"></table>
398 </div>
399 <div class="mass-actions-admin">
400 <div class="btn-group btn-group-sm">
401 <button type="button" id="toggle_multi_select_all" data-id="rlyhosts" class="btn btn-default"><?=$lang['mailbox']['toggle_all'];?></button>
402 <a class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
403 <ul class="dropdown-menu">
404 <li><a data-action="edit_selected" data-id="rlyhosts" data-api-url='edit/relayhost' data-api-attr='{"active":"1"}' href="#"><?=$lang['mailbox']['activate'];?></a></li>
405 <li><a data-action="edit_selected" data-id="rlyhosts" data-api-url='edit/relayhost' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
406 <li role="separator" class="divider"></li>
407 <li><a data-action="delete_selected" data-id="rlyhosts" data-api-url='delete/relayhost' href="#"><?=$lang['admin']['remove'];?></a></li>
408 </ul>
409 </div>
410 </div>
411 <legend><?=$lang['admin']['add_relayhost'];?></legend>
412 <p class="help-block"><?=$lang['admin']['add_relayhost_hint'];?></p>
413 <div class="row">
414 <div class="col-md-6">
415 <form class="form" data-id="rlyhost" role="form" method="post">
416 <div class="form-group">
417 <label for="hostname"><?=$lang['admin']['host'];?></label>
418 <input class="form-control input-sm" name="hostname" placeholder='[0.0.0.0], [0.0.0.0]:25, host:25, host, [host]:25' required>
419 </div>
420 <div class="form-group">
421 <label for="username"><?=$lang['admin']['username'];?></label>
422 <input class="form-control input-sm" name="username">
423 </div>
424 <div class="form-group">
425 <label for="password"><?=$lang['admin']['password'];?></label>
426 <input class="form-control input-sm" name="password">
427 </div>
428 <button class="btn btn-default" data-action="add_item" data-id="rlyhost" data-api-url='add/relayhost' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['admin']['add'];?></button>
429 </form>
430 </div>
431 </div>
432 </div>
433 </div>
434
435 <div class="panel panel-default">
436 <div class="panel-heading"><?=$lang['admin']['transport_maps'];?></div>
437 <div class="panel-body">
438 <p style="margin-bottom:40px"><?=$lang['admin']['transports_hint'];?></p>
439 <div class="table-responsive">
440 <table class="table table-striped table-condensed" id="transportstable"></table>
441 </div>
442 <div class="mass-actions-admin">
443 <div class="btn-group btn-group-sm">
444 <button type="button" id="toggle_multi_select_all" data-id="transports" class="btn btn-default"><?=$lang['mailbox']['toggle_all'];?></button>
445 <a class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
446 <ul class="dropdown-menu">
447 <li><a data-action="edit_selected" data-id="transports" data-api-url='edit/transport' data-api-attr='{"active":"1"}' href="#"><?=$lang['mailbox']['activate'];?></a></li>
448 <li><a data-action="edit_selected" data-id="transports" data-api-url='edit/transport' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
449 <li role="separator" class="divider"></li>
450 <li><a data-action="delete_selected" data-id="transports" data-api-url='delete/transport' href="#"><?=$lang['admin']['remove'];?></a></li>
451 </ul>
452 </div>
453 </div>
454 <legend><?=$lang['admin']['add_transport'];?></legend>
455 <p class="help-block"><?=$lang['admin']['add_transports_hint'];?></p>
456 <div class="row">
457 <div class="col-md-6">
458 <form class="form" data-id="transport" role="form" method="post">
459 <div class="form-group">
460 <label for="destination"><?=$lang['admin']['destination'];?></label>
461 <input class="form-control input-sm" name="destination" placeholder='<?=$lang['admin']['transport_dest_format'];?>' required>
462 </div>
463 <div class="form-group">
464 <label for="nexthop"><?=$lang['admin']['nexthop'];?></label>
465 <input class="form-control input-sm" name="nexthop" placeholder='host:25, host, [host]:25, [0.0.0.0]:25' required>
466 </div>
467 <div class="form-group">
468 <label for="username"><?=$lang['admin']['username'];?></label>
469 <input class="form-control input-sm" name="username">
470 </div>
471 <div class="form-group">
472 <label for="password"><?=$lang['admin']['password'];?></label>
473 <input class="form-control input-sm" name="password">
474 </div>
475 <!-- <div class="form-group">
476 <label>
477 <input type="checkbox" name="lookup_mx" value="1"> <?=$lang['admin']['lookup_mx'];?>
478 </label>
479 </div> -->
480 <div class="form-group">
481 <label>
482 <input type="checkbox" name="active" value="1"> <?=$lang['admin']['active'];?>
483 </label>
484 </div>
485 <p class="help-block"><?=$lang['admin']['credentials_transport_warning'];?></p>
486 <button class="btn btn-default" data-action="add_item" data-id="transport" data-api-url='add/transport' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['admin']['add'];?></button>
487 </form>
488 </div>
489 </div>
490 </div>
491 </div>
492 </div>
493
494 <div role="tabpanel" class="tab-pane" id="tab-config-dkim">
495 <div class="panel panel-default">
496 <div class="panel-heading"><?=$lang['admin']['dkim_keys'];?></div>
497 <div class="panel-body">
498 <div class="btn-group" data-toggle="button" style="margin-bottom: 20px;">
499 <a class="btn btn-sm btn-default active" href="#" data-toggle="collapse" data-target=".dkim_key_valid"><?=$lang['admin']['dkim_key_valid'];?></a>
500 <a class="btn btn-sm btn-default active" href="#" data-toggle="collapse" data-target=".dkim_key_unused"><?=$lang['admin']['dkim_key_unused'];?></a>
501 <a class="btn btn-sm btn-default active" href="#" data-toggle="collapse" data-target=".dkim_key_missing"><?=$lang['admin']['dkim_key_missing'];?></a>
502 </div>
503 <?php
504 foreach(mailbox('get', 'domains') as $domain) {
505 if (!empty($dkim = dkim('details', $domain))) {
506 $dkim_domains[] = $domain;
507 ($GLOBALS['SHOW_DKIM_PRIV_KEYS'] === true) ?: $dkim['privkey'] = base64_encode('Please set $SHOW_DKIM_PRIV_KEYS to true to show DKIM private keys.');
508 ?>
509 <div class="row collapse in dkim_key_valid">
510 <div class="col-md-1"><input type="checkbox" data-id="dkim" name="multi_select" value="<?=$domain;?>" /></div>
511 <div class="col-md-3">
512 <p><?=$lang['admin']['domain'];?>: <strong><?=htmlspecialchars($domain);?></strong>
513 <p class="dkim-label"><span class="label label-success"><?=$lang['admin']['dkim_key_valid'];?></span></p>
514 <p class="dkim-label"><span class="label label-primary"><?=$lang['admin']['dkim_domains_selector'];?> '<?=$dkim['dkim_selector'];?>'</span></p>
515 <p class="dkim-label"><span class="label label-info"><?=$dkim['length'];?> bit</span></p>
516 </p>
517 </div>
518 <div class="col-md-8">
519 <pre><?=$dkim['dkim_txt'];?></pre>
520 <p data-toggle="modal" data-target="#showDKIMprivKey" id="dkim_priv" style="cursor:pointer;margin-top:-8pt" data-priv-key="<?=$dkim['privkey'];?>"><small>↪ <?=$lang['admin']['dkim_private_key'];?></small></p>
521 </div>
522 <hr class="visible-xs visible-sm">
523 </div>
524 <?php
525 }
526 else {
527 ?>
528 <div class="row collapse in dkim_key_missing">
529 <div class="col-md-1"><input class="dkim_missing" type="checkbox" data-id="dkim" name="multi_select" value="<?=$domain;?>" disabled /></div>
530 <div class="col-md-3">
531 <p><?=$lang['admin']['domain'];?>: <strong><?=htmlspecialchars($domain);?></strong><br><span class="label label-danger"><?=$lang['admin']['dkim_key_missing'];?></span></p>
532 </div>
533 <div class="col-md-8"><pre>-</pre></div>
534 <hr class="visible-xs visible-sm">
535 </div>
536 <?php
537 }
538 foreach(mailbox('get', 'alias_domains', $domain) as $alias_domain) {
539 if (!empty($dkim = dkim('details', $alias_domain))) {
540 $dkim_domains[] = $alias_domain;
541 ($GLOBALS['SHOW_DKIM_PRIV_KEYS'] === true) ?: $dkim['privkey'] = base64_encode('Please set $SHOW_DKIM_PRIV_KEYS to true to show DKIM private keys.');
542 ?>
543 <div class="row collapse in dkim_key_valid">
544 <div class="col-md-1"><input type="checkbox" data-id="dkim" name="multi_select" value="<?=$alias_domain;?>" /></div>
545 <div class="col-md-2 col-md-offset-1">
546 <p><small>↳ Alias-Domain: <strong><?=htmlspecialchars($alias_domain);?></strong></small>
547 <p class="dkim-label"><span class="label label-success"><?=$lang['admin']['dkim_key_valid'];?></span></p>
548 <p class="dkim-label"><span class="label label-primary">Selector '<?=$dkim['dkim_selector'];?>'</span></p>
549 <p class="dkim-label"><span class="label label-info"><?=$dkim['length'];?> bit</span></p>
550 </p>
551 </div>
552 <div class="col-md-8">
553 <pre><?=$dkim['dkim_txt'];?></pre>
554 <p data-toggle="modal" data-target="#showDKIMprivKey" id="dkim_priv" style="cursor:pointer;margin-top:-8pt" data-priv-key="<?=$dkim['privkey'];?>"><small>↪ Private key</small></p>
555 </div>
556 <hr class="visible-xs visible-sm">
557 </div>
558 <?php
559 }
560 else {
561 ?>
562 <div class="row collapse in dkim_key_missing">
563 <div class="col-md-1"><input class="dkim_missing" type="checkbox" data-id="dkim" name="multi_select" value="<?=$alias_domain;?>" disabled /></div>
564 <div class="col-md-2 col-md-offset-1">
565 <p><small>↳ Alias-Domain: <strong><?=htmlspecialchars($alias_domain);?></strong><br></small><span class="label label-danger"><?=$lang['admin']['dkim_key_missing'];?></span></p>
566 </div>
567 <div class="col-md-8"><pre>-</pre></div>
568 <hr class="visible-xs visible-sm">
569 </div>
570 <?php
571 }
572 }
573 }
574 foreach(dkim('blind') as $blind) {
575 if (!empty($dkim = dkim('details', $blind))) {
576 $dkim_domains[] = $blind;
577 ($GLOBALS['SHOW_DKIM_PRIV_KEYS'] === true) ?: $dkim['privkey'] = base64_encode('Please set $SHOW_DKIM_PRIV_KEYS to true to show DKIM private keys.');
578 ?>
579 <div class="row collapse in dkim_key_unused">
580 <div class="col-md-1"><input type="checkbox" data-id="dkim" name="multi_select" value="<?=$blind;?>" /></div>
581 <div class="col-md-3">
582 <p><?=$lang['admin']['domain'];?>: <strong><?=htmlspecialchars($blind);?></strong>
583 <p class="dkim-label"><span class="label label-warning"><?=$lang['admin']['dkim_key_unused'];?></span></p>
584 <p class="dkim-label"><span class="label label-primary">Selector '<?=$dkim['dkim_selector'];?>'</span></p>
585 <p class="dkim-label"><span class="label label-info"><?=$dkim['length'];?> bit</span></p>
586 </p>
587 </div>
588 <div class="col-md-8">
589 <pre><?=$dkim['dkim_txt'];?></pre>
590 <p data-toggle="modal" data-target="#showDKIMprivKey" id="dkim_priv" style="cursor:pointer;margin-top:-8pt" data-priv-key="<?=$dkim['privkey'];?>"><small>↪ Private key</small></p>
591 </div>
592 <hr class="visible-xs visible-sm">
593 </div>
594 <?php
595 }
596 }
597 ?>
598 <div class="mass-actions-admin">
599 <div class="btn-group btn-group-sm">
600 <button type="button" id="toggle_multi_select_all" data-id="dkim" class="btn btn-default"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></button>
601 <button type="button" data-action="delete_selected" name="delete_selected" data-id="dkim" data-api-url="delete/dkim" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> <?=$lang['admin']['remove'];?></button>
602 </div>
603 </div>
604
605 <legend style="margin-top:40px"><?=$lang['admin']['dkim_add_key'];?></legend>
606 <form class="form" data-id="dkim" role="form" method="post">
607 <div class="form-group">
608 <label for="domain"><?=$lang['admin']['domain_s'];?></label>
609 <input class="form-control input-sm" id="dkim_add_domains" name="domains" placeholder="example.org, example.com" required>
610 <small>↪ <a href="#" id="dkim_missing_keys"><?=$lang['admin']['dkim_domains_wo_keys'];?></a></small>
611 </div>
612 <div class="form-group">
613 <label for="domain"><?=$lang['admin']['dkim_domains_selector'];?></label>
614 <input class="form-control input-sm" name="dkim_selector" value="dkim" required>
615 </div>
616 <div class="form-group">
617 <select data-width="200px" data-style="btn btn-default btn-sm" class="form-control" id="key_size" name="key_size" title="<?=$lang['admin']['dkim_key_length'];?>" required>
618 <option data-subtext="bits">1024</option>
619 <option data-subtext="bits">2048</option>
620 </select>
621 </div>
622 <button class="btn btn-sm btn-default" data-action="add_item" data-id="dkim" data-api-url='add/dkim' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['admin']['add'];?></button>
623 </form>
624
625 <legend data-target="#import_dkim" style="margin-top:40px;cursor:pointer" class="arrow-toggle" unselectable="on" data-toggle="collapse">
626 <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> <?=$lang['admin']['import_private_key'];?>
627 </legend>
628 <div id="import_dkim" class="collapse">
629 <form class="form" data-id="dkim_import" role="form" method="post">
630 <div class="form-group">
631 <label for="domain"><?=$lang['admin']['domain'];?>:</label>
632 <input class="form-control input-sm" name="domain" placeholder="example.org" required>
633 </div>
634 <div class="form-group">
635 <label for="domain"><?=$lang['admin']['dkim_domains_selector'];?>:</label>
636 <input class="form-control input-sm" name="dkim_selector" value="dkim" required>
637 </div>
638 <div class="form-group">
639 <label for="private_key_file"><?=$lang['admin']['private_key'];?>: (RSA PKCS#8)</label>
640 <textarea class="form-control input-sm" rows="10" name="private_key_file" id="private_key_file" required placeholder="-----BEGIN RSA KEY-----"></textarea>
641 </div>
642 <div class="form-group">
643 <label>
644 <input type="checkbox" name="overwrite_existing" value="1"> <?=$lang['admin']['dkim_overwrite_key'];?>
645 </label>
646 </div>
647 <button class="btn btn-sm btn-default" data-action="add_item" data-id="dkim_import" data-api-url='add/dkim_import' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['admin']['import'];?></button>
648 </form>
649 </div>
650
651 <legend data-target="#duplicate_dkim" style="margin-top:40px;cursor:pointer" class="arrow-toggle" unselectable="on" data-toggle="collapse">
652 <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> <?=$lang['admin']['duplicate_dkim'];?>
653 </legend>
654 <div id="duplicate_dkim" class="collapse">
655 <form class="form-horizontal" data-id="dkim_duplicate" role="form" method="post">
656 <div class="form-group">
657 <label class="control-label col-sm-2" for="from_domain"><?=$lang['admin']['dkim_from'];?>:</label>
658 <div class="col-sm-10">
659 <select data-style="btn btn-default btn-sm"
660 data-live-search="true"
661 data-id="dkim_duplicate"
662 title="<?=$lang['admin']['dkim_from_title'];?>"
663 name="from_domain" id="from_domain" class="full-width-select form-control" required>
664 <?php
665 foreach ($dkim_domains as $dkim) {
666 ?>
667 <option value="<?=$dkim;?>"><?=$dkim;?></option>
668 <?php
669 }
670 ?>
671 </select>
672 </div>
673 </div>
674 <div class="form-group">
675 <label class="control-label col-sm-2" for="to_domain"><?=$lang['admin']['dkim_to'];?>:</label>
676 <div class="col-sm-10">
677 <select
678 data-live-search="true"
679 data-style="btn btn-default btn-sm"
680 data-id="dkim_duplicate"
681 title="<?=$lang['admin']['dkim_to_title'];?>"
682 name="to_domain" id="to_domain" class="full-width-select form-control" multiple required>
683 <?php
684 foreach (array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains')) as $domain) {
685 ?>
686 <option value="<?=$domain;?>"><?=$domain;?></option>
687 <?php
688 }
689 ?>
690 </select>
691 </div>
692 </div>
693 <button class="btn btn-sm btn-default" data-action="add_item" data-id="dkim_duplicate" data-api-url='add/dkim_duplicate' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-duplicate"></span> <?=$lang['admin']['duplicate'];?></button>
694 </form>
695 </div>
696 </div>
697 </div>
698 </div>
699
700 <div role="tabpanel" class="tab-pane" id="tab-config-fwdhosts">
701 <div class="panel panel-default">
702 <div class="panel-heading"><?=$lang['admin']['forwarding_hosts'];?></div>
703 <div class="panel-body">
704 <p style="margin-bottom:40px"><?=$lang['admin']['forwarding_hosts_hint'];?></p>
705 <div class="table-responsive">
706 <table class="table table-striped table-condensed" id="forwardinghoststable"></table>
707 </div>
708 <div class="mass-actions-admin">
709 <div class="btn-group btn-group-sm">
710 <button type="button" id="toggle_multi_select_all" data-id="fwdhosts" class="btn btn-default"><?=$lang['mailbox']['toggle_all'];?></button>
711 <a class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
712 <ul class="dropdown-menu">
713 <li><a data-action="edit_selected" data-id="fwdhosts" data-api-url='edit/fwdhost' data-api-attr='{"keep_spam":"0"}' href="#">Enable spam filter</a></li>
714 <li><a data-action="edit_selected" data-id="fwdhosts" data-api-url='edit/fwdhost' data-api-attr='{"keep_spam":"1"}' href="#">Disable spam filter</a></li>
715 <li role="separator" class="divider"></li>
716 <li><a data-action="delete_selected" data-id="fwdhosts" data-api-url='delete/fwdhost' href="#"><?=$lang['admin']['remove'];?></a></li>
717 </ul>
718 </div>
719 </div>
720 <legend><?=$lang['admin']['add_forwarding_host'];?></legend>
721 <p class="help-block"><?=$lang['admin']['forwarding_hosts_add_hint'];?></p>
722 <form class="form" data-id="fwdhost" role="form" method="post">
723 <div class="form-group">
724 <label for="hostname"><?=$lang['admin']['host'];?></label>
725 <input class="form-control" name="hostname" placeholder="example.org" required>
726 </div>
727 <div class="form-group">
728 <select data-width="200px" class="form-control" id="filter_spam" name="filter_spam" title="<?=$lang['user']['spamfilter'];?>" required>
729 <option value="1"><?=$lang['admin']['active'];?></option>
730 <option value="0"><?=$lang['admin']['inactive'];?></option>
731 </select>
732 </div>
733 <button class="btn btn-default" data-action="add_item" data-id="fwdhost" data-api-url='add/fwdhost' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['admin']['add'];?></button>
734 </form>
735 </div>
736 </div>
737 </div>
738
739 <div role="tabpanel" class="tab-pane" id="tab-config-f2b">
740 <div class="panel panel-default">
741 <div class="panel-heading"><?=$lang['admin']['f2b_parameters'];?></div>
742 <div class="panel-body">
743 <?php
744 $f2b_data = fail2ban('get');
745 ?>
746 <form class="form" data-id="f2b" role="form" method="post">
747 <div class="form-group">
748 <label for="ban_time"><?=$lang['admin']['f2b_ban_time'];?>:</label>
749 <input type="number" class="form-control" name="ban_time" value="<?=$f2b_data['ban_time'];?>" required>
750 </div>
751 <div class="form-group">
752 <label for="max_attempts"><?=$lang['admin']['f2b_max_attempts'];?>:</label>
753 <input type="number" class="form-control" name="max_attempts" value="<?=$f2b_data['max_attempts'];?>" required>
754 </div>
755 <div class="form-group">
756 <label for="retry_window"><?=$lang['admin']['f2b_retry_window'];?>:</label>
757 <input type="number" class="form-control" name="retry_window" value="<?=$f2b_data['retry_window'];?>" required>
758 </div>
759 <div class="form-group">
760 <label for="netban_ipv4"><?=$lang['admin']['f2b_netban_ipv4'];?>:</label>
761 <div class="input-group">
762 <span class="input-group-addon">/</span>
763 <input type="number" class="form-control" name="netban_ipv4" value="<?=$f2b_data['netban_ipv4'];?>" required>
764 </div>
765 </div>
766 <div class="form-group">
767 <label for="netban_ipv6"><?=$lang['admin']['f2b_netban_ipv6'];?>:</label>
768 <div class="input-group">
769 <span class="input-group-addon">/</span>
770 <input type="number" class="form-control" name="netban_ipv6" value="<?=$f2b_data['netban_ipv6'];?>" required>
771 </div>
772 </div>
773 <hr>
774 <p class="help-block"><?=$lang['admin']['f2b_list_info'];?></p>
775 <div class="form-group">
776 <label for="whitelist"><?=$lang['admin']['f2b_whitelist'];?>:</label>
777 <textarea class="form-control" name="whitelist" rows="5"><?=$f2b_data['whitelist'];?></textarea>
778 </div>
779 <div class="form-group">
780 <label for="blacklist"><?=$lang['admin']['f2b_blacklist'];?>:</label>
781 <textarea class="form-control" name="blacklist" rows="5"><?=$f2b_data['blacklist'];?></textarea>
782 </div>
783 <div class="btn-group">
784 <button class="btn btn-sm btn-success" data-action="edit_selected" data-item="self" data-id="f2b" data-api-url='edit/fail2ban' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
785 <a href="#" role="button" class="btn btn-sm btn-default" data-toggle="modal" data-container="netfilter-mailcow" data-target="#RestartContainer"><span class="glyphicon glyphicon-refresh"></span> <?= $lang['header']['restart_netfilter']; ?></a>
786 </div>
787 </form>
788 <hr>
789 <h4><?=$lang['admin']['f2b_filter'];?></h4>
790 <p class="help-block"><?=$lang['admin']['f2b_regex_info'];?></p>
791 <form class="form-inline" data-id="f2b_regex" role="form" method="post">
792 <table class="table table-condensed" id="f2b_regex_table">
793 <tr>
794 <th width="50px">ID</th>
795 <th>RegExp</th>
796 <th width="100px">&nbsp;</th>
797 </tr>
798 <?php
799 if (!empty($f2b_data['regex'])) {
800 foreach ($f2b_data['regex'] as $regex_id => $regex_val) {
801 ?>
802 <tr>
803 <td><input disabled class="input-sm form-control" style="text-align:center" data-id="f2b_regex" type="text" name="app" required value="<?=$regex_id;?>"></td>
804 <td><input class="input-sm form-control regex-input" data-id="f2b_regex" type="text" name="regex" required value="<?=htmlspecialchars($regex_val);?>"></td>
805 <td><a href="#" role="button" class="btn btn-xs btn-default" type="button"><?=$lang['admin']['remove_row'];?></a></td>
806 </tr>
807 <?php
808 }
809 }
810 ?>
811 </table>
812 <p><div class="btn-group">
813 <button class="btn btn-sm btn-success" data-action="edit_selected" data-item="admin" data-id="f2b_regex" data-reload="no" data-api-url='edit/fail2ban' data-api-attr='{"action":"edit-regex"}' href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
814 <button class="btn btn-sm btn-default admin-ays-dialog" data-action="edit_selected" data-item="self" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"reset-regex"}' href="#"><?=$lang['admin']['reset_default'];?></button>
815 <button class="btn btn-sm btn-default" type="button" id="add_f2b_regex_row"><span class="glyphicon glyphicon-plus"></span> <?=$lang['admin']['add_row'];?></button>
816 </div></p>
817 </form>
818 <hr>
819 <p class="help-block"><?=$lang['admin']['ban_list_info'];?></p>
820 <?php
821 if (empty($f2b_data['active_bans']) && empty($f2b_data['perm_bans'])):
822 ?>
823 <i><?=$lang['admin']['no_active_bans'];?></i>
824 <?php
825 endif;
826 if (!empty($f2b_data['active_bans'])):
827 foreach ($f2b_data['active_bans'] as $active_bans):
828 ?>
829 <p><span class="label label-info" style="padding:4px;font-size:85%;"><span class="glyphicon glyphicon-filter"></span> <?=$active_bans['network'];?> (<?=$active_bans['banned_until'];?>) -
830 <?php
831 if ($active_bans['queued_for_unban'] == 0):
832 ?>
833 <a data-action="edit_selected" data-item="<?=$active_bans['network'];?>" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"unban"}' href="#">[<?=$lang['admin']['queue_unban'];?>]</a>
834 <a data-action="edit_selected" data-item="<?=$active_bans['network'];?>" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"whitelist"}' href="#">[whitelist]</a>
835 <a data-action="edit_selected" data-item="<?=$active_bans['network'];?>" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"blacklist"}' href="#">[blacklist (<b>needs restart</b>)]</a>
836 <?php
837 else:
838 ?>
839 <i><?=$lang['admin']['unban_pending'];?></i>
840 <?php
841 endif;
842 ?>
843 </span></p>
844 <?php
845 endforeach;
846 ?>
847 <hr>
848 <?php
849 endif;
850 if (!empty($f2b_data['perm_bans'])):
851 foreach ($f2b_data['perm_bans'] as $perm_bans):
852 ?>
853 <span class="label label-danger" style="padding: 0.1em 0.4em 0.1em;"><span class="glyphicon glyphicon-filter"></span> <?=$perm_bans?></span>
854 <?php
855 endforeach;
856 endif;
857 ?>
858 </div>
859 </div>
860 </div>
861
862 <div role="tabpanel" class="tab-pane" id="tab-config-quarantine">
863 <div class="panel panel-default">
864 <div class="panel-heading"><?=$lang['admin']['quarantine'];?></div>
865 <div class="panel-body">
866 <?php $q_data = quarantine('settings');
867 if (empty($q_data['retention_size']) || empty($q_data['max_size'])):
868 ?>
869 <div class="panel-body"><div class="alert alert-info"><?=$lang['quarantine']['disabled_by_config'];?></div></div>
870 <?php
871 endif;
872 ?>
873 <form class="form-horizontal" data-id="quarantine" role="form" method="post">
874 <div class="form-group">
875 <label class="col-sm-4 control-label" for="retention_size"><?=$lang['admin']['quarantine_retention_size'];?></label>
876 <div class="col-sm-8">
877 <input type="number" class="form-control" name="retention_size" value="<?=$q_data['retention_size'];?>" placeholder="0" required>
878 </div>
879 </div>
880 <div class="form-group">
881 <label class="col-sm-4 control-label" for="max_size"><?=$lang['admin']['quarantine_max_size'];?></label>
882 <div class="col-sm-8">
883 <input type="number" class="form-control" name="max_size" value="<?=$q_data['max_size'];?>" placeholder="0" required>
884 </div>
885 </div>
886 <div class="form-group">
887 <label class="col-sm-4 control-label" for="max_score"><?=$lang['admin']['quarantine_max_score'];?></label>
888 <div class="col-sm-8">
889 <input type="number" class="form-control" name="max_score" value="<?=$q_data['max_score'];?>" placeholder="9999.0">
890 </div>
891 </div>
892 <div class="form-group">
893 <label class="col-sm-4 control-label" for="max_age"><?=$lang['admin']['quarantine_max_age'];?></label>
894 <div class="col-sm-8">
895 <input type="number" class="form-control" name="max_age" value="<?=$q_data['max_age'];?>" min="1" required>
896 </div>
897 </div>
898 <hr>
899 <div class="form-group">
900 <label class="col-sm-4 control-label" for="sender"><span class="glyphicon glyphicon-share-alt"></span> <?=$lang['admin']['quarantine_redirect'];?></label>
901 <div class="col-sm-8">
902 <input type="email" class="form-control" name="redirect" value="<?=htmlspecialchars($q_data['redirect']);?>" placeholder="">
903 </div>
904 </div>
905 <div class="form-group">
906 <label class="col-sm-4 control-label" for="sender"><span class="glyphicon glyphicon-copy"></span> <?=$lang['admin']['quarantine_bcc'];?></label>
907 <div class="col-sm-8">
908 <input type="email" class="form-control" name="bcc" value="<?=htmlspecialchars($q_data['bcc']);?>" placeholder="">
909 </div>
910 </div>
911 <hr>
912 <div class="form-group">
913 <label class="col-sm-4 control-label" for="sender"><?=$lang['admin']['quarantine_notification_sender'];?>:</label>
914 <div class="col-sm-8">
915 <input type="email" class="form-control" name="sender" value="<?=htmlspecialchars($q_data['sender']);?>" placeholder="quarantine@localhost">
916 </div>
917 </div>
918 <div class="form-group">
919 <label class="col-sm-4 control-label" for="subject"><?=$lang['admin']['quarantine_notification_subject'];?>:</label>
920 <div class="col-sm-8">
921 <input type="text" class="form-control" name="subject" value="<?=htmlspecialchars($q_data['subject']);?>" placeholder="Spam Quarantine Notification">
922 </div>
923 </div>
924 <hr>
925 <div class="form-group">
926 <label class="col-sm-4 control-label" for="release_format"><?=$lang['admin']['quarantine_release_format'];?>:</label>
927 <div class="col-sm-8">
928 <select data-width="100%" name="release_format" class="selectpicker" title="<?=$lang['tfa']['select'];?>">
929 <option <?=($q_data['release_format'] == 'raw') ? 'selected' : null;?> value="raw"><?=$lang['admin']['quarantine_release_format_raw'];?></option>
930 <option <?=($q_data['release_format'] == 'attachment') ? 'selected' : null;?> value="attachment"><?=$lang['admin']['quarantine_release_format_att'];?></option>
931 </select>
932 </div>
933 </div>
934 <div class="form-group">
935 <label class="col-sm-4 control-label" for="exclude_domains"><?=$lang['admin']['quarantine_exclude_domains'];?>:</label>
936 <div class="col-sm-8">
937 <select data-width="100%" name="exclude_domains" class="selectpicker" title="<?=$lang['tfa']['select'];?>" multiple>
938 <?php
939 foreach (array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains')) as $domain):
940 ?>
941 <option <?=(in_array($domain, $q_data['exclude_domains'])) ? 'selected' : null;?>><?=htmlspecialchars($domain);?></option>
942 <?php
943 endforeach;
944 ?>
945 </select>
946 </div>
947 </div>
948 <hr>
949 <legend data-target="#quarantine_template" style="cursor:pointer" class="arrow-toggle" unselectable="on" data-toggle="collapse">
950 <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> <?=$lang['admin']['quarantine_notification_html'];?>
951 </legend>
952 <div id="quarantine_template" class="collapse" >
953 <textarea autocorrect="off" spellcheck="false" autocapitalize="none" class="form-control textarea-code" rows="40" name="html_tmpl"><?=$q_data['html_tmpl'];?></textarea>
954 </div>
955 <button class="btn btn-sm btn-success" data-action="edit_selected" data-item="self" data-id="quarantine" data-api-url='edit/quarantine' data-api-attr='{"action":"settings"}' href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
956 </form>
957 </div>
958 </div>
959 </div>
960
961 <div role="tabpanel" class="tab-pane" id="tab-config-quota">
962 <div class="panel panel-default">
963 <div class="panel-heading"><?=$lang['admin']['quota_notifications'];?></div>
964 <div class="panel-body">
965 <p><?=$lang['admin']['quota_notifications_info'];?></p>
966 <?php $qw_data = quota_notification('get');?>
967 <form class="form" role="form" data-id="quota_notification" method="post">
968 <div class="row">
969 <div class="col-sm-6">
970 <div class="form-group">
971 <label for="sender"><?=$lang['admin']['quarantine_notification_sender'];?>:</label>
972 <input type="email" class="form-control" name="sender" value="<?=htmlspecialchars($qw_data['sender']);?>" placeholder="quota-warning@localhost">
973 </div>
974 </div>
975 <div class="col-sm-6">
976 <div class="form-group">
977 <label for="subject"><?=$lang['admin']['quarantine_notification_subject'];?>:</label>
978 <input type="text" class="form-control" name="subject" value="<?=htmlspecialchars($qw_data['subject']);?>" placeholder="Quota warning">
979 </div>
980 </div>
981 </div>
982 <div class="row">
983 <div class="col-sm-12">
984 <legend data-target="#quota_template" style="cursor:pointer" class="arrow-toggle" unselectable="on" data-toggle="collapse">
985 <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> <?=$lang['admin']['quarantine_notification_html'];?>
986 </legend>
987 <div id="quota_template" class="collapse" >
988 <!-- <small><?=$lang['admin']['quota_notifications_vars'];?></small><br><br>-->
989 <textarea autocorrect="off" spellcheck="false" autocapitalize="none" class="form-control textarea-code collapse in" rows="20" name="html_tmpl"><?=$qw_data['html_tmpl'];?></textarea>
990 </div>
991 </div>
992 </div>
993 <div class="row">
994 <div class="col-sm-10">
995 <div class="form-group">
996 <br>
997 <a type="button" class="btn btn-sm btn-success" data-action="edit_selected"
998 data-item="quota_notification"
999 data-id="quota_notification"
1000 data-api-url='edit/quota_notification'
1001 data-api-attr='{}'><span class="glyphicon glyphicon-check"></span> <?=$lang['user']['save_changes'];?></a>
1002 </div>
1003 </div>
1004 </div>
1005 </form>
1006 </div>
1007 </div>
1008 </div>
1009
1010 <div role="tabpanel" class="tab-pane" id="tab-config-rsettings">
1011 <div class="panel panel-default">
1012 <div class="panel-heading"><?=$lang['admin']['rspamd_settings_map'];?></div>
1013 <div class="panel-body">
1014 <legend data-target="#active_settings_map" style="cursor:pointer" class="arrow-toggle" unselectable="on" data-toggle="collapse">
1015 <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> <?=$lang['admin']['active_rspamd_settings_map'];?>
1016 </legend>
1017 <div id="active_settings_map" class="collapse" >
1018 <textarea autocorrect="off" spellcheck="false" autocapitalize="none" class="form-control textarea-code" rows="20" name="settings_map" readonly><?=file_get_contents('http://nginx:8081/settings.php');?></textarea>
1019 </div>
1020 <br>
1021 <?php $rsettings = rsettings('get'); ?>
1022 <form class="form" data-id="rsettings" role="form" method="post">
1023 <div class="row">
1024 <div class="col-sm-3">
1025 <div class="list-group">
1026 <?php
1027 if (empty($rsettings)):
1028 ?>
1029 <span class="list-group-item"><em><?=$lang['admin']['rsetting_none'];?></em></span>
1030 <?php
1031 else:
1032 foreach ($rsettings as $rsetting):
1033 $rsetting_details = rsettings('details', $rsetting['id']);
1034 ?>
1035 <a href="#<?=$rsetting_details['id'];?>" class="list-group-item list-group-item-<?=($rsetting_details['active'] == '1') ? 'success' : ''; ?>" data-dont-remember="1" data-toggle="tab"><?=$rsetting_details['desc'];?> (ID #<?=$rsetting['id'];?>)</a>
1036 <?php
1037 endforeach;
1038 endif;
1039 ?>
1040 <a href="#" class="list-group-item list-group-item-default"
1041 data-id="add_domain_admin"
1042 data-toggle="modal"
1043 data-dont-remember="1"
1044 data-target="#addRsettingModal"
1045 data-toggle="tab"><?=$lang['admin']['rsetting_add_rule'];?></a>
1046 </div>
1047 </div>
1048 <div class="col-sm-9">
1049 <div class="tab-content">
1050 <?php
1051 if (empty($rsettings)):
1052 ?>
1053 <div id="none" class="tab-pane active">
1054 <p class="help-block"><?=$lang['admin']['rsetting_none'];?></p>
1055 </div>
1056 <?php
1057 else:
1058 ?>
1059 <div id="none" class="tab-pane active">
1060 <p class="help-block"><?=$lang['admin']['rsetting_no_selection'];?></p>
1061 </div>
1062 <?php
1063 foreach ($rsettings as $rsetting):
1064 $rsetting_details = rsettings('details', $rsetting['id']);
1065 ?>
1066 <div id="<?=$rsetting_details['id'];?>" class="tab-pane">
1067 <form class="form" data-id="rsettings" role="form" method="post">
1068 <input type="hidden" name="active" value="0">
1069 <div class="form-group">
1070 <label for="desc"><?=$lang['admin']['rsetting_desc'];?>:</label>
1071 <input type="text" class="form-control" name="desc" value="<?=htmlspecialchars($rsetting_details['desc']);?>">
1072 </div>
1073 <div class="form-group">
1074 <label for="content"><?=$lang['admin']['rsetting_content'];?>:</label>
1075 <textarea class="form-control" name="content" rows="10"><?=htmlspecialchars($rsetting_details['content']);?></textarea>
1076 </div>
1077 <div class="form-group">
1078 <label>
1079 <input type="checkbox" name="active" value="1" <?=($rsetting_details['active'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['active'];?>
1080 </label>
1081 </div>
1082 <button class="btn btn-sm btn-success" data-action="edit_selected" data-item="<?=$rsetting_details['id'];?>" data-id="rsettings" data-api-url='edit/rsetting' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
1083 <button class="btn btn-sm btn-danger" data-action="delete_selected" data-item="<?=$rsetting_details['id'];?>" data-id="rsettings" data-api-url="delete/rsetting" data-api-attr='{}' href="#"><?=$lang['admin']['remove'];?></button>
1084 </form>
1085 </div>
1086 <?php
1087 endforeach;
1088 endif;
1089 ?>
1090 </div>
1091 </div>
1092 </div>
1093 </form>
1094 </div>
1095 </div>
1096 </div>
1097
1098 <div role="tabpanel" class="tab-pane" id="tab-config-customize">
1099 <div class="panel panel-default">
1100 <div class="panel-heading"><?=$lang['admin']['customize'];?></div>
1101 <div class="panel-body">
1102 <legend><?=$lang['admin']['change_logo'];?></legend>
1103 <p class="help-block"><?=$lang['admin']['logo_info'];?></p>
1104 <form class="form-inline" role="form" method="post" enctype="multipart/form-data">
1105 <p>
1106 <input type="file" name="main_logo" class="filestyle" data-buttonName="btn-default" data-buttonText="Select" accept="image/gif, image/jpeg, image/pjpeg, image/x-png, image/png, image/svg+xml">
1107 <button name="submit_main_logo" type="submit" class="btn btn-default"><span class="glyphicon glyphicon-cloud-upload"></span> <?=$lang['admin']['upload'];?></button>
1108 </p>
1109 </form>
1110 <?php
1111 if ($main_logo = customize('get', 'main_logo')) {
1112 $specs = customize('get', 'main_logo_specs');
1113 ?>
1114 <div class="row">
1115 <div class="col-sm-3">
1116 <div class="thumbnail">
1117 <img class="img-thumbnail" src="<?=$main_logo;?>" alt="mailcow logo">
1118 <div class="caption">
1119 <span class="label label-info"><?=$specs['geometry']['width'];?>x<?=$specs['geometry']['height'];?> px</span>
1120 <span class="label label-info"><?=$specs['mimetype'];?></span>
1121 <span class="label label-info"><?=$specs['fileSize'];?></span>
1122 </div>
1123 </div>
1124 <hr>
1125 <form class="form-inline" role="form" method="post">
1126 <p><button name="reset_main_logo" type="submit" class="btn btn-xs btn-default"><?=$lang['admin']['reset_default'];?></button></p>
1127 </form>
1128 </div>
1129 </div>
1130 <?php } ?>
1131 <legend><?=$lang['admin']['app_links'];?></legend>
1132 <p class="help-block"><?=$lang['admin']['merged_vars_hint'];?></p>
1133 <form class="form-inline" data-id="app_links" role="form" method="post">
1134 <table class="table table-condensed" style="white-space: nowrap;" id="app_link_table">
1135 <tr>
1136 <th><?=$lang['admin']['app_name'];?></th>
1137 <th><?=$lang['admin']['link'];?></th>
1138 <th>&nbsp;</th>
1139 </tr>
1140 <?php
1141 $app_links = customize('get', 'app_links');
1142 foreach ($app_links as $row) {
1143 foreach ($row as $key => $val) {
1144 ?>
1145 <tr>
1146 <td><input class="input-sm form-control" data-id="app_links" type="text" name="app" required value="<?=$key;?>"></td>
1147 <td><input class="input-sm form-control" data-id="app_links" type="text" name="href" required value="<?=$val;?>"></td>
1148 <td><a href="#" role="button" class="btn btn-xs btn-default" type="button"><?=$lang['admin']['remove_row'];?></a></td>
1149 </tr>
1150 <?php
1151 }
1152 }
1153 foreach ($MAILCOW_APPS as $app) {
1154 ?>
1155 <tr>
1156 <td><input class="input-sm form-control" value="<?=htmlspecialchars($app['name']);?>" disabled></td>
1157 <td><input class="input-sm form-control" value="<?=htmlspecialchars($app['link']);?>" disabled></td>
1158 <td>&nbsp;</td>
1159 </tr>
1160 <?php } ?>
1161 </table>
1162 <p><div class="btn-group">
1163 <button class="btn btn-sm btn-success" data-action="edit_selected" data-item="admin" data-id="app_links" data-reload="no" data-api-url='edit/app_links' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
1164 <button class="btn btn-sm btn-default" type="button" id="add_app_link_row"><?=$lang['admin']['add_row'];?></button>
1165 </div></p>
1166 </form>
1167 <legend data-target="#ui_texts" style="padding-top:20px" unselectable="on"><?=$lang['admin']['ui_texts'];?></legend>
1168 <div id="ui_texts">
1169 <?php $ui_texts = customize('get', 'ui_texts'); ?>
1170 <form class="form" data-id="uitexts" role="form" method="post">
1171 <div class="form-group">
1172 <label for="title_name"><?=$lang['admin']['title_name'];?>:</label>
1173 <input type="text" class="form-control" name="title_name" placeholder="mailcow UI" value="<?=$ui_texts['title_name'];?>">
1174 </div>
1175 <div class="form-group">
1176 <label for="main_name"><?=$lang['admin']['main_name'];?>:</label>
1177 <input type="text" class="form-control" name="main_name" placeholder="mailcow UI" value="<?=$ui_texts['main_name'];?>">
1178 </div>
1179 <div class="form-group">
1180 <label for="apps_name"><?=$lang['admin']['apps_name'];?>:</label>
1181 <input type="text" class="form-control" name="apps_name" placeholder="mailcow Apps" value="<?=$ui_texts['apps_name'];?>">
1182 </div>
1183 <div class="form-group">
1184 <label for="help_text"><?=$lang['admin']['help_text'];?>:</label>
1185 <textarea class="form-control" id="help_text" name="help_text" rows="7"><?=$ui_texts['help_text'];?></textarea>
1186 </div>
1187 <hr>
1188 <div class="form-group">
1189 <p class="help-block"><?=$lang['admin']['ui_header_announcement_help'];?></p>
1190 <label for="ui_announcement_type"><?=$lang['admin']['ui_header_announcement'];?>:</label>
1191 <p><select multiple data-width="100%" name="ui_announcement_type" class="selectpicker show-tick" data-max-options="1" title="<?=$lang['admin']['ui_header_announcement_select'];?>">
1192 <option <?=($ui_texts['ui_announcement_type'] == 'info') ? 'selected' : null;?> value="info"><?=$lang['admin']['ui_header_announcement_type_info'];?></option>
1193 <option <?=($ui_texts['ui_announcement_type'] == 'warning') ? 'selected' : null;?> value="warning"><?=$lang['admin']['ui_header_announcement_type_warning'];?></option>
1194 <option <?=($ui_texts['ui_announcement_type'] == 'danger') ? 'selected' : null;?> value="danger"><?=$lang['admin']['ui_header_announcement_type_danger'];?></option>
1195 </select></p>
1196 <p><textarea class="form-control" id="ui_announcement_text" name="ui_announcement_text" rows="7"><?=$ui_texts['ui_announcement_text'];?></textarea></p>
1197 <div class="checkbox">
1198 <label>
1199 <input type="checkbox" name="ui_announcement_active" class="form-check-input" <?=($ui_texts['ui_announcement_active'] == 1) ? 'checked' : null;?>> <?=$lang['admin']['ui_header_announcement_active'];?>
1200 </label>
1201 </div>
1202 </div>
1203 <hr>
1204 <div class="form-group">
1205 <label for="ui_footer"><?=$lang['admin']['ui_footer'];?>:</label>
1206 <textarea class="form-control" id="ui_footer" name="ui_footer" rows="7"><?=$ui_texts['ui_footer'];?></textarea>
1207 </div>
1208 <button class="btn btn-sm btn-success" data-action="edit_selected" data-item="ui" data-id="uitexts" data-api-url='edit/ui_texts' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-check"></span> <?=$lang['admin']['save'];?></button>
1209 </form>
1210 </div>
1211 </div>
1212 </div>
1213 </div>
1214
1215 <div role="tabpanel" class="tab-pane" id="tab-sys-mails">
1216 <div class="panel panel-default">
1217 <div class="panel-heading"><?=$lang['admin']['sys_mails'];?></div>
1218 <div class="panel-body">
1219 <form class="form-horizontal" autocapitalize="none" data-id="admin" autocorrect="off" role="form" method="post">
1220 <div class="form-group">
1221 <label class="control-label col-sm-2" for="mass_from"><?=$lang['admin']['from'];?>:</label>
1222 <div class="col-sm-10">
1223 <input type="email" class="form-control" name="mass_from" value="noreply@<?=getenv('MAILCOW_HOSTNAME');;?>" required>
1224 </div>
1225 </div>
1226 <div class="form-group">
1227 <label class="control-label col-sm-2" for="mass_subject"><?=$lang['admin']['subject'];?>:</label>
1228 <div class="col-sm-10">
1229 <input type="text" class="form-control" name="mass_subject" required>
1230 </div>
1231 </div>
1232 <?php
1233 $domains = array_merge(mailbox('get', 'domains'), mailbox('get', 'alias_domains'));
1234 if (!empty($domains)) {
1235 foreach ($domains as $domain) {
1236 foreach (mailbox('get', 'mailboxes', $domain) as $mailbox) {
1237 $mailboxes[] = $mailbox;
1238 }
1239 }
1240 }
1241 ?>
1242 <div class="form-group">
1243 <label class="control-label col-sm-2" for="mass_subject"><?=$lang['admin']['include_exclude'];?>:
1244 <p class="help-block"><?=$lang['admin']['include_exclude_info'];?></p>
1245 </label>
1246 <div class="col-sm-5">
1247 <label class="control-label" for="mass_exclude"><?=$lang['admin']['excludes'];?>:</label>
1248 <select id="mass_exclude" name="mass_exclude[]" data-live-search="true" data-width="100%" size="30" multiple>
1249 <?php
1250 if (!empty($mailboxes)) {
1251 foreach (array_filter($mailboxes) as $mailbox) {
1252 ?>
1253 <option><?=htmlspecialchars($mailbox);?></option>
1254 <?php
1255 }
1256 }
1257 ?>
1258 </select>
1259 </div>
1260 <div class="col-sm-5">
1261 <label class="control-label" for="mass_include"><?=$lang['admin']['includes'];?>:</label>
1262 <select id="mass_include" name="mass_include[]" data-live-search="true" data-width="100%" size="30" multiple>
1263 <?php
1264 if (!empty($mailboxes)) {
1265 foreach (array_filter($mailboxes) as $mailbox) {
1266 ?>
1267 <option><?=htmlspecialchars($mailbox);?></option>
1268 <?php
1269 }
1270 }
1271 ?>
1272 </select>
1273 </div>
1274 </div>
1275 <div class="form-group">
1276 <label class="control-label col-sm-2" for="mass_text"><?=$lang['admin']['text'];?>:</label>
1277 <div class="col-sm-10">
1278 <textarea class="form-control" rows="10" name="mass_text" id="mass_text" required></textarea>
1279 </div>
1280 </div>
1281 <div class="form-group">
1282 <label class="control-label col-sm-2" for="mass_html"><?=$lang['admin']['html'];?> (<?=$lang['admin']['optional'];?>):</label>
1283 <div class="col-sm-10">
1284 <textarea class="form-control" rows="10" name="mass_html" id="mass_html"></textarea>
1285 <p class="small">↪ <a target="_blank" href="https://templates.mailchimp.com/resources/html-to-text/"><?=$lang['admin']['convert_html_to_text'];?></a></p>
1286 </div>
1287 </div>
1288 <div class="form-group">
1289 <div class="col-sm-offset-2 col-sm-10">
1290 <label>
1291 <input type="checkbox" id="mass_disarm"> <?=$lang['admin']['activate_send'];?>
1292 </label>
1293 </div>
1294 </div>
1295 <div class="form-group">
1296 <div class="col-sm-offset-2 col-sm-10">
1297 <button class="btn btn-default" type="submit" id="mass_send" name="mass_send" disabled><span class="glyphicon glyphicon-envelope"></span> <?=$lang['admin']['send'];?></button>
1298 </div>
1299 </div>
1300 </form>
1301 </div>
1302 </div>
1303 </div>
1304
1305 <div role="tabpanel" class="tab-pane" id="tab-mailq">
1306 <div class="panel panel-default">
1307 <div class="panel-heading">
1308 <?=$lang['admin']['queue_manager'];?> <span class="badge badge-info table-lines"></span>
1309 <div class="btn-group pull-right">
1310 <button class="btn btn-xs btn-default refresh_table" data-draw="draw_queue" data-table="queuetable"><?=$lang['admin']['refresh'];?></button>
1311 </div>
1312 </div>
1313 <div class="panel-body">
1314 <div class="table-responsive">
1315 <table class="table table-striped table-condensed" id="queuetable"></table>
1316 </div>
1317 <div class="mass-actions-admin">
1318 <div class="btn-group">
1319 <a class="btn btn-sm btn-default" id="toggle_multi_select_all" data-id="mailqitems" href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></a>
1320 <a class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['mailbox']['quick_actions'];?> <span class="caret"></span></a>
1321 <ul class="dropdown-menu">
1322 <li><a data-toggle="tooltip" title="postqueue -i" data-action="edit_selected" data-id="mailqitems" data-api-url='edit/mailq' data-api-attr='{"action":"deliver"}' href="#"><?=$lang['admin']['queue_deliver_mail'];?></a></li>
1323 <li><a data-toggle="tooltip" title="postsuper -H" data-action="edit_selected" data-id="mailqitems" data-api-url='edit/mailq' data-api-attr='{"action":"unhold"}' href="#"><?=$lang['admin']['queue_unhold_mail'];?></a></li>
1324 <li><a data-toggle="tooltip" title="postsuper -h" data-action="edit_selected" data-id="mailqitems" data-api-url='edit/mailq' data-api-attr='{"action":"hold"}' href="#"><?=$lang['admin']['queue_hold_mail'];?></a></li>
1325 <li role="separator" class="divider"></li>
1326 <li><a data-toggle="tooltip" title="postsuper -d" data-action="delete_selected" data-id="mailqitems" data-api-url='delete/mailq' href="#"><?=$lang['mailbox']['remove'];?></a></li>
1327 </ul>
1328 <a class="btn btn-sm btn-primary"
1329 data-action="edit_selected"
1330 data-item="mailqitems-all"
1331 data-api-url='edit/mailq'
1332 data-api-attr='{"action":"flush"}'
1333 data-toggle="tooltip" title="postqueue -f"
1334 href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['admin']['flush_queue'];?></a>
1335 <a class="btn btn-sm btn-danger"
1336 id="super_delete"
1337 data-action="edit_selected"
1338 data-item="mailqitems-all"
1339 data-api-url='edit/mailq'
1340 data-api-attr='{"action":"super_delete"}'
1341 data-toggle="tooltip" title="postsuper -d ALL"
1342 href="#"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> <?=$lang['admin']['delete_queue'];?></a>
1343 </div>
1344 </div>
1345 </div>
1346 </div>
1347 </div>
1348
1349 <div role="tabpanel" class="tab-pane" id="tab-globalfilter-regex">
1350 <div class="panel panel-default">
1351 <div class="panel-heading">
1352 <?=$lang['admin']['rspamd_global_filters'];?>
1353 </div>
1354 <div class="panel-body">
1355 <p><?=$lang['admin']['rspamd_global_filters_info'];?></p>
1356 <div id="confirm_show_rspamd_global_filters" class="<?=($_SESSION['show_rspamd_global_filters'] === true) ? 'hidden' : '';?>">
1357 <div class="form-group">
1358 <div class="col-sm-offset-2 col-sm-10">
1359 <label>
1360 <input type="checkbox" id="show_rspamd_global_filters"> <?=$lang['admin']['rspamd_global_filters_agree'];?>
1361 </label>
1362 </div>
1363 </div>
1364 </div>
1365 <div id="rspamd_global_filters" class="<?=($_SESSION['show_rspamd_global_filters'] !== true) ? 'hidden' : '';?>">
1366 <hr>
1367 <span class="anchor" id="regexmaps"></span>
1368 <h4><?=$lang['admin']['regex_maps'];?></h4>
1369 <p><?=$lang['admin']['rspamd_global_filters_regex'];?></p>
1370 <ul>
1371 <?php
1372 foreach ($RSPAMD_MAPS['regex'] as $rspamd_regex_desc => $rspamd_regex_map):
1373 ?>
1374 <li><a href="#<?=$rspamd_regex_map;?>"><?=$rspamd_regex_desc;?></a> (<small><?=$rspamd_regex_map;?></small>)</li>
1375 <?php
1376 endforeach;
1377 ?>
1378 </ul>
1379 <?php
1380 foreach ($RSPAMD_MAPS['regex'] as $rspamd_regex_desc => $rspamd_regex_map):
1381 ?>
1382 <hr>
1383 <span class="anchor" id="<?=$rspamd_regex_map;?>"></span>
1384 <form class="form-horizontal" data-id="<?=$rspamd_regex_map;?>" role="form" method="post">
1385 <div class="form-group">
1386 <label class="control-label col-sm-3" for="<?=$rspamd_regex_map;?>"><?=$rspamd_regex_desc;?><br><small><?=$rspamd_regex_map;?></small></label>
1387 <div class="col-sm-9">
1388 <textarea id="<?=$rspamd_regex_map;?>" spellcheck="false" autocorrect="off" autocapitalize="none" class="form-control textarea-code" rows="10" name="rspamd_map_data" required><?=file_get_contents('/rspamd_custom_maps/' . $rspamd_regex_map);?></textarea>
1389 </div>
1390 </div>
1391 <div class="form-group">
1392 <div class="col-sm-offset-3 col-sm-9">
1393 <button class="btn btn-xs btn-default validate_rspamd_regex" data-regex-map="<?=$rspamd_regex_map;?>" href="#"><?=$lang['add']['validate'];?></button>
1394 <button class="btn btn-xs btn-success submit_rspamd_regex" data-action="edit_selected" data-id="<?=$rspamd_regex_map;?>" data-item="<?=htmlspecialchars($rspamd_regex_map);?>" data-api-url='edit/rspamd-map' data-api-attr='{}' href="#" disabled><?=$lang['edit']['save'];?></button>
1395 </div>
1396 </div>
1397 </form>
1398 <?php
1399 endforeach;
1400 ?>
1401 </div>
1402 </div>
1403 </div>
1404 </div>
1405
1406 </div> <!-- /tab-content -->
1407 </div> <!-- /col-md-12 -->
1408 </div> <!-- /row -->
1409</div> <!-- /container -->
1410<?php
1411require_once $_SERVER['DOCUMENT_ROOT'] . '/modals/admin.php';
1412?>
1413<script type='text/javascript'>
1414<?php
1415$lang_admin = json_encode($lang['admin']);
1416echo "var lang = ". $lang_admin . ";\n";
1417echo "var admin_username = '". $_SESSION['mailcow_cc_username'] . "';\n";
1418echo "var csrf_token = '". $_SESSION['CSRF']['TOKEN'] . "';\n";
1419echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
1420echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n";
1421?>
1422</script>
1423<?php
1424$js_minifier->add('/web/js/site/admin.js');
1425$js_minifier->add('/web/js/presets/rspamd.js');
1426$js_minifier->add('/web/js/site/pwgen.js');
1427require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
1428} else {
1429 header('Location: /');
1430 exit();
1431}
1432?>