blob: 3a0bb04b1bec105f8ed88ee34827971d3737fd5a [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
3$AuthUsers = array("admin", "domainadmin", "user");
4if (!isset($_SESSION['mailcow_cc_role']) OR !in_array($_SESSION['mailcow_cc_role'], $AuthUsers)) {
5 header('Location: /');
6 exit();
7}
8require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
9?>
10<div class="container">
11 <div class="row">
12 <div class="col-md-12">
13 <div class="panel panel-default">
14 <div class="panel-heading">
15 <h3 class="panel-title"><?=$lang['edit']['title'];?></h3>
16 </div>
17 <div class="panel-body">
18<?php
19if (isset($_SESSION['mailcow_cc_role'])) {
20 if ($_SESSION['mailcow_cc_role'] == "admin" || $_SESSION['mailcow_cc_role'] == "domainadmin") {
21 if (isset($_GET["alias"]) &&
22 !empty($_GET["alias"])) {
23 $alias = html_entity_decode(rawurldecode($_GET["alias"]));
24 $result = mailbox('get', 'alias_details', $alias);
25 if (!empty($result)) {
26 ?>
27 <h4><?=$lang['edit']['alias'];?></h4>
28 <br>
29 <form class="form-horizontal" data-id="editalias" role="form" method="post">
30 <input type="hidden" value="0" name="active">
31 <?php if (getenv('SKIP_SOGO') != "y") { ?>
32 <input type="hidden" value="0" name="sogo_visible">
33 <?php } ?>
34 <div class="form-group">
35 <label class="control-label col-sm-2" for="address"><?=$lang['edit']['alias'];?></label>
36 <div class="col-sm-10">
37 <input class="form-control" type="text" name="address" value="<?=htmlspecialchars($result['address']);?>" />
38 </div>
39 </div>
40 <div class="form-group">
41 <label class="control-label col-sm-2" for="goto"><?=$lang['edit']['target_address'];?></label>
42 <div class="col-sm-10">
43 <textarea id="textarea_alias_goto" class="form-control" autocapitalize="none" autocorrect="off" rows="10" id="goto" name="goto" required><?= (!preg_match('/^(null|ham|spam)@localhost$/i', $result['goto'])) ? str_replace(',', ', ', htmlspecialchars($result['goto'])) : null; ?></textarea>
44 <div class="checkbox">
45 <label><input class="goto_checkbox" type="checkbox" value="1" name="goto_null" <?= ($result['goto'] == "null@localhost") ? "checked" : null; ?>> <?=$lang['add']['goto_null'];?></label>
46 </div>
47 <div class="checkbox">
48 <label><input class="goto_checkbox" type="checkbox" value="1" name="goto_spam" <?= ($result['goto'] == "spam@localhost") ? "checked" : null; ?>> <?=$lang['add']['goto_spam'];?></label>
49 </div>
50 <div class="checkbox">
51 <label><input class="goto_checkbox" type="checkbox" value="1" name="goto_ham" <?= ($result['goto'] == "ham@localhost") ? "checked" : null; ?>> <?=$lang['add']['goto_ham'];?></label>
52 </div>
53 <?php if (getenv('SKIP_SOGO') != "y") { ?>
54 <hr>
55 <div class="checkbox">
56 <label><input type="checkbox" value="1" name="sogo_visible" <?php if (isset($result['sogo_visible']) && $result['sogo_visible']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['sogo_visible'];?></label>
57 </div>
58 <p class="help-block"><?=$lang['edit']['sogo_visible_info'];?></p>
59 <?php } ?>
60 </div>
61 </div>
62 <hr>
63 <div class="form-group">
64 <label class="control-label col-sm-2" for="private_"><?=$lang['edit']['private_comment'];?></label>
65 <div class="col-sm-10">
66 <input maxlength="160" class="form-control" type="text" name="private_comment" value="<?=htmlspecialchars($result['private_comment']);?>" />
67 </div>
68 </div>
69 <div class="form-group">
70 <label class="control-label col-sm-2" for="public_comment"><?=$lang['edit']['public_comment'];?></label>
71 <div class="col-sm-10">
72 <input maxlength="160" class="form-control" type="text" name="public_comment" value="<?=htmlspecialchars($result['public_comment']);?>" />
73 </div>
74 </div>
75 <hr>
76 <div class="form-group">
77 <div class="col-sm-offset-2 col-sm-10">
78 <div class="checkbox">
79 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
80 </div>
81 </div>
82 </div>
83 <div class="form-group">
84 <div class="col-sm-offset-2 col-sm-10">
85 <button class="btn btn-success" data-action="edit_selected" data-id="editalias" data-item="<?=htmlspecialchars($alias);?>" data-api-url='edit/alias' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
86 </div>
87 </div>
88 </form>
89 <?php
90 }
91 else {
92 ?>
93 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
94 <?php
95 }
96 }
97 elseif (isset($_GET['domainadmin'])) {
98 $domain_admin = $_GET["domainadmin"];
99 $result = domain_admin('details', $domain_admin);
100 if (!empty($result)) {
101 ?>
102 <h4><?=$lang['edit']['domain_admin'];?></h4>
103 <br>
104 <form class="form-horizontal" data-id="editdomainadmin" role="form" method="post" autocomplete="off">
105 <input type="hidden" value="0" name="active">
106 <div class="form-group">
107 <label class="control-label col-sm-2" for="username_new"><?=$lang['edit']['username'];?></label>
108 <div class="col-sm-10">
109 <input class="form-control" type="text" name="username_new" value="<?=htmlspecialchars($domain_admin);?>" />
110 </div>
111 </div>
112 <div class="form-group">
113 <label class="control-label col-sm-2" for="domains"><?=$lang['edit']['domains'];?></label>
114 <div class="col-sm-10">
115 <select data-live-search="true" class="full-width-select" name="domains" multiple required>
116 <?php
117 foreach ($result['selected_domains'] as $domain):
118 ?>
119 <option selected><?=htmlspecialchars($domain);?></option>
120 <?php
121 endforeach;
122 foreach ($result['unselected_domains'] as $domain):
123 ?>
124 <option><?=htmlspecialchars($domain);?></option>
125 <?php
126 endforeach;
127 ?>
128 </select>
129 </div>
130 </div>
131 <div class="form-group">
132 <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
133 <div class="col-sm-10">
134 <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="" autocomplete="new-password">
135 </div>
136 </div>
137 <div class="form-group">
138 <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
139 <div class="col-sm-10">
140 <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">
141 </div>
142 </div>
143 <div class="form-group">
144 <div class="col-sm-offset-2 col-sm-10">
145 <div class="checkbox">
146 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
147 </div>
148 </div>
149 </div>
150 <div class="form-group">
151 <div class="col-sm-offset-2 col-sm-10">
152 <div class="checkbox">
153 <label><input type="checkbox" value="1" name="disable_tfa"> <?=$lang['tfa']['disable_tfa'];?></label>
154 </div>
155 </div>
156 </div>
157 <div class="form-group">
158 <div class="col-sm-offset-2 col-sm-10">
159 <button class="btn btn-success" data-action="edit_selected" data-api-reload-location="/admin" data-id="editdomainadmin" data-item="<?=$domain_admin;?>" data-api-url='edit/domain-admin' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
160 </div>
161 </div>
162 </form>
163 <form data-id="daacl" class="form-inline well" method="post">
164 <div class="row">
165 <div class="col-sm-1">
166 <p class="help-block">ACL</p>
167 </div>
168 <div class="col-sm-10">
169 <div class="form-group">
170 <select id="da_acl" name="da_acl" size="10" multiple>
171 <?php
172 $da_acls = acl('get', 'domainadmin', $domain_admin);
173 foreach ($da_acls as $acl => $val):
174 ?>
175 <option value="<?=$acl;?>" <?=($val == 1) ? 'selected' : null;?>><?=$lang['acl'][$acl];?></option>
176 <?php
177 endforeach;
178 ?>
179 </select>
180 </div>
181 <div class="form-group">
182 <button class="btn btn-default" data-action="edit_selected" data-id="daacl" data-item="<?=htmlspecialchars($domain_admin);?>" data-api-url='edit/da-acl' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
183 </div>
184 </div>
185 </div>
186 </form>
187 <?php
188 }
189 else {
190 ?>
191 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
192 <?php
193 }
194 }
195 elseif (isset($_GET['admin'])) {
196 $admin = $_GET["admin"];
197 $result = admin('details', $admin);
198 if (!empty($result)) {
199 ?>
200 <h4><?=$lang['edit']['domain_admin'];?></h4>
201 <br>
202 <form class="form-horizontal" data-id="editadmin" role="form" method="post" autocomplete="off">
203 <input type="hidden" value="0" name="active">
204 <div class="form-group">
205 <label class="control-label col-sm-2" for="username_new"><?=$lang['edit']['username'];?></label>
206 <div class="col-sm-10">
207 <input class="form-control" type="text" name="username_new" value="<?=htmlspecialchars($admin);?>" />
208 </div>
209 </div>
210 <div class="form-group">
211 <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
212 <div class="col-sm-10">
213 <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="" autocomplete="new-password">
214 </div>
215 </div>
216 <div class="form-group">
217 <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
218 <div class="col-sm-10">
219 <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">
220 </div>
221 </div>
222 <div class="form-group">
223 <div class="col-sm-offset-2 col-sm-10">
224 <div class="checkbox">
225 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
226 </div>
227 </div>
228 </div>
229 <div class="form-group">
230 <div class="col-sm-offset-2 col-sm-10">
231 <div class="checkbox">
232 <label><input type="checkbox" value="1" name="disable_tfa"> <?=$lang['tfa']['disable_tfa'];?></label>
233 </div>
234 </div>
235 </div>
236 <div class="form-group">
237 <div class="col-sm-offset-2 col-sm-10">
238 <button class="btn btn-success" data-action="edit_selected" data-api-reload-location="/admin" data-id="editadmin" data-item="<?=$admin;?>" data-api-url='edit/admin' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
239 </div>
240 </div>
241 </form>
242 <?php
243 }
244 else {
245 ?>
246 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
247 <?php
248 }
249 }
250 elseif (isset($_GET['domain']) &&
251 is_valid_domain_name($_GET["domain"]) &&
252 !empty($_GET["domain"])) {
253 $domain = $_GET["domain"];
254 $result = mailbox('get', 'domain_details', $domain);
255 $rl = ratelimit('get', 'domain', $domain);
256 $rlyhosts = relayhost('get');
257 if (!empty($result)) {
258 ?>
259 <h4><?=$lang['edit']['domain'];?></h4>
260 <form data-id="editdomain" class="form-horizontal" role="form" method="post">
261 <input type="hidden" value="0" name="active">
262 <input type="hidden" value="0" name="backupmx">
263 <input type="hidden" value="0" name="gal">
264 <input type="hidden" value="0" name="relay_all_recipients">
265 <input type="hidden" value="0" name="relay_unknown_only">
266 <div class="form-group" data-acl="<?=$_SESSION['acl']['domain_desc'];?>">
267 <label class="control-label col-sm-2" for="description"><?=$lang['edit']['description'];?></label>
268 <div class="col-sm-10">
269 <input type="text" class="form-control" name="description" value="<?=htmlspecialchars($result['description']);?>">
270 </div>
271 </div>
272 <?php
273 if ($_SESSION['mailcow_cc_role'] == "admin") {
274 ?>
275 <div class="form-group">
276 <label class="control-label col-sm-2" for="aliases"><?=$lang['edit']['max_aliases'];?></label>
277 <div class="col-sm-10">
278 <input type="number" class="form-control" name="aliases" value="<?=intval($result['max_num_aliases_for_domain']);?>">
279 </div>
280 </div>
281 <div class="form-group">
282 <label class="control-label col-sm-2" for="mailboxes"><?=$lang['edit']['max_mailboxes'];?></label>
283 <div class="col-sm-10">
284 <input type="number" class="form-control" name="mailboxes" value="<?=intval($result['max_num_mboxes_for_domain']);?>">
285 </div>
286 </div>
287 <div class="form-group">
288 <label class="control-label col-sm-2" for="defquota"><?=$lang['edit']['mailbox_quota_def'];?></label>
289 <div class="col-sm-10">
290 <input type="number" class="form-control" name="defquota" value="<?=intval($result['def_quota_for_mbox'] / 1048576);?>">
291 </div>
292 </div>
293 <div class="form-group">
294 <label class="control-label col-sm-2" for="maxquota"><?=$lang['edit']['max_quota'];?></label>
295 <div class="col-sm-10">
296 <input type="number" class="form-control" name="maxquota" value="<?=intval($result['max_quota_for_mbox'] / 1048576);?>">
297 </div>
298 </div>
299 <div class="form-group">
300 <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['domain_quota'];?></label>
301 <div class="col-sm-10">
302 <input type="number" class="form-control" name="quota" value="<?=intval($result['max_quota_for_domain'] / 1048576);?>">
303 </div>
304 </div>
305 <div class="form-group">
306 <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['relayhost'];?></label>
307 <div class="col-sm-10">
308 <select data-live-search="true" name="relayhost" class="form-control">
309 <?php
310 foreach ($rlyhosts as $rlyhost) {
311 ?>
312 <option value="<?=$rlyhost['id'];?>" <?=($result['relayhost'] == $rlyhost['id']) ? 'selected' : null;?>>ID <?=$rlyhost['id'];?>: <?=$rlyhost['hostname'];?> (<?=$rlyhost['username'];?>)</option>
313 <?php
314 }
315 ?>
316 <option value="" <?=($result['relayhost'] == "0") ? 'selected' : null;?>>None</option>
317 </select>
318 </div>
319 </div>
320 <div class="form-group">
321 <label class="control-label col-sm-2"><?=$lang['edit']['backup_mx_options'];?></label>
322 <div class="col-sm-10">
323 <div class="checkbox">
324 <label><input type="checkbox" value="1" name="backupmx" <?=(isset($result['backupmx']) && $result['backupmx']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_domain'];?></label>
325 <br>
326 <label><input type="checkbox" value="1" name="relay_all_recipients" <?=(isset($result['relay_all_recipients']) && $result['relay_all_recipients']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_all'];?></label>
327 <p><?=$lang['edit']['relay_all_info'];?></p>
328 <label><input type="checkbox" value="1" name="relay_unknown_only" <?=(isset($result['relay_unknown_only']) && $result['relay_unknown_only']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_unknown_only'];?></label>
329 <br>
330 <p><?=$lang['edit']['relay_transport_info'];?></p>
331 <hr style="margin:25px 0px 0px 0px">
332 </div>
333 </div>
334 </div>
335 <?php
336 }
337 ?>
338 <div class="form-group">
339 <div class="col-sm-offset-2 col-sm-10">
340 <div class="checkbox">
341 <label><input type="checkbox" value="1" name="gal" <?=(isset($result['gal']) && $result['gal']=="1") ? "checked" : null;?>> <?=$lang['edit']['gal'];?></label>
342 <small class="help-block"><?=$lang['edit']['gal_info'];?></small>
343 </div>
344 </div>
345 </div>
346 <div class="form-group">
347 <div class="col-sm-offset-2 col-sm-10">
348 <div class="checkbox">
349 <label><input type="checkbox" value="1" name="active" <?=(isset($result['active']) && $result['active']=="1") ? "checked" : null;?> <?=($_SESSION['mailcow_cc_role'] == "admin") ? null : "disabled";?>> <?=$lang['edit']['active'];?></label>
350 </div>
351 </div>
352 </div>
353 <div class="form-group">
354 <div class="col-sm-offset-2 col-sm-10">
355 <button class="btn btn-success" data-action="edit_selected" data-id="editdomain" data-item="<?=$domain;?>" data-api-url='edit/domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
356 </div>
357 </div>
358 </form>
359 <?php
360 if (!empty($dkim = dkim('details', $domain))) {
361 ?>
362 <hr>
363 <div class="row">
364 <div class="col-xs-2">
365 <p>Domain: <strong><?=htmlspecialchars($result['domain_name']);?></strong> (<?=$dkim['dkim_selector'];?>._domainkey)</p>
366 </div>
367 <div class="col-xs-10">
368 <pre><?=$dkim['dkim_txt'];?></pre>
369 </div>
370 </div>
371 <?php
372 }
373 ?>
374 <hr>
375 <form data-id="domratelimit" class="form-inline well" method="post">
376 <div class="form-group">
377 <label class="control-label"><?=$lang['acl']['ratelimit'];?></label>
378 <input name="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" autocomplete="off" class="form-control" placeholder="disabled">
379 </div>
380 <div class="form-group">
381 <select name="rl_frame" class="form-control">
382 <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>>msgs / second</option>
383 <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>>msgs / minute</option>
384 <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>>msgs / hour</option>
385 <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>>msgs / day</option>
386 </select>
387 </div>
388 <div class="form-group">
389 <button data-acl="<?=$_SESSION['acl']['ratelimit'];?>" class="btn btn-default" data-action="edit_selected" data-id="domratelimit" data-item="<?=$domain;?>" data-api-url='edit/rl-domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
390 </div>
391 </form>
392 <hr>
393 <div class="row">
394 <div class="col-sm-6">
395 <h4><?=$lang['user']['spamfilter_wl'];?></h4>
396 <p><?=$lang['user']['spamfilter_wl_desc'];?></p>
397 <div class="table-responsive">
398 <table class="table table-striped table-condensed" id="wl_policy_domain_table"></table>
399 </div>
400 <div class="mass-actions-user">
401 <div class="btn-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
402 <a class="btn btn-sm btn-default" id="toggle_multi_select_all" data-id="policy_wl_domain" href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></a>
403 <a class="btn btn-sm btn-danger" data-action="delete_selected" data-id="policy_wl_domain" data-api-url='delete/domain-policy' href="#"><?=$lang['mailbox']['remove'];?></a></li>
404 </div>
405 </div>
406 <form class="form-inline" data-id="add_wl_policy_domain">
407 <div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
408 <input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>
409 <span class="input-group-btn">
410 <button class="btn btn-default" data-action="add_item" data-id="add_wl_policy_domain" data-api-url='add/domain-policy' data-api-attr='{"domain":"<?= $domain; ?>","object_list":"wl"}' href="#"><?=$lang['user']['spamfilter_table_add'];?></button>
411 </span>
412 </div>
413 </form>
414 </div>
415 <div class="col-sm-6">
416 <h4><?=$lang['user']['spamfilter_bl'];?></h4>
417 <p><?=$lang['user']['spamfilter_bl_desc'];?></p>
418 <div class="table-responsive">
419 <table class="table table-striped table-condensed" id="bl_policy_domain_table"></table>
420 </div>
421 <div class="mass-actions-user">
422 <div class="btn-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
423 <a class="btn btn-sm btn-default" id="toggle_multi_select_all" data-id="policy_bl_domain" href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['mailbox']['toggle_all'];?></a>
424 <a class="btn btn-sm btn-danger" data-action="delete_selected" data-id="policy_bl_domain" data-api-url='delete/domain-policy' href="#"><?=$lang['mailbox']['remove'];?></a></li>
425 </div>
426 </div>
427 <form class="form-inline" data-id="add_bl_policy_domain">
428 <div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
429 <input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>
430 <span class="input-group-btn">
431 <button class="btn btn-default" data-action="add_item" data-id="add_bl_policy_domain" data-api-url='add/domain-policy' data-api-attr='{"domain":"<?= $domain; ?>","object_list":"bl"}' href="#"><?=$lang['user']['spamfilter_table_add'];?></button>
432 </span>
433 </div>
434 </form>
435 </div>
436 </div>
437 <?php
438 }
439 else {
440 ?>
441 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
442 <?php
443 }
444 }
445 elseif (isset($_GET['oauth2client']) &&
446 is_numeric($_GET["oauth2client"]) &&
447 !empty($_GET["oauth2client"])) {
448 $oauth2client = $_GET["oauth2client"];
449 $result = oauth2('details', 'client', $oauth2client);
450 if (!empty($result)) {
451 ?>
452 <h4>OAuth2</h4>
453 <form data-id="oauth2client" class="form-horizontal" role="form" method="post">
454 <div class="form-group">
455 <label class="control-label col-sm-2" for="client_id"><?=$lang['edit']['client_id'];?></label>
456 <div class="col-sm-10">
457 <input type="text" class="form-control" name="client_id" id="client_id" value="<?=htmlspecialchars($result['client_id']);?>" disabled>
458 </div>
459 </div>
460 <div class="form-group">
461 <label class="control-label col-sm-2" for="client_secret"><?=$lang['edit']['client_secret'];?></label>
462 <div class="col-sm-10">
463 <input type="text" class="form-control" name="client_secret" id="client_secret" value="<?=htmlspecialchars($result['client_secret']);?>" disabled>
464 </div>
465 </div>
466 <div class="form-group">
467 <label class="control-label col-sm-2" for="scope"><?=$lang['edit']['scope'];?></label>
468 <div class="col-sm-10">
469 <input type="text" class="form-control" name="scope" id="scope" value="<?=htmlspecialchars($result['scope']);?>" disabled>
470 </div>
471 </div>
472 <div class="form-group">
473 <label class="control-label col-sm-2" for="redirect_uri"><?=$lang['edit']['redirect_uri'];?></label>
474 <div class="col-sm-10">
475 <input type="text" class="form-control" name="redirect_uri" id="redirect_uri" value="<?=htmlspecialchars($result['redirect_uri']);?>">
476 </div>
477 </div>
478 <div class="form-group">
479 <div class="col-sm-offset-2 col-sm-10">
480 <button class="btn btn-default" data-action="edit_selected" data-id="oauth2client" data-item="<?=$oauth2client;?>" data-api-url='edit/oauth2-client' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
481 </div>
482 </div>
483 </form>
484 <?php
485 }
486 else {
487 ?>
488 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
489 <?php
490 }
491 }
492 elseif (isset($_GET['aliasdomain']) &&
493 is_valid_domain_name(html_entity_decode(rawurldecode($_GET["aliasdomain"]))) &&
494 !empty($_GET["aliasdomain"])) {
495 $alias_domain = html_entity_decode(rawurldecode($_GET["aliasdomain"]));
496 $result = mailbox('get', 'alias_domain_details', $alias_domain);
497 $rl = ratelimit('get', 'domain', $alias_domain);
498 if (!empty($result)) {
499 ?>
500 <h4><?=$lang['edit']['edit_alias_domain'];?></h4>
501 <form class="form-horizontal" data-id="editaliasdomain" role="form" method="post">
502 <input type="hidden" value="0" name="active">
503 <div class="form-group">
504 <label class="control-label col-sm-2" for="target_domain"><?=$lang['edit']['target_domain'];?></label>
505 <div class="col-sm-10">
506 <select class="full-width-select" data-live-search="true" id="addSelectDomain" name="target_domain" required>
507 <?php
508 foreach (mailbox('get', 'domains') as $domain):
509 ?>
510 <option <?=($result['target_domain'] != $domain) ?: 'selected';?>><?=htmlspecialchars($domain);?></option>
511 <?php
512 endforeach;
513 ?>
514 </select>
515 </div>
516 </div>
517 <div class="form-group">
518 <div class="col-sm-offset-2 col-sm-10">
519 <div class="checkbox">
520 <label><input type="checkbox" value="1" name="active" <?=(isset($result['active']) && $result['active']=="1") ? "checked" : null ?>> <?=$lang['edit']['active'];?></label>
521 </div>
522 </div>
523 </div>
524 <div class="form-group">
525 <div class="col-sm-offset-2 col-sm-10">
526 <button class="btn btn-success" data-action="edit_selected" data-id="editaliasdomain" data-item="<?=$alias_domain;?>" data-api-url='edit/alias-domain' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
527 </div>
528 </div>
529 </form>
530 <hr>
531 <form data-id="domratelimit" class="form-inline well" method="post">
532 <div class="form-group">
533 <label class="control-label"><?=$lang['acl']['ratelimit'];?></label>
534 <input name="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" autocomplete="off" class="form-control" placeholder="disabled">
535 </div>
536 <div class="form-group">
537 <select name="rl_frame" class="form-control">
538 <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>>msgs / second</option>
539 <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>>msgs / minute</option>
540 <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>>msgs / hour</option>
541 <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>>msgs / day</option>
542 </select>
543 </div>
544 <div class="form-group">
545 <button class="btn btn-default" data-action="edit_selected" data-id="domratelimit" data-item="<?=$alias_domain;?>" data-api-url='edit/rl-domain' data-api-attr='{}' href="#"><?=$lang['admin']['save'];?></button>
546 </div>
547 </form>
548 <?php
549 if (!empty($dkim = dkim('details', $alias_domain))) {
550 ?>
551 <hr>
552 <div class="row">
553 <div class="col-xs-2">
554 <p>Domain: <strong><?=htmlspecialchars($result['alias_domain']);?></strong> (<?=$dkim['dkim_selector'];?>._domainkey)</p>
555 </div>
556 <div class="col-xs-10">
557 <pre><?=$dkim['dkim_txt'];?></pre>
558 </div>
559 </div>
560 <?php
561 }
562 }
563 else {
564 ?>
565 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
566 <?php
567 }
568 }
569 elseif (isset($_GET['mailbox']) && filter_var(html_entity_decode(rawurldecode($_GET["mailbox"])), FILTER_VALIDATE_EMAIL) && !empty($_GET["mailbox"])) {
570 $mailbox = html_entity_decode(rawurldecode($_GET["mailbox"]));
571 $result = mailbox('get', 'mailbox_details', $mailbox);
572 $rl = ratelimit('get', 'mailbox', $mailbox);
573 $pushover_data = pushover('get', $mailbox);
574 $quarantine_notification = mailbox('get', 'quarantine_notification', $mailbox);
575 $quarantine_category = mailbox('get', 'quarantine_category', $mailbox);
576 $get_tls_policy = mailbox('get', 'tls_policy', $mailbox);
577 if (!empty($result)) {
578 ?>
579 <h4><?=$lang['edit']['mailbox'];?></h4>
580 <form class="form-horizontal" data-id="editmailbox" role="form" method="post">
581 <input type="hidden" value="default" name="sender_acl">
582 <input type="hidden" value="0" name="force_pw_update">
583 <input type="hidden" value="0" name="sogo_access">
584 <input type="hidden" value="0" name="protocol_access">
585 <div class="form-group">
586 <label class="control-label col-sm-2" for="name"><?=$lang['edit']['full_name'];?></label>
587 <div class="col-sm-10">
588 <input type="text" class="form-control" name="name" value="<?=htmlspecialchars($result['name'], ENT_QUOTES, 'UTF-8');?>">
589 </div>
590 </div>
591 <div class="form-group">
592 <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['quota_mb'];?>
593 <br><span id="quotaBadge" class="badge">max. <?=intval($result['max_new_quota'] / 1048576)?> MiB</span>
594 </label>
595 <div class="col-sm-10">
596 <input type="number" name="quota" style="width:100%" min="0" max="<?=intval($result['max_new_quota'] / 1048576);?>" value="<?=intval($result['quota']) / 1048576;?>" class="form-control">
597 <small class="help-block">0 = ∞</small>
598 </div>
599 </div>
600 <div class="form-group">
601 <label class="control-label col-sm-2" for="sender_acl"><?=$lang['edit']['sender_acl'];?></label>
602 <div class="col-sm-10">
603 <select data-live-search="true" data-width="100%" style="width:100%" id="editSelectSenderACL" name="sender_acl" size="10" multiple>
604 <?php
605 $sender_acl_handles = mailbox('get', 'sender_acl_handles', $mailbox);
606
607 foreach ($sender_acl_handles['sender_acl_domains']['ro'] as $domain):
608 ?>
609 <option data-subtext="Admin" value="<?=htmlspecialchars($domain);?>" disabled selected><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>
610 <?php
611 endforeach;
612
613 foreach ($sender_acl_handles['sender_acl_addresses']['ro'] as $alias):
614 ?>
615 <option data-subtext="Admin" disabled selected><?=htmlspecialchars($alias);?></option>
616 <?php
617 endforeach;
618
619 foreach ($sender_acl_handles['fixed_sender_aliases'] as $alias):
620 ?>
621 <option data-subtext="Alias" disabled selected><?=htmlspecialchars($alias);?></option>
622 <?php
623 endforeach;
624
625 foreach ($sender_acl_handles['sender_acl_domains']['rw'] as $domain):
626 ?>
627 <option value="<?=htmlspecialchars($domain);?>" selected><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>
628 <?php
629 endforeach;
630
631 foreach ($sender_acl_handles['sender_acl_domains']['selectable'] as $domain):
632 ?>
633 <option value="<?=htmlspecialchars($domain);?>"><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>
634 <?php
635 endforeach;
636
637 foreach ($sender_acl_handles['sender_acl_addresses']['rw'] as $address):
638 ?>
639 <option selected><?=htmlspecialchars($address);?></option>
640 <?php
641 endforeach;
642
643 foreach ($sender_acl_handles['sender_acl_addresses']['selectable'] as $address):
644 ?>
645 <option><?=htmlspecialchars($address);?></option>
646 <?php
647 endforeach;
648
649 // Generated here, but used in extended_sender_acl
650 if (!empty($sender_acl_handles['external_sender_aliases'])) {
651 $ext_sender_acl = implode(', ', $sender_acl_handles['external_sender_aliases']);
652 }
653 else {
654 $ext_sender_acl = '';
655 }
656
657 ?>
658 </select>
659 <div style="display:none" id="sender_acl_disabled"><?=$lang['edit']['sender_acl_disabled'];?></div>
660 <small class="help-block"><?=$lang['edit']['sender_acl_info'];?></small>
661 </div>
662 </div>
663 <div class="form-group">
664 <label class="control-label col-sm-2"><?=$lang['user']['quarantine_notification'];?></label>
665 <div class="col-sm-10">
666 <div class="btn-group" data-acl="<?=$_SESSION['acl']['quarantine_notification'];?>">
667 <button type="button" class="btn btn-sm btn-default <?=($quarantine_notification == "never") ? "active" : null;?>"
668 data-action="edit_selected"
669 data-item="<?= htmlentities($mailbox); ?>"
670 data-id="quarantine_notification"
671 data-api-url='edit/quarantine_notification'
672 data-api-attr='{"quarantine_notification":"never"}'><?=$lang['user']['never'];?></button>
673 <button type="button" class="btn btn-sm btn-default <?=($quarantine_notification == "hourly") ? "active" : null;?>"
674 data-action="edit_selected"
675 data-item="<?= htmlentities($mailbox); ?>"
676 data-id="quarantine_notification"
677 data-api-url='edit/quarantine_notification'
678 data-api-attr='{"quarantine_notification":"hourly"}'><?=$lang['user']['hourly'];?></button>
679 <button type="button" class="btn btn-sm btn-default <?=($quarantine_notification == "daily") ? "active" : null;?>"
680 data-action="edit_selected"
681 data-item="<?= htmlentities($mailbox); ?>"
682 data-id="quarantine_notification"
683 data-api-url='edit/quarantine_notification'
684 data-api-attr='{"quarantine_notification":"daily"}'><?=$lang['user']['daily'];?></button>
685 <button type="button" class="btn btn-sm btn-default <?=($quarantine_notification == "weekly") ? "active" : null;?>"
686 data-action="edit_selected"
687 data-item="<?= htmlentities($mailbox); ?>"
688 data-id="quarantine_notification"
689 data-api-url='edit/quarantine_notification'
690 data-api-attr='{"quarantine_notification":"weekly"}'><?=$lang['user']['weekly'];?></button>
691 </div>
692 <p class="help-block"><small><?=$lang['user']['quarantine_notification_info'];?></small></p>
693 </div>
694 </div>
695 <div class="form-group">
696 <label class="control-label col-sm-2"><?=$lang['user']['quarantine_category'];?></label>
697 <div class="col-sm-10">
698 <div class="btn-group" data-acl="<?=$_SESSION['acl']['quarantine_category'];?>">
699 <button type="button" class="btn btn-sm btn-default <?=($quarantine_category == "reject") ? "active" : null;?>"
700 data-action="edit_selected"
701 data-item="<?= htmlentities($mailbox); ?>"
702 data-id="quarantine_category"
703 data-api-url='edit/quarantine_category'
704 data-api-attr='{"quarantine_category":"reject"}'><?=$lang['user']['q_reject'];?></button>
705 <button type="button" class="btn btn-sm btn-default <?=($quarantine_category == "add_header") ? "active" : null;?>"
706 data-action="edit_selected"
707 data-item="<?= htmlentities($mailbox); ?>"
708 data-id="quarantine_category"
709 data-api-url='edit/quarantine_category'
710 data-api-attr='{"quarantine_category":"add_header"}'><?=$lang['user']['q_add_header'];?></button>
711 <button type="button" class="btn btn-sm btn-default <?=($quarantine_category == "all") ? "active" : null;?>"
712 data-action="edit_selected"
713 data-item="<?= htmlentities($mailbox); ?>"
714 data-id="quarantine_category"
715 data-api-url='edit/quarantine_category'
716 data-api-attr='{"quarantine_category":"all"}'><?=$lang['user']['q_all'];?></button>
717 </div>
718 <p class="help-block"><small><?=$lang['user']['quarantine_category_info'];?></small></p>
719 </div>
720 </div>
721 <div class="form-group">
722 <label class="control-label col-sm-2" for="sender_acl"><?=$lang['user']['tls_policy'];?></label>
723 <div class="col-sm-10">
724 <div class="btn-group" data-acl="<?=$_SESSION['acl']['tls_policy'];?>">
725 <button type="button" class="btn btn-sm btn-default <?=($get_tls_policy['tls_enforce_in'] == "1") ? "active" : null;?>"
726 data-action="edit_selected"
727 data-item="<?= htmlentities($mailbox); ?>"
728 data-id="tls_policy"
729 data-api-url='edit/tls_policy'
730 data-api-attr='{"tls_enforce_in":<?=($get_tls_policy['tls_enforce_in'] == "1") ? "0" : "1";?>}'><?=$lang['user']['tls_enforce_in'];?></button>
731 <button type="button" class="btn btn-sm btn-default <?=($get_tls_policy['tls_enforce_out'] == "1") ? "active" : null;?>"
732 data-action="edit_selected"
733 data-item="<?= htmlentities($mailbox); ?>"
734 data-id="tls_policy"
735 data-api-url='edit/tls_policy'
736 data-api-attr='{"tls_enforce_out":<?=($get_tls_policy['tls_enforce_out'] == "1") ? "0" : "1";?>}'><?=$lang['user']['tls_enforce_out'];?></button>
737 </div>
738 </div>
739 </div>
740 <div class="form-group">
741 <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
742 <div class="col-sm-10">
743 <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="<?=$lang['edit']['unchanged_if_empty'];?>" autocomplete="new-password">
744 </div>
745 </div>
746 <div class="form-group">
747 <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
748 <div class="col-sm-10">
749 <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">
750 </div>
751 </div>
752 <div data-acl="<?=$_SESSION['acl']['extend_sender_acl'];?>" class="form-group">
753 <label class="control-label col-sm-2" for="extended_sender_acl"><?=$lang['edit']['extended_sender_acl'];?></label>
754 <div class="col-sm-10">
755 <input type="text" class="form-control" name="extended_sender_acl" value="<?=empty($ext_sender_acl) ? '' : $ext_sender_acl; ?>" placeholder="user1@example.com, user2@example.org, @example.com, ...">
756 <small class="help-block"><?=$lang['edit']['extended_sender_acl_info'];?></small>
757 </div>
758 </div>
759 <div class="form-group">
760 <label class="control-label col-sm-2" for="protocol_access"><?=$lang['edit']['allowed_protocols'];?></label>
761 <div class="col-sm-10">
762 <select data-acl="<?=$_SESSION['acl']['protocol_access'];?>" name="protocol_access" multiple class="form-control">
763 <option value="imap" <?=($result['attributes']['imap_access']=="1") ? 'selected' : null;?>>IMAP</option>
764 <option value="pop3" <?=($result['attributes']['pop3_access']=="1") ? 'selected' : null;?>>POP3</option>
765 <option value="smtp" <?=($result['attributes']['smtp_access']=="1") ? 'selected' : null;?>>SMTP</option>
766 </select>
767 </div>
768 </div>
769 <div hidden data-acl="<?=$_SESSION['acl']['smtp_ip_access'];?>" class="form-group">
770 <label class="control-label col-sm-2" for="allow_from_smtp"><?=$lang['edit']['allow_from_smtp'];?></label>
771 <div class="col-sm-10">
772 <input type="text" class="form-control" name="allow_from_smtp" value="<?=empty($allow_from_smtp) ? '' : $allow_from_smtp; ?>" placeholder="1.1.1.1, 10.2.0.0/24, ...">
773 <small class="help-block"><?=$lang['edit']['allow_from_smtp_info'];?></small>
774 </div>
775 </div>
776 <hr>
777 <div class="form-group">
778 <div class="col-sm-offset-2 col-sm-10">
779 <select name="active" class="form-control">
780 <option value="1" <?=($result['active']=="1") ? 'selected' : null;?>><?=$lang['edit']['active'];?></option>
781 <option value="2" <?=($result['active']=="2") ? 'selected' : null;?>><?=$lang['edit']['disable_login'];?></option>
782 <option value="0" <?=($result['active']=="0") ? 'selected' : null;?>><?=$lang['edit']['inactive'];?></option>
783 </select>
784 </div>
785 </div>
786 <div class="form-group">
787 <div class="col-sm-offset-2 col-sm-10">
788 <div class="checkbox">
789 <label><input type="checkbox" value="1" name="force_pw_update" <?=($result['attributes']['force_pw_update']=="1") ? "checked" : null;?>> <?=$lang['edit']['force_pw_update'];?></label>
790 <small class="help-block"><?=sprintf($lang['edit']['force_pw_update_info'], $UI_TEXTS['main_name']);?></small>
791 </div>
792 </div>
793 </div>
794 <?php if (getenv('SKIP_SOGO') != "y") { ?>
795 <div data-acl="<?=$_SESSION['acl']['sogo_access'];?>" class="form-group">
796 <div class="col-sm-offset-2 col-sm-10">
797 <div class="checkbox">
798 <label><input type="checkbox" value="1" name="sogo_access" <?=($result['attributes']['sogo_access']=="1") ? "checked" : null;?>> <?=$lang['edit']['sogo_access'];?></label>
799 <small class="help-block"><?=$lang['edit']['sogo_access_info'];?></small>
800 </div>
801 </div>
802 </div>
803 <?php } ?>
804 <div class="form-group">
805 <div class="col-sm-offset-2 col-sm-10">
806 <button class="btn btn-success" data-action="edit_selected" data-id="editmailbox" data-item="<?=htmlspecialchars($result['username']);?>" data-api-url='edit/mailbox' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
807 </div>
808 </div>
809 </form>
810 <hr>
811 <form data-id="pushover" class="form well" method="post">
812 <input type="hidden" value="0" name="evaluate_x_prio">
813 <input type="hidden" value="0" name="only_x_prio">
814 <input type="hidden" value="0" name="active">
815 <div class="row">
816 <div class="col-sm-1">
817 <p class="help-block"><a href="https://pushover.net" target="_blank"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAACglBMVEUAAAAAAAEAAAAilecFGigAAAAAAAAAAAAAAAANj+c3n+Ypm+oeYI4KWI4MieAtkdQbleoJcLcjmeswmN4Rit4KgdMKUYQJKUAQSnILL0kMNlMSTngimOoNPF0hlOQBBgkNOlkRS3MHIjUhk+IPf8wKLUYsjM0AAAASTngAAAAAAAAPfckbdLIbdrYUWIgegsgce70knfEAAAAknfENOVkGHi8YaaIjnvEdgMUhkuAQSG8aca0hleQUh9YLjOM4nOEMgtMcbaYWa6YemO02ltkKhNktgLodYZEPXJEyi8kKesktfLUzj84cWYMiluckZ5YJXJYeW4Y0k9YKfs4yjs0pc6YHZaUviskLfMkqmugak+cqkNcViNcqeK4Iaq4XRmYGPmYMKDsFJTstgr0LdL0ti84CCQ4BCQ4Qgc8rlt8XjN8shcQsi8wZSGgEP2cRMEUDKkUAAAD///8dmvEamfExo/EXmPEWl/ERlvElnvEsofEjnfETl/Enn/Ezo/E4pvEvovEfm/E1pPEzpPEvofEOlfEpoPEamPEQlfEYmfE6p/EgnPEVlvEroPE3pfE2pfENk/Ern/E3pPEcmfEfmvEnnvBlufT6/P0soPAknPDd7/zs9vzo9PxBqfItofAqoPD9/f3B4/q43/mx2/l/xfZ6w/Vxv/VtvfVgt/RXtPNTsfNEq/L3+/31+v3a7fvR6vvH5fqs2vmc0/jx+P3v9/3h8fzW7PvV7PvL5/q13fmo1/mh1PiY0fiNy/aHyfZ2wfVou/Vdt/RPsPM3oeoQkuowmeAgjdgcgMQbeLrw9/3k8vy74Pm63/mX0PdYtfNNr/Ikm+4wnOchkuAVjOAfdrMVcrOdoJikAAAAcnRSTlMAIQ8IzzweFwf+/fvw8P79+/Xt7e3p6eji4d7U08y8qZyTiIWDgn53bWxqaWBKQ0JBOjUwMCkoJCEfHBkT/vz8/Pv7+vr69/b29PTy7ezm5ubm5N7e29vQ0M/Pv7+4uLW1pqaWloWDg3x7e21mUVFFRUXdPracAAAEbElEQVRIx4WUZbvaQBCFF+ru7u7u7u7u7t4mvVwSoBC0JIUCLRQolLq7u7vr/+nMLkmQyvlwyfPcd86e3ZldUqwyQ/p329J+XfutPQYOLUP+q55rFtQJRvY79+xxlZTUWbKpz7/xrrMr2+3BoNPpdLn2lJQ4HEeqLOr1d7z7XNkesQed4A848G63Oy4Gmg/6Mz542QvZbqe8C/Ig73CLYiYTrtLmT3zfqbIcAR7y4wIqH/B6M9Fo0+Ldb6sM9ph/v4ozPuz12mxRofaAAr7jCNkuoz/jNf9AGHibkBCm51fsGKvxsAGWx4H+jBcEi6V2birDpCL/9Klrd1KHbiSvPWP8V0tTnTfO03iXi57P6WNHOVUf44IFdFDRz6pV5fw8Zy5z3JVH5+R48OwxqDiGvKJIY9R+9JsCuJ5HPg74OVEMpz+nbdEPUHEWeEk6IDUnTC1l5r+f8uffc0cfxc8fS17kLso24SwUPFDA/6DE82xKDOPliJ7n/GGOOyWK9zD9CdjvOfg9Dv6AH+AX04LW9gj2i8W/APx1UbxwCAu+wPmcpgUKL/EHdvtq4uwaZwCuznPJVY5LHhED15G/isd5Hz4eKui/e/du02YoKFeD5mHzHIN/nxEDe25gQQwKorAid04CfyzwL4XutXvl1Pt1guMOwwKPkU8mYIFT8JHK+vv8prpDScUVL+j8s3lOctw1GIhbWHAS+HgKPk7xPM/4UtNAYmzizJkf6NgTb/gM8jePQLsewMdthS3g95tMpT1IhVm6v1s8fYmLeb13Odwp8Fh5KY048y/d14WUrwrb1e/X/rNp73nkD8kWS+wi/MZ4XuetG4mhKubJm3/WNEvi8SHwB56nPKjUam0LBdp9ARwupFemTYudvgN/L1+A/Ko/LGBuS8pPy+YR1fuCTWNKnUyoeUyYx2o2dyEVGmr5xTD42xzvkD16+Pb9WIIH6fmt1r3mbsTY7Bvw+n23naT8BUWh86bz6G/e259UXPUK3gfAxQDlo7Rpx3Geqb2e3wp83SGEdKpB7zvwYbzvT2n65xLwbH6YP+M9C8vA8E1wxLU8gkCbdhXGUyrMgwVrcbzLHonr78lzDvWM3q/C/HtDlXoSUIe3YkblhRPIX4E8Oo/9siLv8dRjV7SBlkdgTXvKS7nzsA/9AfeEuhKq9T8zWIDv1Sd6ETAP4D6/H/1V+1BojvruNa4SZXz4JhY84dV5MOF5agUvu5OsOo+KRpG30KalEnoeDccFlutPZYs38D5n3zcpr1/0fBhfb3DOY1z2tSAgLxWezz6zuoHhfUmOejf6blHQH/sFuJYfcMZX307ytKvRa3ifoV/586P5j+tICtS77BuJxzxYAPZsntX8k3eSIhlajK4p8b7iefCEKs03kD/I2LnxL9ovH+43y4fAv1YrI/mzDBsavAX/UppfzVOrZT/ydxk6lJ047MfLfVbcb6hS9ZEzWxekKQ5WrtPqZg3rV6tWrX6Tle3KQZj/q6KxQnmDoXwFY0VSrN9e8FRXBCTAvwAAAABJRU5ErkJggg==" class="img img-fluid"></a></p>
818 </div>
819 <div class="col-sm-10">
820 <p class="help-block"><?=sprintf($lang['edit']['pushover_info'], $mailbox);?></p>
821 <p class="help-block"><?=$lang['edit']['pushover_vars'];?>: <code>{SUBJECT}</code>, <code>{SENDER}</code></p>
822 <div class="form-group">
823 <div class="row">
824 <div class="col-sm-6">
825 <div class="form-group">
826 <label for="token">API Token/Key (Application)</label>
827 <input type="text" class="form-control" name="token" maxlength="30" value="<?=$pushover_data['token'];?>" required>
828 </div>
829 </div>
830 <div class="col-sm-6">
831 <div class="form-group">
832 <label for="key">User/Group Key</label>
833 <input type="text" class="form-control" name="key" maxlength="30" value="<?=$pushover_data['key'];?>" required>
834 </div>
835 </div>
836 <div class="col-sm-6">
837 <div class="form-group">
838 <label for="title"><?=$lang['edit']['pushover_title'];?></label>
839 <input type="text" class="form-control" name="title" value="<?=$pushover_data['title'];?>" placeholder="Mail">
840 </div>
841 </div>
842 <div class="col-sm-6">
843 <div class="form-group">
844 <label for="text"><?=$lang['edit']['pushover_text'];?></label>
845 <input type="text" class="form-control" name="text" value="<?=$pushover_data['text'];?>" placeholder="You've got mail 📧">
846 </div>
847 </div>
848 <div class="col-sm-12">
849 <div class="form-group">
850 <label for="text"><?=$lang['edit']['pushover_sender_array'];?></label>
851 <input type="text" class="form-control" name="senders" value="<?=$pushover_data['senders'];?>" placeholder="sender1@example.com, sender2@example.com">
852 </div>
853 </div>
854 <div class="col-sm-12">
855 <div class="checkbox">
856 <label><input type="checkbox" value="1" name="active" <?=($pushover_data['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
857 </div>
858 </div>
859 <div class="col-sm-12">
860 <legend style="cursor:pointer;margin-top:10px" data-target="#po_advanced" class="arrow-toggle" unselectable="on" data-toggle="collapse">
861 <span style="font-size:12px" class="arrow rotate glyphicon glyphicon-menu-down"></span> <?=$lang['edit']['advanced_settings'];?>
862 </legend>
863 </div>
864 <div class="col-sm-12">
865 <div id="po_advanced" class="collapse">
866 <div class="form-group">
867 <label for="text"><?=$lang['edit']['pushover_sender_regex'];?></label>
868 <input type="text" class="form-control" name="senders_regex" value="<?=$pushover_data['senders_regex'];?>" placeholder="/(.*@example\.org$|^foo@example\.com$)/i" regex="true">
869 <div class="checkbox">
870 <label><input type="checkbox" value="1" name="evaluate_x_prio" <?=($pushover_data['attributes']['evaluate_x_prio']=="1") ? "checked" : null;?>> <?=$lang['edit']['pushover_evaluate_x_prio'];?></label>
871 </div>
872 <div class="checkbox">
873 <label><input type="checkbox" value="1" name="only_x_prio" <?=($pushover_data['attributes']['only_x_prio']=="1") ? "checked" : null;?>> <?=$lang['edit']['pushover_only_x_prio'];?></label>
874 </div>
875 </div>
876 </div>
877 </div>
878 </div>
879 </div>
880 <div class="btn-group" data-acl="<?=$_SESSION['acl']['pushover'];?>">
881 <a class="btn btn-sm btn-default" data-action="edit_selected" data-id="pushover" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></a>
882 <a class="btn btn-sm btn-default" data-action="edit_selected" data-id="pushover-test" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover-test' data-api-attr='{}' href="#"><span class="glyphicon glyphicon-check" aria-hidden="true"></span> <?=$lang['edit']['pushover_verify'];?></a>
883 <a id="pushover_delete" class="btn btn-sm btn-danger" data-action="edit_selected" data-id="pushover-delete" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover' data-api-attr='{"delete":"true"}' href="#"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> <?=$lang['edit']['remove'];?></a>
884 </div>
885 </div>
886 </div>
887 </form>
888 <hr>
889 <form data-id="mboxratelimit" class="form-inline well" method="post">
890 <div class="row">
891 <div class="col-sm-1">
892 <p class="help-block"><?=$lang['acl']['ratelimit'];?></p>
893 </div>
894 <div class="col-sm-10">
895 <div class="form-group">
896 <input name="rl_value" type="number" autocomplete="off" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" class="form-control" placeholder="disabled">
897 </div>
898 <div class="form-group">
899 <select name="rl_frame" class="form-control">
900 <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>>msgs / second</option>
901 <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>>msgs / minute</option>
902 <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>>msgs / hour</option>
903 <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>>msgs / day</option>
904 </select>
905 </div>
906 <div class="form-group">
907 <button class="btn btn-default" data-action="edit_selected" data-id="mboxratelimit" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/rl-mbox' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
908 </div>
909 <p class="help-block"><?=$lang['edit']['mbox_rl_info'];?></p>
910 </div>
911 </div>
912 </form>
913 <form data-id="useracl" class="form-inline well" method="post">
914 <div class="row">
915 <div class="col-sm-1">
916 <p class="help-block">ACL</p>
917 </div>
918 <div class="col-sm-10">
919 <div class="form-group">
920 <select id="user_acl" name="user_acl" size="10" multiple>
921 <?php
922 $user_acls = acl('get', 'user', $mailbox);
923 foreach ($user_acls as $acl => $val):
924 ?>
925 <option value="<?=$acl;?>" <?=($val == 1) ? 'selected' : null;?>><?=$lang['acl'][$acl];?></option>
926 <?php
927 endforeach;
928 ?>
929 </select>
930 </div>
931 <div class="form-group">
932 <button class="btn btn-default" data-action="edit_selected" data-id="useracl" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/user-acl' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
933 </div>
934 </div>
935 </div>
936 </form>
937 <?php
938 }
939 }
940 elseif (isset($_GET['relayhost']) && is_numeric($_GET["relayhost"]) && !empty($_GET["relayhost"])) {
941 $relayhost = intval($_GET["relayhost"]);
942 $result = relayhost('details', $relayhost);
943 if (!empty($result)) {
944 ?>
945 <h4><?=$lang['edit']['resource'];?></h4>
946 <form class="form-horizontal" role="form" method="post" data-id="editrelayhost">
947 <input type="hidden" value="0" name="active">
948 <div class="form-group">
949 <label class="control-label col-sm-2" for="hostname"><?=$lang['add']['hostname'];?></label>
950 <div class="col-sm-10">
951 <input type="text" class="form-control" name="hostname" value="<?=htmlspecialchars($result['hostname'], ENT_QUOTES, 'UTF-8');?>" required>
952 <p class="help-block"><?=$lang['add']['relayhost_wrapped_tls_info'];?></p>
953 </div>
954 </div>
955 <div class="form-group">
956 <label class="control-label col-sm-2" for="username"><?=$lang['add']['username'];?></label>
957 <div class="col-sm-10">
958 <input type="text" class="form-control" name="username" value="<?=htmlspecialchars($result['username'], ENT_QUOTES, 'UTF-8');?>">
959 </div>
960 </div>
961 <div class="form-group">
962 <label class="control-label col-sm-2" for="password"><?=$lang['add']['password'];?></label>
963 <div class="col-sm-10">
964 <input type="text" data-hibp="true" class="form-control" name="password" value="<?=htmlspecialchars($result['password'], ENT_QUOTES, 'UTF-8');?>">
965 </div>
966 </div>
967 <div class="form-group">
968 <div class="col-sm-offset-2 col-sm-10">
969 <div class="checkbox">
970 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
971 </div>
972 </div>
973 </div>
974 <div class="form-group">
975 <div class="col-sm-offset-2 col-sm-10">
976 <button class="btn btn-success" data-action="edit_selected" data-id="editrelayhost" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/relayhost' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
977 </div>
978 </div>
979 </form>
980 <?php
981 }
982 else {
983 ?>
984 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
985 <?php
986 }
987 }
988 elseif (isset($_GET['transport']) && is_numeric($_GET["transport"]) && !empty($_GET["transport"])) {
989 $transport = intval($_GET["transport"]);
990 $result = transport('details', $transport);
991 if (!empty($result)) {
992 ?>
993 <h4><?=$lang['edit']['resource'];?></h4>
994 <form class="form-horizontal" role="form" method="post" data-id="edittransport">
995 <input type="hidden" value="0" name="active">
996 <div class="form-group">
997 <label class="control-label col-sm-2" for="destination"><?=$lang['add']['destination'];?></label>
998 <div class="col-sm-10">
999 <input type="text" class="form-control" name="destination" value="<?=htmlspecialchars($result['destination'], ENT_QUOTES, 'UTF-8');?>" required>
1000 </div>
1001 </div>
1002 <div class="form-group">
1003 <label class="control-label col-sm-2" for="nexthop"><?=$lang['edit']['nexthop'];?></label>
1004 <div class="col-sm-10">
1005 <input type="text" class="form-control" name="nexthop" placeholder='[0.0.0.0], [0.0.0.0]:25, host:25, host, [host]:25' value="<?=htmlspecialchars($result['nexthop'], ENT_QUOTES, 'UTF-8');?>" required>
1006 </div>
1007 </div>
1008 <div class="form-group">
1009 <label class="control-label col-sm-2" for="username"><?=$lang['add']['username'];?></label>
1010 <div class="col-sm-10">
1011 <input type="text" class="form-control" name="username" value="<?=htmlspecialchars($result['username'], ENT_QUOTES, 'UTF-8');?>">
1012 </div>
1013 </div>
1014 <div class="form-group">
1015 <label class="control-label col-sm-2" for="password"><?=$lang['add']['password'];?></label>
1016 <div class="col-sm-10">
1017 <input type="text" data-hibp="true" class="form-control" name="password" value="<?=htmlspecialchars($result['password'], ENT_QUOTES, 'UTF-8');?>">
1018 </div>
1019 </div>
1020 <div class="form-group">
1021 <div class="col-sm-offset-2 col-sm-10">
1022 <div class="checkbox">
1023 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
1024 </div>
1025 </div>
1026 </div>
1027 <div class="form-group">
1028 <div class="col-sm-offset-2 col-sm-10">
1029 <button class="btn btn-success" data-action="edit_selected" data-id="edittransport" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/transport' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
1030 </div>
1031 </div>
1032 </form>
1033 <?php
1034 }
1035 else {
1036 ?>
1037 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1038 <?php
1039 }
1040 }
1041 elseif (isset($_GET['resource']) && filter_var(html_entity_decode(rawurldecode($_GET["resource"])), FILTER_VALIDATE_EMAIL) && !empty($_GET["resource"])) {
1042 $resource = html_entity_decode(rawurldecode($_GET["resource"]));
1043 $result = mailbox('get', 'resource_details', $resource);
1044 if (!empty($result)) {
1045 ?>
1046 <h4><?=$lang['edit']['resource'];?></h4>
1047 <form class="form-horizontal" role="form" method="post" data-id="editresource">
1048 <input type="hidden" value="0" name="active">
1049 <div class="form-group">
1050 <label class="control-label col-sm-2" for="description"><?=$lang['add']['description'];?></label>
1051 <div class="col-sm-10">
1052 <input type="text" class="form-control" name="description" value="<?=htmlspecialchars($result['description'], ENT_QUOTES, 'UTF-8');?>" required>
1053 </div>
1054 </div>
1055 <div class="form-group">
1056 <label class="control-label col-sm-2" for="domain"><?=$lang['edit']['kind'];?></label>
1057 <div class="col-sm-10">
1058 <select name="kind" title="<?=$lang['edit']['select'];?>" required>
1059 <option value="location" <?=($result['kind'] == "location") ? "selected" : null;?>>Location</option>
1060 <option value="group" <?=($result['kind'] == "group") ? "selected" : null;?>>Group</option>
1061 <option value="thing" <?=($result['kind'] == "thing") ? "selected" : null;?>>Thing</option>
1062 </select>
1063 </div>
1064 </div>
1065 <div class="form-group">
1066 <label class="control-label col-sm-2" for="multiple_bookings_select"><?=$lang['add']['multiple_bookings'];?></label>
1067 <div class="col-sm-10">
1068 <select name="multiple_bookings_select" id="editSelectMultipleBookings" title="<?=$lang['add']['select'];?>" required>
1069 <option value="0" <?=($result['multiple_bookings'] == 0) ? "selected" : null;?>><?=$lang['mailbox']['booking_0'];?></option>
1070 <option value="-1" <?=($result['multiple_bookings'] == -1) ? "selected" : null;?>><?=$lang['mailbox']['booking_lt0'];?></option>
1071 <option value="custom" <?=($result['multiple_bookings'] >= 1) ? "selected" : null;?>><?=$lang['mailbox']['booking_custom'];?></option>
1072 </select>
1073 <div style="display:none" id="multiple_bookings_custom_div">
1074 <hr>
1075 <input type="number" class="form-control" name="multiple_bookings_custom" id="multiple_bookings_custom" value="<?=($result['multiple_bookings'] >= 1) ? $result['multiple_bookings'] : null;?>">
1076 </div>
1077 <input type="hidden" name="multiple_bookings" id="multiple_bookings">
1078 </div>
1079 </div>
1080 <div class="form-group">
1081 <div class="col-sm-offset-2 col-sm-10">
1082 <div class="checkbox">
1083 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
1084 </div>
1085 </div>
1086 </div>
1087 <div class="form-group">
1088 <div class="col-sm-offset-2 col-sm-10">
1089 <button class="btn btn-success" data-action="edit_selected" data-id="editresource" data-item="<?=htmlspecialchars($result['name']);?>" data-api-url='edit/resource' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
1090 </div>
1091 </div>
1092 </form>
1093 <?php
1094 }
1095 else {
1096 ?>
1097 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1098 <?php
1099 }
1100 }
1101 elseif (isset($_GET['bcc']) && !empty($_GET["bcc"])) {
1102 $bcc = intval($_GET["bcc"]);
1103 $result = bcc('details', $bcc);
1104 if (!empty($result)) {
1105 ?>
1106 <h4><?=$lang['mailbox']['bcc_map'];?></h4>
1107 <br>
1108 <form class="form-horizontal" data-id="editbcc" role="form" method="post">
1109 <input type="hidden" value="0" name="active">
1110 <div class="form-group">
1111 <label class="control-label col-sm-2" for="bcc_dest"><?=$lang['mailbox']['bcc_destination'];?></label>
1112 <div class="col-sm-10">
1113 <input value="<?=$result['bcc_dest'];?>" type="text" class="form-control" name="bcc_dest" id="bcc_dest">
1114 <small><?=$lang['edit']['bcc_dest_format'];?></small>
1115 </div>
1116 </div>
1117 <div class="form-group">
1118 <label class="control-label col-sm-2" for="type"><?=$lang['mailbox']['bcc_map_type'];?></label>
1119 <div class="col-sm-10">
1120 <select id="addFilterType" name="type" id="type" required>
1121 <option value="sender" <?=($result['type'] == 'sender') ? 'selected' : null;?>><?=$lang['mailbox']['bcc_sender_map'];?></option>
1122 <option value="rcpt" <?=($result['type'] == 'rcpt') ? 'selected' : null;?>><?=$lang['mailbox']['bcc_rcpt_map'];?></option>
1123 </select>
1124 </div>
1125 </div>
1126 <div class="form-group">
1127 <div class="col-sm-offset-2 col-sm-10">
1128 <div class="checkbox">
1129 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
1130 </div>
1131 </div>
1132 </div>
1133 <div class="form-group">
1134 <div class="col-sm-offset-2 col-sm-10">
1135 <button class="btn btn-success" data-action="edit_selected" data-id="editbcc" data-item="<?=$bcc;?>" data-api-url='edit/bcc' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
1136 </div>
1137 </div>
1138 </form>
1139 <?php
1140 }
1141 else {
1142 ?>
1143 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1144 <?php
1145 }
1146 }
1147 elseif (isset($_GET['recipient_map']) &&
1148 !empty($_GET["recipient_map"]) &&
1149 $_SESSION['mailcow_cc_role'] == "admin") {
1150 $map = intval($_GET["recipient_map"]);
1151 $result = recipient_map('details', $map);
1152 if (substr($result['recipient_map_old'], 0, 1) == '@') {
1153 $result['recipient_map_old'] = substr($result['recipient_map_old'], 1);
1154 }
1155 if (!empty($result)) {
1156 ?>
1157 <h4><?=$lang['mailbox']['recipient_map']?>: <?=$result['recipient_map_old'];?></h4>
1158 <br>
1159 <form class="form-horizontal" data-id="edit_recipient_map" role="form" method="post">
1160 <input type="hidden" value="0" name="active">
1161 <div class="form-group">
1162 <label class="control-label col-sm-2" for="recipient_map_new"><?=$lang['mailbox']['recipient_map_old'];?></label>
1163 <div class="col-sm-10">
1164 <input value="<?=$result['recipient_map_old'];?>" type="text" class="form-control" name="recipient_map_old" id="recipient_map_old">
1165 <small><?=$lang['mailbox']['recipient_map_old_info'];?></small>
1166 </div>
1167 </div>
1168 <div class="form-group">
1169 <label class="control-label col-sm-2" for="recipient_map_new"><?=$lang['mailbox']['recipient_map_new'];?></label>
1170 <div class="col-sm-10">
1171 <input value="<?=$result['recipient_map_new'];?>" type="text" class="form-control" name="recipient_map_new" id="recipient_map_new">
1172 <small><?=$lang['mailbox']['recipient_map_new_info'];?></small>
1173 </div>
1174 </div>
1175 <div class="form-group">
1176 <div class="col-sm-offset-2 col-sm-10">
1177 <div class="checkbox">
1178 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
1179 </div>
1180 </div>
1181 </div>
1182 <div class="form-group">
1183 <div class="col-sm-offset-2 col-sm-10">
1184 <button class="btn btn-success" data-action="edit_selected" data-id="edit_recipient_map" data-item="<?=$map;?>" data-api-url='edit/recipient_map' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
1185 </div>
1186 </div>
1187 </form>
1188 <?php
1189 }
1190 else {
1191 ?>
1192 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1193 <?php
1194 }
1195 }
1196 elseif (isset($_GET['tls_policy_map']) &&
1197 !empty($_GET["tls_policy_map"]) &&
1198 $_SESSION['mailcow_cc_role'] == "admin") {
1199 $map = intval($_GET["tls_policy_map"]);
1200 $result = tls_policy_maps('details', $map);
1201 if (!empty($result)) {
1202 ?>
1203 <h4><?=$lang['mailbox']['tls_policy_maps']?>: <?=$result['dest'];?></h4>
1204 <br>
1205 <form class="form-horizontal" data-id="edit_tls_policy_maps" role="form" method="post">
1206 <input type="hidden" value="0" name="active">
1207 <div class="form-group">
1208 <label class="control-label col-sm-2" for="dest"><?=$lang['mailbox']['tls_map_dest'];?></label>
1209 <div class="col-sm-10">
1210 <input value="<?=$result['dest'];?>" type="text" class="form-control" name="dest" id="dest">
1211 <small><?=$lang['mailbox']['tls_map_dest_info'];?></small>
1212 </div>
1213 </div>
1214 <div class="form-group">
1215 <label class="control-label col-sm-2" for="policy"><?=$lang['mailbox']['tls_map_policy'];?></label>
1216 <div class="col-sm-10">
1217 <select class="full-width-select" name="policy" required>
1218 <option value="none" <?=($result['policy'] != 'none') ?: 'selected';?>>none</option>
1219 <option value="may" <?=($result['policy'] != 'may') ?: 'selected';?>>may</option>
1220 <option value="encrypt" <?=($result['policy'] != 'encrypt') ?: 'selected';?>>encrypt</option>
1221 <option value="dane" <?=($result['policy'] != 'dane') ?: 'selected';?>>dane</option>
1222 <option value="dane-only" <?=($result['policy'] != 'dane-only') ?: 'selected';?>>dane-only</option>
1223 <option value="fingerprint" <?=($result['policy'] != 'fingerprint') ?: 'selected';?>>fingerprint</option>
1224 <option value="verify" <?=($result['policy'] != 'verify') ?: 'selected';?>>verify</option>
1225 <option value="secure" <?=($result['policy'] != 'secure') ?: 'selected';?>>secure</option>
1226 </select>
1227 </div>
1228 </div>
1229 <div class="form-group">
1230 <label class="control-label col-sm-2" for="parameters"><?=$lang['mailbox']['tls_map_parameters'];?></label>
1231 <div class="col-sm-10">
1232 <input value="<?=$result['parameters'];?>" type="text" class="form-control" name="parameters" id="parameters">
1233 <small><?=$lang['mailbox']['tls_map_parameters_info'];?></small>
1234 </div>
1235 </div>
1236 <div class="form-group">
1237 <div class="col-sm-offset-2 col-sm-10">
1238 <div class="checkbox">
1239 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
1240 </div>
1241 </div>
1242 </div>
1243 <div class="form-group">
1244 <div class="col-sm-offset-2 col-sm-10">
1245 <button class="btn btn-success" data-action="edit_selected" data-id="edit_tls_policy_maps" data-item="<?=$map;?>" data-api-url='edit/tls-policy-map' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
1246 </div>
1247 </div>
1248 </form>
1249 <?php
1250 }
1251 else {
1252 ?>
1253 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1254 <?php
1255 }
1256 }
1257 }
1258 if ($_SESSION['mailcow_cc_role'] == "admin" || $_SESSION['mailcow_cc_role'] == "domainadmin" || $_SESSION['mailcow_cc_role'] == "user") {
1259 if (isset($_GET['syncjob']) &&
1260 is_numeric($_GET['syncjob'])) {
1261 $id = $_GET["syncjob"];
1262 $result = mailbox('get', 'syncjob_details', $id);
1263 if (!empty($result)) {
1264 ?>
1265 <h4><?=$lang['edit']['syncjob'];?></h4>
1266 <form class="form-horizontal" data-id="editsyncjob" role="form" method="post">
1267 <input type="hidden" value="0" name="delete2duplicates">
1268 <input type="hidden" value="0" name="delete1">
1269 <input type="hidden" value="0" name="delete2">
1270 <input type="hidden" value="0" name="automap">
1271 <input type="hidden" value="0" name="skipcrossduplicates">
1272 <input type="hidden" value="0" name="active">
1273 <input type="hidden" value="0" name="subscribeall">
1274 <div class="form-group">
1275 <label class="control-label col-sm-2" for="host1"><?=$lang['edit']['hostname'];?></label>
1276 <div class="col-sm-10">
1277 <input type="text" class="form-control" name="host1" id="host1" value="<?=htmlspecialchars($result['host1'], ENT_QUOTES, 'UTF-8');?>">
1278 </div>
1279 </div>
1280 <div class="form-group">
1281 <label class="control-label col-sm-2" for="port1">Port</label>
1282 <div class="col-sm-10">
1283 <input type="number" class="form-control" name="port1" id="port1" min="1" max="65535" value="<?=htmlspecialchars($result['port1'], ENT_QUOTES, 'UTF-8');?>">
1284 </div>
1285 </div>
1286 <div class="form-group">
1287 <label class="control-label col-sm-2" for="user1"><?=$lang['edit']['username'];?></label>
1288 <div class="col-sm-10">
1289 <input type="text" class="form-control" name="user1" id="user1" value="<?=htmlspecialchars($result['user1'], ENT_QUOTES, 'UTF-8');?>">
1290 </div>
1291 </div>
1292 <div class="form-group">
1293 <label class="control-label col-sm-2" for="password1"><?=$lang['edit']['password'];?></label>
1294 <div class="col-sm-10">
1295 <input type="password" class="form-control" name="password1" id="password1" value="<?=htmlspecialchars($result['password1'], ENT_QUOTES, 'UTF-8');?>">
1296 </div>
1297 </div>
1298 <div class="form-group">
1299 <label class="control-label col-sm-2" for="enc1"><?=$lang['edit']['encryption'];?></label>
1300 <div class="col-sm-10">
1301 <select id="enc1" name="enc1">
1302 <option value="SSL" <?=($result['enc1'] == "SSL") ? "selected" : null;?>>SSL</option>
1303 <option value="TLS" <?=($result['enc1'] == "TLS") ? "selected" : null;?>>STARTTLS</option>
1304 <option value="PLAIN" <?=($result['enc1'] == "PLAIN") ? "selected" : null;?>>PLAIN</option>
1305 </select>
1306 </div>
1307 </div>
1308 <div class="form-group">
1309 <label class="control-label col-sm-2" for="mins_interval"><?=$lang['edit']['mins_interval'];?></label>
1310 <div class="col-sm-10">
1311 <input type="number" class="form-control" name="mins_interval" min="1" max="43800" value="<?=htmlspecialchars($result['mins_interval'], ENT_QUOTES, 'UTF-8');?>" required>
1312 <small class="help-block">1-43800</small>
1313 </div>
1314 </div>
1315 <div class="form-group">
1316 <label class="control-label col-sm-2" for="subfolder2"><?=$lang['edit']['subfolder2'];?></label>
1317 <div class="col-sm-10">
1318 <input type="text" class="form-control" name="subfolder2" id="subfolder2" value="<?=htmlspecialchars($result['subfolder2'], ENT_QUOTES, 'UTF-8');?>">
1319 </div>
1320 </div>
1321 <div class="form-group">
1322 <label class="control-label col-sm-2" for="maxage"><?=$lang['edit']['maxage'];?></label>
1323 <div class="col-sm-10">
1324 <input type="number" class="form-control" name="maxage" id="maxage" min="0" max="32000" value="<?=htmlspecialchars($result['maxage'], ENT_QUOTES, 'UTF-8');?>">
1325 <small class="help-block">0-32000</small>
1326 </div>
1327 </div>
1328 <div class="form-group">
1329 <label class="control-label col-sm-2" for="maxbytespersecond"><?=$lang['edit']['maxbytespersecond'];?></label>
1330 <div class="col-sm-10">
1331 <input type="number" class="form-control" name="maxbytespersecond" id="maxbytespersecond" min="0" max="125000000" value="<?=htmlspecialchars($result['maxbytespersecond'], ENT_QUOTES, 'UTF-8');?>">
1332 <small class="help-block">0-125000000</small>
1333 </div>
1334 </div>
1335 <div class="form-group">
1336 <label class="control-label col-sm-2" for="timeout1"><?=$lang['add']['timeout1'];?></label>
1337 <div class="col-sm-10">
1338 <input type="number" class="form-control" name="timeout1" id="timeout1" min="1" max="32000" value="<?=htmlspecialchars($result['timeout1'], ENT_QUOTES, 'UTF-8');?>">
1339 <small class="help-block">1-32000</small>
1340 </div>
1341 </div>
1342 <div class="form-group">
1343 <label class="control-label col-sm-2" for="timeout2"><?=$lang['add']['timeout2'];?></label>
1344 <div class="col-sm-10">
1345 <input type="number" class="form-control" name="timeout2" id="timeout2" min="1" max="32000" value="<?=htmlspecialchars($result['timeout2'], ENT_QUOTES, 'UTF-8');?>">
1346 <small class="help-block">1-32000</small>
1347 </div>
1348 </div>
1349 <div class="form-group">
1350 <label class="control-label col-sm-2" for="exclude"><?=$lang['edit']['exclude'];?></label>
1351 <div class="col-sm-10">
1352 <input type="text" class="form-control" name="exclude" id="exclude" value="<?=htmlspecialchars($result['exclude'], ENT_QUOTES, 'UTF-8');?>">
1353 </div>
1354 </div>
1355 <div class="form-group">
1356 <label class="control-label col-sm-2" for="custom_params"><?=$lang['add']['custom_params'];?></label>
1357 <div class="col-sm-10">
1358 <input type="text" class="form-control" name="custom_params" id="custom_params" value="<?=htmlspecialchars($result['custom_params'], ENT_QUOTES, 'UTF-8');?>" placeholder="--dry --some-param=xy --other-param=yx">
1359 <small class="help-block"><?=$lang['add']['custom_params_hint'];?></small>
1360 </div>
1361 </div>
1362 <div class="form-group">
1363 <div class="col-sm-offset-2 col-sm-10">
1364 <div class="checkbox">
1365 <label><input type="checkbox" value="1" name="delete2duplicates" <?=($result['delete2duplicates']=="1") ? "checked" : "";?>> <?=$lang['edit']['delete2duplicates'];?> (--delete2duplicates)</label>
1366 </div>
1367 </div>
1368 </div>
1369 <div class="form-group">
1370 <div class="col-sm-offset-2 col-sm-10">
1371 <div class="checkbox">
1372 <label><input type="checkbox" value="1" name="delete1" <?=($result['delete1']=="1") ? "checked" : "";?>> <?=$lang['edit']['delete1'];?> (--delete1)</label>
1373 </div>
1374 </div>
1375 </div>
1376 <div class="form-group">
1377 <div class="col-sm-offset-2 col-sm-10">
1378 <div class="checkbox">
1379 <label><input type="checkbox" value="1" name="delete2" <?=($result['delete2']=="1") ? "checked" : "";?>> <?=$lang['edit']['delete2'];?> (--delete2)</label>
1380 </div>
1381 </div>
1382 </div>
1383 <div class="form-group">
1384 <div class="col-sm-offset-2 col-sm-10">
1385 <div class="checkbox">
1386 <label><input type="checkbox" value="1" name="automap" <?=($result['automap']=="1") ? "checked" : "";?>> <?=$lang['edit']['automap'];?> (--automap)</label>
1387 </div>
1388 </div>
1389 </div>
1390 <div class="form-group">
1391 <div class="col-sm-offset-2 col-sm-10">
1392 <div class="checkbox">
1393 <label><input type="checkbox" value="1" name="skipcrossduplicates" <?=($result['skipcrossduplicates']=="1") ? "checked" : "";?>> <?=$lang['edit']['skipcrossduplicates'];?> (--skipcrossduplicates)</label>
1394 </div>
1395 </div>
1396 </div>
1397 <div class="form-group">
1398 <div class="col-sm-offset-2 col-sm-10">
1399 <div class="checkbox">
1400 <label><input type="checkbox" value="1" name="subscribeall" <?=($result['subscribeall']=="1") ? "checked" : "";?>> <?=$lang['add']['subscribeall'];?> (--subscribeall)</label>
1401 </div>
1402 </div>
1403 </div>
1404 <div class="form-group">
1405 <div class="col-sm-offset-2 col-sm-10">
1406 <div class="checkbox">
1407 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : "";?>> <?=$lang['edit']['active'];?></label>
1408 </div>
1409 </div>
1410 </div>
1411 <div class="form-group">
1412 <div class="col-sm-offset-2 col-sm-10">
1413 <button class="btn btn-success" data-action="edit_selected" data-id="editsyncjob" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/syncjob' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
1414 </div>
1415 </div>
1416 </form>
1417 <?php
1418 }
1419 else {
1420 ?>
1421 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1422 <?php
1423 }
1424 }
1425 elseif (isset($_GET['filter']) &&
1426 is_numeric($_GET['filter'])) {
1427 $id = $_GET["filter"];
1428 $result = mailbox('get', 'filter_details', $id);
1429 if (!empty($result)) {
1430 ?>
1431 <h4>Filter</h4>
1432 <form class="form-horizontal" data-id="editfilter" role="form" method="post">
1433 <input type="hidden" value="0" name="active">
1434 <div class="form-group">
1435 <label class="control-label col-sm-2" for="script_desc"><?=$lang['edit']['sieve_desc'];?></label>
1436 <div class="col-sm-10">
1437 <input type="text" class="form-control" name="script_desc" id="script_desc" value="<?=htmlspecialchars($result['script_desc'], ENT_QUOTES, 'UTF-8');?>" required maxlength="255">
1438 </div>
1439 </div>
1440 <div class="form-group">
1441 <label class="control-label col-sm-2" for="filter_type"><?=$lang['edit']['sieve_type'];?></label>
1442 <div class="col-sm-10">
1443 <select id="addFilterType" name="filter_type" id="filter_type" required>
1444 <option value="prefilter" <?=($result['filter_type'] == 'prefilter') ? 'selected' : null;?>>Prefilter</option>
1445 <option value="postfilter" <?=($result['filter_type'] == 'postfilter') ? 'selected' : null;?>>Postfilter</option>
1446 </select>
1447 </div>
1448 </div>
1449 <div class="form-group">
1450 <label class="control-label col-sm-2" for="script_data">Script:</label>
1451 <div class="col-sm-10">
1452 <textarea spellcheck="false" autocorrect="off" autocapitalize="none" class="form-control textarea-code" rows="20" id="script_data" name="script_data" required><?=$result['script_data'];?></textarea>
1453 </div>
1454 </div>
1455 <div class="form-group">
1456 <div class="col-sm-offset-2 col-sm-10">
1457 <div class="checkbox">
1458 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : "";?>> <?=$lang['edit']['active'];?></label>
1459 </div>
1460 </div>
1461 </div>
1462 <div class="form-group">
1463 <div class="col-sm-offset-2 col-sm-10">
1464 <button class="btn btn-success" data-action="edit_selected" data-id="editfilter" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/filter' data-api-attr='{}' href="#"><?=$lang['edit']['validate_save'];?></button>
1465 </div>
1466 </div>
1467 </form>
1468 <?php
1469 }
1470 else {
1471 ?>
1472 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1473 <?php
1474 }
1475 }
1476 elseif (isset($_GET['app-passwd']) &&
1477 is_numeric($_GET['app-passwd'])) {
1478 $id = $_GET["app-passwd"];
1479 $result = app_passwd('details', $id);
1480 if (!empty($result)) {
1481 ?>
1482 <h4><?=$lang['edit']['app_passwd'];?></h4>
1483 <form class="form-horizontal" data-pwgen-length="32" data-id="editapp" role="form" method="post">
1484 <input type="hidden" value="0" name="active">
1485 <div class="form-group">
1486 <label class="control-label col-sm-2" for="app_name"><?=$lang['edit']['app_name'];?></label>
1487 <div class="col-sm-10">
1488 <input type="text" class="form-control" name="app_name" id="app_name" value="<?=htmlspecialchars($result['name'], ENT_QUOTES, 'UTF-8');?>" required maxlength="255">
1489 </div>
1490 </div>
1491 <div class="form-group">
1492 <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
1493 <div class="col-sm-10">
1494 <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="" autocomplete="new-password">
1495 </div>
1496 </div>
1497 <div class="form-group">
1498 <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
1499 <div class="col-sm-10">
1500 <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">
1501 </div>
1502 </div>
1503 <div class="form-group">
1504 <div class="col-sm-offset-2 col-sm-10">
1505 <div class="checkbox">
1506 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : "";?>> <?=$lang['edit']['active'];?></label>
1507 </div>
1508 </div>
1509 </div>
1510 <div class="form-group">
1511 <div class="col-sm-offset-2 col-sm-10">
1512 <button class="btn btn-success" data-action="edit_selected" data-id="editapp" data-item="<?=htmlspecialchars($result['id']);?>" data-api-url='edit/app-passwd' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>
1513 </div>
1514 </div>
1515 </form>
1516 <?php
1517 }
1518 else {
1519 ?>
1520 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1521 <?php
1522 }
1523 }
1524 }
1525}
1526else {
1527?>
1528 <div class="alert alert-danger" role="alert"><?=$lang['danger']['access_denied'];?></div>
1529<?php
1530}
1531?>
1532 </div>
1533 </div>
1534 </div>
1535 </div>
1536<a href="<?=$_SESSION['return_to'];?>">&#8592; <?=$lang['edit']['previous'];?></a>
1537</div> <!-- /container -->
1538<script type='text/javascript'>
1539<?php
1540$lang_user = json_encode($lang['user']);
1541echo "var lang_user = ". $lang_user . ";\n";
1542echo "var table_for_domain = '". ((isset($domain)) ? $domain : null) . "';\n";
1543echo "var csrf_token = '". $_SESSION['CSRF']['TOKEN'] . "';\n";
1544echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
1545?>
1546</script>
1547<?php
1548$js_minifier->add('/web/js/site/edit.js');
1549$js_minifier->add('/web/js/site/pwgen.js');
1550require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
1551?>