blob: 30d584f37ca6ca5899339e5420536fcfc8cefdf8 [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)) {
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02005 header('Location: /');
6 exit();
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01007}
8require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
9?>
10<div class="container">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020011 <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">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010018<?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">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020085 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010086 </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">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200109 <input class="form-control" type="text" name="username_new" value="<?=htmlspecialchars($domain_admin);?>" required onkeyup="this.value = this.value.toLowerCase();" />
110 &rdsh; <kbd>a-z - _ .</kbd>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100111 </div>
112 </div>
113 <div class="form-group">
114 <label class="control-label col-sm-2" for="domains"><?=$lang['edit']['domains'];?></label>
115 <div class="col-sm-10">
116 <select data-live-search="true" class="full-width-select" name="domains" multiple required>
117 <?php
118 foreach ($result['selected_domains'] as $domain):
119 ?>
120 <option selected><?=htmlspecialchars($domain);?></option>
121 <?php
122 endforeach;
123 foreach ($result['unselected_domains'] as $domain):
124 ?>
125 <option><?=htmlspecialchars($domain);?></option>
126 <?php
127 endforeach;
128 ?>
129 </select>
130 </div>
131 </div>
132 <div class="form-group">
133 <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
134 <div class="col-sm-10">
135 <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="" autocomplete="new-password">
136 </div>
137 </div>
138 <div class="form-group">
139 <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
140 <div class="col-sm-10">
141 <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">
142 </div>
143 </div>
144 <div class="form-group">
145 <div class="col-sm-offset-2 col-sm-10">
146 <div class="checkbox">
147 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
148 </div>
149 </div>
150 </div>
151 <div class="form-group">
152 <div class="col-sm-offset-2 col-sm-10">
153 <div class="checkbox">
154 <label><input type="checkbox" value="1" name="disable_tfa"> <?=$lang['tfa']['disable_tfa'];?></label>
155 </div>
156 </div>
157 </div>
158 <div class="form-group">
159 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200160 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100161 </div>
162 </div>
163 </form>
164 <form data-id="daacl" class="form-inline well" method="post">
165 <div class="row">
166 <div class="col-sm-1">
167 <p class="help-block">ACL</p>
168 </div>
169 <div class="col-sm-10">
170 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200171 <select id="da_acl" name="da_acl" size="10" data-container="body" multiple>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100172 <?php
173 $da_acls = acl('get', 'domainadmin', $domain_admin);
174 foreach ($da_acls as $acl => $val):
175 ?>
176 <option value="<?=$acl;?>" <?=($val == 1) ? 'selected' : null;?>><?=$lang['acl'][$acl];?></option>
177 <?php
178 endforeach;
179 ?>
180 </select>
181 </div>
182 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200183 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100184 </div>
185 </div>
186 </div>
187 </form>
188 <?php
189 }
190 else {
191 ?>
192 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
193 <?php
194 }
195 }
196 elseif (isset($_GET['admin'])) {
197 $admin = $_GET["admin"];
198 $result = admin('details', $admin);
199 if (!empty($result)) {
200 ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200201 <h4><?=$lang['edit']['admin'];?></h4>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100202 <br>
203 <form class="form-horizontal" data-id="editadmin" role="form" method="post" autocomplete="off">
204 <input type="hidden" value="0" name="active">
205 <div class="form-group">
206 <label class="control-label col-sm-2" for="username_new"><?=$lang['edit']['username'];?></label>
207 <div class="col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200208 <input class="form-control" type="text" name="username_new" onkeyup="this.value = this.value.toLowerCase();" required value="<?=htmlspecialchars($admin);?>" />
209 &rdsh; <kbd>a-z - _ .</kbd>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100210 </div>
211 </div>
212 <div class="form-group">
213 <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
214 <div class="col-sm-10">
215 <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="" autocomplete="new-password">
216 </div>
217 </div>
218 <div class="form-group">
219 <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
220 <div class="col-sm-10">
221 <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">
222 </div>
223 </div>
224 <div class="form-group">
225 <div class="col-sm-offset-2 col-sm-10">
226 <div class="checkbox">
227 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
228 </div>
229 </div>
230 </div>
231 <div class="form-group">
232 <div class="col-sm-offset-2 col-sm-10">
233 <div class="checkbox">
234 <label><input type="checkbox" value="1" name="disable_tfa"> <?=$lang['tfa']['disable_tfa'];?></label>
235 </div>
236 </div>
237 </div>
238 <div class="form-group">
239 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200240 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100241 </div>
242 </div>
243 </form>
244 <?php
245 }
246 else {
247 ?>
248 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
249 <?php
250 }
251 }
252 elseif (isset($_GET['domain']) &&
253 is_valid_domain_name($_GET["domain"]) &&
254 !empty($_GET["domain"])) {
255 $domain = $_GET["domain"];
256 $result = mailbox('get', 'domain_details', $domain);
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200257 $quota_notification_bcc = quota_notification_bcc('get', $domain);
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100258 $rl = ratelimit('get', 'domain', $domain);
259 $rlyhosts = relayhost('get');
260 if (!empty($result)) {
261 ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200262 <ul class="nav nav-tabs responsive-tabs" role="tablist">
263 <li class="active"><a data-toggle="tab" href="#dedit"><?=$lang['edit']['domain'];?></a></li>
264 <li><a data-toggle="tab" href="#dratelimit"><?=$lang['edit']['ratelimit'];?></a></li>
265 <li><a data-toggle="tab" href="#dspamfilter"><?=$lang['edit']['spam_filter'];?></a></li>
266 <li><a data-toggle="tab" href="#dqwbcc"><?=$lang['edit']['quota_warning_bcc'];?></a></li>
267 </ul>
268 <hr>
269 <div class="tab-content">
270 <div id="dedit" class="tab-pane in active">
271 <form data-id="editdomain" class="form-horizontal" role="form" method="post">
272 <input type="hidden" value="0" name="active">
273 <input type="hidden" value="0" name="backupmx">
274 <input type="hidden" value="0" name="gal">
275 <input type="hidden" value="0" name="relay_all_recipients">
276 <input type="hidden" value="0" name="relay_unknown_only">
277 <div class="form-group" data-acl="<?=$_SESSION['acl']['domain_desc'];?>">
278 <label class="control-label col-sm-2" for="description"><?=$lang['edit']['description'];?></label>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100279 <div class="col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200280 <input type="text" class="form-control" name="description" value="<?=htmlspecialchars($result['description']);?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100281 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100282 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200283 <div class="form-group">
284 <label class="control-label col-sm-2" for="relayhost"><?=$lang['edit']['relayhost'];?></label>
285 <div class="col-sm-10">
286 <select data-acl="<?=$_SESSION['acl']['domain_relayhost'];?>" data-live-search="true" id="relayhost" name="relayhost" class="form-control">
287 <?php
288 foreach ($rlyhosts as $rlyhost) {
289 ?>
290 <option class="<?=($rlyhost['active'] == 1) ? '' : 'background: #ff4136; color: #fff';?>" value="<?=$rlyhost['id'];?>" <?=($result['relayhost'] == $rlyhost['id']) ? 'selected' : null;?>>ID <?=$rlyhost['id'];?>: <?=$rlyhost['hostname'];?> (<?=$rlyhost['username'];?>)</option>
291 <?php
292 }
293 ?>
294 <option value="" <?=($result['relayhost'] == "0") ? 'selected' : null;?>><?=$lang['edit']['none_inherit'];?></option>
295 </select>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100296 </div>
297 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200298 <?php
299 if ($_SESSION['mailcow_cc_role'] == "admin") {
300 ?>
301 <div class="form-group">
302 <label class="control-label col-sm-2" for="aliases"><?=$lang['edit']['max_aliases'];?></label>
303 <div class="col-sm-10">
304 <input type="number" class="form-control" name="aliases" value="<?=intval($result['max_num_aliases_for_domain']);?>">
305 </div>
306 </div>
307 <div class="form-group">
308 <label class="control-label col-sm-2" for="mailboxes"><?=$lang['edit']['max_mailboxes'];?></label>
309 <div class="col-sm-10">
310 <input type="number" class="form-control" name="mailboxes" value="<?=intval($result['max_num_mboxes_for_domain']);?>">
311 </div>
312 </div>
313 <div class="form-group">
314 <label class="control-label col-sm-2" for="defquota"><?=$lang['edit']['mailbox_quota_def'];?></label>
315 <div class="col-sm-10">
316 <input type="number" class="form-control" name="defquota" value="<?=intval($result['def_quota_for_mbox'] / 1048576);?>">
317 </div>
318 </div>
319 <div class="form-group">
320 <label class="control-label col-sm-2" for="maxquota"><?=$lang['edit']['max_quota'];?></label>
321 <div class="col-sm-10">
322 <input type="number" class="form-control" name="maxquota" value="<?=intval($result['max_quota_for_mbox'] / 1048576);?>">
323 </div>
324 </div>
325 <div class="form-group">
326 <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['domain_quota'];?></label>
327 <div class="col-sm-10">
328 <input type="number" class="form-control" name="quota" value="<?=intval($result['max_quota_for_domain'] / 1048576);?>">
329 </div>
330 </div>
331 <div class="form-group">
332 <label class="control-label col-sm-2"><?=$lang['edit']['backup_mx_options'];?></label>
333 <div class="col-sm-10">
334 <div class="checkbox">
335 <label><input type="checkbox" value="1" name="backupmx" <?=(isset($result['backupmx']) && $result['backupmx']=="1") ? "checked" : null;?>> <?=$lang['edit']['relay_domain'];?></label>
336 <br>
337 <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>
338 <p><?=$lang['edit']['relay_all_info'];?></p>
339 <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>
340 <br>
341 <p><?=$lang['edit']['relay_transport_info'];?></p>
342 <hr style="margin:25px 0px 0px 0px">
343 </div>
344 </div>
345 </div>
346 <?php
347 }
348 ?>
349 <div class="form-group">
350 <div class="col-sm-offset-2 col-sm-10">
351 <div class="checkbox">
352 <label><input type="checkbox" value="1" name="gal" <?=(isset($result['gal']) && $result['gal']=="1") ? "checked" : null;?>> <?=$lang['edit']['gal'];?></label>
353 <small class="help-block"><?=$lang['edit']['gal_info'];?></small>
354 </div>
355 </div>
356 </div>
357 <hr>
358 <div class="form-group">
359 <div class="col-sm-offset-2 col-sm-10">
360 <div class="checkbox">
361 <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>
362 </div>
363 </div>
364 </div>
365 <div class="form-group">
366 <div class="col-sm-offset-2 col-sm-10">
367 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
368 </div>
369 </div>
370 </form>
371 <?php
372 if (!empty($dkim = dkim('details', $domain))) {
373 ?>
374 <hr>
375 <div class="row">
376 <div class="col-xs-12 col-sm-2">
377 <p>Domain: <strong><?=htmlspecialchars($result['domain_name']);?></strong> (<?=$dkim['dkim_selector'];?>._domainkey)</p>
378 </div>
379 <div class="col-xs-12 col-sm-10">
380 <pre><?=$dkim['dkim_txt'];?></pre>
381 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100382 </div>
383 <?php
384 }
385 ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200386 </div>
387 <div id="dratelimit" class="tab-pane">
388 <form data-id="domratelimit" class="form-inline well" method="post">
389 <div class="form-group">
390 <label class="control-label"><?=$lang['edit']['ratelimit'];?></label>
391 <input name="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" autocomplete="off" class="form-control" placeholder="<?=$lang['ratelimit']['disabled']?>">
392 </div>
393 <div class="form-group">
394 <select name="rl_frame" class="form-control">
395 <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>><?=$lang['ratelimit']['second']?></option>
396 <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>><?=$lang['ratelimit']['minute']?></option>
397 <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>><?=$lang['ratelimit']['hour']?></option>
398 <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>><?=$lang['ratelimit']['day']?></option>
399 </select>
400 </div>
401 <div class="form-group">
402 <button data-acl="<?=$_SESSION['acl']['ratelimit'];?>" class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
403 </div>
404 </form>
405 </div>
406 <div id="dspamfilter" class="tab-pane">
407 <div class="row">
408 <div class="col-sm-6">
409 <h4><?=$lang['user']['spamfilter_wl'];?></h4>
410 <p><?=$lang['user']['spamfilter_wl_desc'];?></p>
411 <form class="form-inline space20" data-id="add_wl_policy_domain">
412 <div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
413 <input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>
414 <span class="input-group-btn">
415 <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>
416 </span>
417 </div>
418 </form>
419 <div class="table-responsive">
420 <table class="table table-striped table-condensed" id="wl_policy_domain_table"></table>
421 </div>
422 <div class="mass-actions-user">
423 <div class="btn-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
424 <a class="btn btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-sm btn-default" id="toggle_multi_select_all" data-id="policy_wl_domain" href="#"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></a>
425 <a class="btn btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-sm btn-danger" data-action="delete_selected" data-id="policy_wl_domain" data-api-url='delete/domain-policy' href="#"><?=$lang['mailbox']['remove'];?></a>
426 <div class="clearfix visible-xs"></div>
427 </div>
428 </div>
429 </div>
430 <div class="col-sm-6">
431 <h4><?=$lang['user']['spamfilter_bl'];?></h4>
432 <p><?=$lang['user']['spamfilter_bl_desc'];?></p>
433 <form class="form-inline space20" data-id="add_bl_policy_domain">
434 <div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
435 <input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>
436 <span class="input-group-btn">
437 <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>
438 </span>
439 </div>
440 </form>
441 <div class="table-responsive">
442 <table class="table table-striped table-condensed" id="bl_policy_domain_table"></table>
443 </div>
444 <div class="mass-actions-user">
445 <div class="btn-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
446 <a class="btn btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-sm btn-default" id="toggle_multi_select_all" data-id="policy_bl_domain" href="#"><i class="bi bi-check-all"></i> <?=$lang['mailbox']['toggle_all'];?></a>
447 <a class="btn btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
448 </div>
449 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100450 </div>
451 </div>
452 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200453 <div id="dqwbcc" class="tab-pane">
454 <div class="row">
455 <div class="col-sm-12">
456 <h4><?=$lang['edit']['quota_warning_bcc'];?></h4>
457 <p><?=$lang['edit']['quota_warning_bcc_info'];?></p>
458 <form class="form-horizontal" data-id="quota_bcc">
459 <input type="hidden" value="0" name="active">
460 <div class="form-group">
461 <label class="control-label col-sm-2" for="script_data"><?=$lang['edit']['target_address'];?>:</label>
462 <div class="col-sm-10">
463 <textarea spellcheck="false" autocorrect="off" autocapitalize="none" class="form-control" rows="10" id="bcc_rcpt" name="bcc_rcpt"><?=implode(PHP_EOL, (array)$quota_notification_bcc['bcc_rcpts']);?></textarea>
464 </div>
465 </div>
466 <div class="form-group">
467 <div class="col-sm-offset-2 col-sm-10">
468 <div class="checkbox">
469 <label><input type="checkbox" value="1" name="active" <?=($quota_notification_bcc['active']=="1") ? "checked" : "";?>> <?=$lang['edit']['active'];?></label>
470 </div>
471 </div>
472 </div>
473 <div class="form-group">
474 <div class="col-sm-offset-2 col-sm-10">
475 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-id="quota_bcc" data-item="quota_bcc" data-api-url='edit/quota_notification_bcc' data-api-attr='{"domain":"<?=$domain;?>"}' href="#"><?=$lang['edit']['save'];?></button>
476 </div>
477 </div>
478 </form>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100479 </div>
480 </div>
481 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100482 </div>
483 <?php
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100484 }
485 else {
486 ?>
487 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
488 <?php
489 }
490 }
491 elseif (isset($_GET['oauth2client']) &&
492 is_numeric($_GET["oauth2client"]) &&
493 !empty($_GET["oauth2client"])) {
494 $oauth2client = $_GET["oauth2client"];
495 $result = oauth2('details', 'client', $oauth2client);
496 if (!empty($result)) {
497 ?>
498 <h4>OAuth2</h4>
499 <form data-id="oauth2client" class="form-horizontal" role="form" method="post">
500 <div class="form-group">
501 <label class="control-label col-sm-2" for="client_id"><?=$lang['edit']['client_id'];?></label>
502 <div class="col-sm-10">
503 <input type="text" class="form-control" name="client_id" id="client_id" value="<?=htmlspecialchars($result['client_id']);?>" disabled>
504 </div>
505 </div>
506 <div class="form-group">
507 <label class="control-label col-sm-2" for="client_secret"><?=$lang['edit']['client_secret'];?></label>
508 <div class="col-sm-10">
509 <input type="text" class="form-control" name="client_secret" id="client_secret" value="<?=htmlspecialchars($result['client_secret']);?>" disabled>
510 </div>
511 </div>
512 <div class="form-group">
513 <label class="control-label col-sm-2" for="scope"><?=$lang['edit']['scope'];?></label>
514 <div class="col-sm-10">
515 <input type="text" class="form-control" name="scope" id="scope" value="<?=htmlspecialchars($result['scope']);?>" disabled>
516 </div>
517 </div>
518 <div class="form-group">
519 <label class="control-label col-sm-2" for="redirect_uri"><?=$lang['edit']['redirect_uri'];?></label>
520 <div class="col-sm-10">
521 <input type="text" class="form-control" name="redirect_uri" id="redirect_uri" value="<?=htmlspecialchars($result['redirect_uri']);?>">
522 </div>
523 </div>
524 <div class="form-group">
525 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200526 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100527 </div>
528 </div>
529 </form>
530 <?php
531 }
532 else {
533 ?>
534 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
535 <?php
536 }
537 }
538 elseif (isset($_GET['aliasdomain']) &&
539 is_valid_domain_name(html_entity_decode(rawurldecode($_GET["aliasdomain"]))) &&
540 !empty($_GET["aliasdomain"])) {
541 $alias_domain = html_entity_decode(rawurldecode($_GET["aliasdomain"]));
542 $result = mailbox('get', 'alias_domain_details', $alias_domain);
543 $rl = ratelimit('get', 'domain', $alias_domain);
544 if (!empty($result)) {
545 ?>
546 <h4><?=$lang['edit']['edit_alias_domain'];?></h4>
547 <form class="form-horizontal" data-id="editaliasdomain" role="form" method="post">
548 <input type="hidden" value="0" name="active">
549 <div class="form-group">
550 <label class="control-label col-sm-2" for="target_domain"><?=$lang['edit']['target_domain'];?></label>
551 <div class="col-sm-10">
552 <select class="full-width-select" data-live-search="true" id="addSelectDomain" name="target_domain" required>
553 <?php
554 foreach (mailbox('get', 'domains') as $domain):
555 ?>
556 <option <?=($result['target_domain'] != $domain) ?: 'selected';?>><?=htmlspecialchars($domain);?></option>
557 <?php
558 endforeach;
559 ?>
560 </select>
561 </div>
562 </div>
563 <div class="form-group">
564 <div class="col-sm-offset-2 col-sm-10">
565 <div class="checkbox">
566 <label><input type="checkbox" value="1" name="active" <?=(isset($result['active']) && $result['active']=="1") ? "checked" : null ?>> <?=$lang['edit']['active'];?></label>
567 </div>
568 </div>
569 </div>
570 <div class="form-group">
571 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200572 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100573 </div>
574 </div>
575 </form>
576 <hr>
577 <form data-id="domratelimit" class="form-inline well" method="post">
578 <div class="form-group">
579 <label class="control-label"><?=$lang['acl']['ratelimit'];?></label>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200580 <input name="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" autocomplete="off" class="form-control" placeholder="<?=$lang['ratelimit']['disabled']?>">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100581 </div>
582 <div class="form-group">
583 <select name="rl_frame" class="form-control">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200584 <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>><?=$lang['ratelimit']['second']?></option>
585 <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>><?=$lang['ratelimit']['minute']?></option>
586 <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>><?=$lang['ratelimit']['hour']?></option>
587 <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>><?=$lang['ratelimit']['day']?></option>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100588 </select>
589 </div>
590 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200591 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100592 </div>
593 </form>
594 <?php
595 if (!empty($dkim = dkim('details', $alias_domain))) {
596 ?>
597 <hr>
598 <div class="row">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200599 <div class="col-xs-12 col-sm-2">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100600 <p>Domain: <strong><?=htmlspecialchars($result['alias_domain']);?></strong> (<?=$dkim['dkim_selector'];?>._domainkey)</p>
601 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200602 <div class="col-xs-12 col-sm-10">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100603 <pre><?=$dkim['dkim_txt'];?></pre>
604 </div>
605 </div>
606 <?php
607 }
608 }
609 else {
610 ?>
611 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
612 <?php
613 }
614 }
615 elseif (isset($_GET['mailbox']) && filter_var(html_entity_decode(rawurldecode($_GET["mailbox"])), FILTER_VALIDATE_EMAIL) && !empty($_GET["mailbox"])) {
616 $mailbox = html_entity_decode(rawurldecode($_GET["mailbox"]));
617 $result = mailbox('get', 'mailbox_details', $mailbox);
618 $rl = ratelimit('get', 'mailbox', $mailbox);
619 $pushover_data = pushover('get', $mailbox);
620 $quarantine_notification = mailbox('get', 'quarantine_notification', $mailbox);
621 $quarantine_category = mailbox('get', 'quarantine_category', $mailbox);
622 $get_tls_policy = mailbox('get', 'tls_policy', $mailbox);
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200623 $rlyhosts = relayhost('get');
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100624 if (!empty($result)) {
625 ?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200626 <ul class="nav nav-tabs responsive-tabs" role="tablist">
627 <li class="active"><a data-toggle="tab" href="#medit"><?=$lang['edit']['mailbox'];?></a></li>
628 <li><a data-toggle="tab" href="#mpushover"><?=$lang['edit']['pushover'];?></a></li>
629 <li><a data-toggle="tab" href="#macl"><?=$lang['edit']['acl'];?></a></li>
630 <li><a data-toggle="tab" href="#mrl"><?=$lang['edit']['ratelimit'];?></a></li>
631 </ul>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100632 <hr>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200633 <div class="tab-content">
634 <div id="medit" class="tab-pane in active">
635 <form class="form-horizontal" data-id="editmailbox" role="form" method="post">
636 <input type="hidden" value="default" name="sender_acl">
637 <input type="hidden" value="0" name="force_pw_update">
638 <input type="hidden" value="0" name="sogo_access">
639 <input type="hidden" value="0" name="protocol_access">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100640 <div class="form-group">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200641 <label class="control-label col-sm-2" for="name"><?=$lang['edit']['full_name'];?></label>
642 <div class="col-sm-10">
643 <input type="text" class="form-control" name="name" value="<?=htmlspecialchars($result['name'], ENT_QUOTES, 'UTF-8');?>">
644 </div>
645 </div>
646 <div class="form-group">
647 <label class="control-label col-sm-2" for="quota"><?=$lang['edit']['quota_mb'];?>
648 <br><span id="quotaBadge" class="badge">max. <?=intval($result['max_new_quota'] / 1048576)?> MiB</span>
649 </label>
650 <div class="col-sm-10">
651 <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">
652 <small class="help-block">0 = ∞</small>
653 </div>
654 </div>
655 <div class="form-group">
656 <label class="control-label col-sm-2" for="sender_acl"><?=$lang['edit']['sender_acl'];?></label>
657 <div class="col-sm-10">
658 <select data-live-search="true" data-width="100%" style="width:100%" id="editSelectSenderACL" name="sender_acl" size="10" multiple>
659 <?php
660 $sender_acl_handles = mailbox('get', 'sender_acl_handles', $mailbox);
661
662 foreach ($sender_acl_handles['sender_acl_domains']['ro'] as $domain):
663 ?>
664 <option data-subtext="Admin" value="<?=htmlspecialchars($domain);?>" disabled selected><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>
665 <?php
666 endforeach;
667
668 foreach ($sender_acl_handles['sender_acl_addresses']['ro'] as $alias):
669 ?>
670 <option data-subtext="Admin" disabled selected><?=htmlspecialchars($alias);?></option>
671 <?php
672 endforeach;
673
674 foreach ($sender_acl_handles['fixed_sender_aliases'] as $alias):
675 ?>
676 <option data-subtext="Alias" disabled selected><?=htmlspecialchars($alias);?></option>
677 <?php
678 endforeach;
679
680 foreach ($sender_acl_handles['sender_acl_domains']['rw'] as $domain):
681 ?>
682 <option value="<?=htmlspecialchars($domain);?>" selected><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>
683 <?php
684 endforeach;
685
686 foreach ($sender_acl_handles['sender_acl_domains']['selectable'] as $domain):
687 ?>
688 <option value="<?=htmlspecialchars($domain);?>"><?=htmlspecialchars(sprintf($lang['edit']['dont_check_sender_acl'], $domain));?></option>
689 <?php
690 endforeach;
691
692 foreach ($sender_acl_handles['sender_acl_addresses']['rw'] as $address):
693 ?>
694 <option selected><?=htmlspecialchars($address);?></option>
695 <?php
696 endforeach;
697
698 foreach ($sender_acl_handles['sender_acl_addresses']['selectable'] as $address):
699 ?>
700 <option><?=htmlspecialchars($address);?></option>
701 <?php
702 endforeach;
703
704 // Generated here, but used in extended_sender_acl
705 if (!empty($sender_acl_handles['external_sender_aliases'])) {
706 $ext_sender_acl = implode(', ', $sender_acl_handles['external_sender_aliases']);
707 }
708 else {
709 $ext_sender_acl = '';
710 }
711
712 ?>
713 </select>
714 <div id="sender_acl_disabled"><i class="bi bi-shield-exclamation"></i> <?=$lang['edit']['sender_acl_disabled'];?></div>
715 <small class="help-block"><?=$lang['edit']['sender_acl_info'];?></small>
716 </div>
717 </div>
718 <div class="form-group">
719 <label class="control-label col-sm-2" for="relayhost"><?=$lang['edit']['relayhost'];?></label>
720 <div class="col-sm-10">
721 <select data-acl="<?=$_SESSION['acl']['mailbox_relayhost'];?>" data-live-search="true" id="relayhost" name="relayhost" class="form-control space20">
722 <?php
723 foreach ($rlyhosts as $rlyhost) {
724 ?>
725 <option style="<?=($rlyhost['active'] == 1) ? '' : 'background: #ff4136; color: #fff';?>" value="<?=$rlyhost['id'];?>" <?=($result['attributes']['relayhost'] == $rlyhost['id']) ? 'selected' : null;?>>ID <?=$rlyhost['id'];?>: <?=$rlyhost['hostname'];?> (<?=$rlyhost['username'];?>)</option>
726 <?php
727 }
728 ?>
729 <option value="" <?=($result['attributes']['relayhost'] == "0" || empty($result['attributes']['relayhost'])) ? 'selected' : null;?>><?=$lang['edit']['none_inherit'];?></option>
730 </select>
731 <p class="visible-xs" style="margin: 0;padding: 0">&nbsp;</p>
732 <small class="help-block"><?=$lang['edit']['mailbox_relayhost_info'];?></small>
733 </div>
734 </div>
735 <div class="form-group">
736 <label class="control-label col-sm-2"><?=$lang['user']['quarantine_notification'];?></label>
737 <div class="col-sm-10">
738 <div class="btn-group" data-acl="<?=$_SESSION['acl']['quarantine_notification'];?>">
739 <button type="button" class="btn btn-sm btn-xs-quart visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_notification == "never") ? "active" : null;?>"
740 data-action="edit_selected"
741 data-item="<?= htmlentities($mailbox); ?>"
742 data-id="quarantine_notification"
743 data-api-url='edit/quarantine_notification'
744 data-api-attr='{"quarantine_notification":"never"}'><?=$lang['user']['never'];?></button>
745 <button type="button" class="btn btn-sm btn-xs-quart visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_notification == "hourly") ? "active" : null;?>"
746 data-action="edit_selected"
747 data-item="<?= htmlentities($mailbox); ?>"
748 data-id="quarantine_notification"
749 data-api-url='edit/quarantine_notification'
750 data-api-attr='{"quarantine_notification":"hourly"}'><?=$lang['user']['hourly'];?></button>
751 <button type="button" class="btn btn-sm btn-xs-quart visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_notification == "daily") ? "active" : null;?>"
752 data-action="edit_selected"
753 data-item="<?= htmlentities($mailbox); ?>"
754 data-id="quarantine_notification"
755 data-api-url='edit/quarantine_notification'
756 data-api-attr='{"quarantine_notification":"daily"}'><?=$lang['user']['daily'];?></button>
757 <button type="button" class="btn btn-sm btn-xs-quart visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_notification == "weekly") ? "active" : null;?>"
758 data-action="edit_selected"
759 data-item="<?= htmlentities($mailbox); ?>"
760 data-id="quarantine_notification"
761 data-api-url='edit/quarantine_notification'
762 data-api-attr='{"quarantine_notification":"weekly"}'><?=$lang['user']['weekly'];?></button>
763 <div class="clearfix visible-xs"></div>
764 </div>
765 <p class="help-block"><small><?=$lang['user']['quarantine_notification_info'];?></small></p>
766 </div>
767 </div>
768 <div class="form-group">
769 <label class="control-label col-sm-2"><?=$lang['user']['quarantine_category'];?></label>
770 <div class="col-sm-10">
771 <div class="btn-group" data-acl="<?=$_SESSION['acl']['quarantine_category'];?>">
772 <button type="button" class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_category == "reject") ? "active" : null;?>"
773 data-action="edit_selected"
774 data-item="<?= htmlentities($mailbox); ?>"
775 data-id="quarantine_category"
776 data-api-url='edit/quarantine_category'
777 data-api-attr='{"quarantine_category":"reject"}'><?=$lang['user']['q_reject'];?></button>
778 <button type="button" class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_category == "add_header") ? "active" : null;?>"
779 data-action="edit_selected"
780 data-item="<?= htmlentities($mailbox); ?>"
781 data-id="quarantine_category"
782 data-api-url='edit/quarantine_category'
783 data-api-attr='{"quarantine_category":"add_header"}'><?=$lang['user']['q_add_header'];?></button>
784 <button type="button" class="btn btn-sm btn-xs-third visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($quarantine_category == "all") ? "active" : null;?>"
785 data-action="edit_selected"
786 data-item="<?= htmlentities($mailbox); ?>"
787 data-id="quarantine_category"
788 data-api-url='edit/quarantine_category'
789 data-api-attr='{"quarantine_category":"all"}'><?=$lang['user']['q_all'];?></button>
790 <div class="clearfix visible-xs"></div>
791 </div>
792 <p class="help-block"><small><?=$lang['user']['quarantine_category_info'];?></small></p>
793 </div>
794 </div>
795 <div class="form-group">
796 <label class="control-label col-sm-2" for="sender_acl"><?=$lang['user']['tls_policy'];?></label>
797 <div class="col-sm-10">
798 <div class="btn-group" data-acl="<?=$_SESSION['acl']['tls_policy'];?>">
799 <button type="button" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($get_tls_policy['tls_enforce_in'] == "1") ? "active" : null;?>"
800 data-action="edit_selected"
801 data-item="<?= htmlentities($mailbox); ?>"
802 data-id="tls_policy"
803 data-api-url='edit/tls_policy'
804 data-api-attr='{"tls_enforce_in":<?=($get_tls_policy['tls_enforce_in'] == "1") ? "0" : "1";?>}'><?=$lang['user']['tls_enforce_in'];?></button>
805 <button type="button" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default <?=($get_tls_policy['tls_enforce_out'] == "1") ? "active" : null;?>"
806 data-action="edit_selected"
807 data-item="<?= htmlentities($mailbox); ?>"
808 data-id="tls_policy"
809 data-api-url='edit/tls_policy'
810 data-api-attr='{"tls_enforce_out":<?=($get_tls_policy['tls_enforce_out'] == "1") ? "0" : "1";?>}'><?=$lang['user']['tls_enforce_out'];?></button>
811 <div class="clearfix visible-xs"></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100812 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200813 </div>
814 </div>
815 <div class="form-group">
816 <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
817 <div class="col-sm-10">
818 <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="<?=$lang['edit']['unchanged_if_empty'];?>" autocomplete="new-password">
819 </div>
820 </div>
821 <div class="form-group">
822 <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
823 <div class="col-sm-10">
824 <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">
825 </div>
826 </div>
827 <div data-acl="<?=$_SESSION['acl']['extend_sender_acl'];?>" class="form-group">
828 <label class="control-label col-sm-2" for="extended_sender_acl"><?=$lang['edit']['extended_sender_acl'];?></label>
829 <div class="col-sm-10">
830 <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, ...">
831 <small class="help-block"><?=$lang['edit']['extended_sender_acl_info'];?></small>
832 </div>
833 </div>
834 <div class="form-group">
835 <label class="control-label col-sm-2" for="protocol_access"><?=$lang['edit']['allowed_protocols'];?></label>
836 <div class="col-sm-10">
837 <select data-acl="<?=$_SESSION['acl']['protocol_access'];?>" name="protocol_access" multiple class="form-control">
838 <option value="imap" <?=($result['attributes']['imap_access']=="1") ? 'selected' : null;?>>IMAP</option>
839 <option value="pop3" <?=($result['attributes']['pop3_access']=="1") ? 'selected' : null;?>>POP3</option>
840 <option value="smtp" <?=($result['attributes']['smtp_access']=="1") ? 'selected' : null;?>>SMTP</option>
841 </select>
842 </div>
843 </div>
844 <div hidden data-acl="<?=$_SESSION['acl']['smtp_ip_access'];?>" class="form-group">
845 <label class="control-label col-sm-2" for="allow_from_smtp"><?=$lang['edit']['allow_from_smtp'];?></label>
846 <div class="col-sm-10">
847 <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, ...">
848 <small class="help-block"><?=$lang['edit']['allow_from_smtp_info'];?></small>
849 </div>
850 </div>
851 <hr>
852 <div class="form-group">
853 <div class="col-sm-offset-2 col-sm-10">
854 <select name="active" class="form-control">
855 <option value="1" <?=($result['active']=="1") ? 'selected' : null;?>><?=$lang['edit']['active'];?></option>
856 <option value="2" <?=($result['active']=="2") ? 'selected' : null;?>><?=$lang['edit']['disable_login'];?></option>
857 <option value="0" <?=($result['active']=="0") ? 'selected' : null;?>><?=$lang['edit']['inactive'];?></option>
858 </select>
859 </div>
860 </div>
861 <div class="form-group">
862 <div class="col-sm-offset-2 col-sm-10">
863 <div class="checkbox">
864 <label><input type="checkbox" value="1" name="force_pw_update" <?=($result['attributes']['force_pw_update']=="1") ? "checked" : null;?>> <?=$lang['edit']['force_pw_update'];?></label>
865 <small class="help-block"><?=sprintf($lang['edit']['force_pw_update_info'], $UI_TEXTS['main_name']);?></small>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100866 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200867 </div>
868 </div>
869 <?php if (getenv('SKIP_SOGO') != "y") { ?>
870 <div data-acl="<?=$_SESSION['acl']['sogo_access'];?>" class="form-group">
871 <div class="col-sm-offset-2 col-sm-10">
872 <div class="checkbox">
873 <label><input type="checkbox" value="1" name="sogo_access" <?=($result['attributes']['sogo_access']=="1") ? "checked" : null;?>> <?=$lang['edit']['sogo_access'];?></label>
874 <small class="help-block"><?=$lang['edit']['sogo_access_info'];?></small>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100875 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200876 </div>
877 </div>
878 <?php } ?>
879 <div class="form-group">
880 <div class="col-sm-offset-2 col-sm-10">
881 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
882 </div>
883 </div>
884 </form>
885 </div>
886 <div id="mpushover" class="tab-pane">
887 <form data-id="pushover" class="form well" method="post">
888 <input type="hidden" value="0" name="evaluate_x_prio">
889 <input type="hidden" value="0" name="only_x_prio">
890 <input type="hidden" value="0" name="active">
891 <div class="row">
892 <div class="col-sm-1">
893 <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>
894 </div>
895 <div class="col-sm-10">
896 <p class="help-block"><?=sprintf($lang['edit']['pushover_info'], $mailbox);?></p>
897 <p class="help-block"><?=$lang['edit']['pushover_vars'];?>: <code>{SUBJECT}</code>, <code>{SENDER}</code></p>
898 <div class="form-group">
899 <div class="row">
900 <div class="col-sm-6">
901 <div class="form-group">
902 <label for="token">API Token/Key (Application)</label>
903 <input type="text" class="form-control" name="token" maxlength="30" value="<?=$pushover_data['token'];?>" required>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100904 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200905 </div>
906 <div class="col-sm-6">
907 <div class="form-group">
908 <label for="key">User/Group Key</label>
909 <input type="text" class="form-control" name="key" maxlength="30" value="<?=$pushover_data['key'];?>" required>
910 </div>
911 </div>
912 <div class="col-sm-6">
913 <div class="form-group">
914 <label for="title"><?=$lang['edit']['pushover_title'];?></label>
915 <input type="text" class="form-control" name="title" value="<?=$pushover_data['title'];?>" placeholder="Mail">
916 </div>
917 </div>
918 <div class="col-sm-6">
919 <div class="form-group">
920 <label for="text"><?=$lang['edit']['pushover_text'];?></label>
921 <input type="text" class="form-control" name="text" value="<?=$pushover_data['text'];?>" placeholder="You've got mail 📧">
922 </div>
923 </div>
924 <div class="col-sm-12">
925 <div class="form-group">
926 <label for="text"><?=$lang['edit']['pushover_sender_array'];?></label>
927 <input type="text" class="form-control" name="senders" value="<?=$pushover_data['senders'];?>" placeholder="sender1@example.com, sender2@example.com">
928 </div>
929 </div>
930 <div class="col-sm-12">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100931 <div class="checkbox">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200932 <label><input type="checkbox" value="1" name="active" <?=($pushover_data['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
933 </div>
934 </div>
935 <div class="col-sm-12">
936 <legend style="cursor:pointer;margin-top:10px" data-target="#po_advanced" unselectable="on" data-toggle="collapse">
937 <i class="bi bi-plus"></i> <?=$lang['edit']['advanced_settings'];?>
938 </legend>
939 </div>
940 <div class="col-sm-12">
941 <div id="po_advanced" class="collapse">
942 <div class="form-group">
943 <label for="text"><?=$lang['edit']['pushover_sender_regex'];?></label>
944 <input type="text" class="form-control" name="senders_regex" value="<?=$pushover_data['senders_regex'];?>" placeholder="/(.*@example\.org$|^foo@example\.com$)/i" regex="true">
945 <div class="checkbox">
946 <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>
947 </div>
948 <div class="checkbox">
949 <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>
950 </div>
951 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100952 </div>
953 </div>
954 </div>
955 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200956 <div class="btn-group" data-acl="<?=$_SESSION['acl']['pushover'];?>">
957 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
958 <a class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-action="edit_selected" data-id="pushover-test" data-item="<?=htmlspecialchars($mailbox);?>" data-api-url='edit/pushover-test' data-api-attr='{}' href="#"><i class="bi bi-check-lg"></i> <?=$lang['edit']['pushover_verify'];?></a>
959 <div class="clearfix visible-xs"></div>
960 <a id="pushover_delete" class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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="#"><i class="bi bi-trash"></i> <?=$lang['edit']['remove'];?></a>
961 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100962 </div>
963 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200964 </form>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100965 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200966 <div id="macl" class="tab-pane">
967 <form data-id="useracl" class="form-inline well" method="post">
968 <div class="row">
969 <div class="col-sm-1">
970 <p class="help-block">ACL</p>
971 </div>
972 <div class="col-sm-10">
973 <div class="form-group">
974 <select id="user_acl" name="user_acl" size="10" multiple>
975 <?php
976 $user_acls = acl('get', 'user', $mailbox);
977 foreach ($user_acls as $acl => $val):
978 ?>
979 <option value="<?=$acl;?>" <?=($val == 1) ? 'selected' : null;?>><?=$lang['acl'][$acl];?></option>
980 <?php
981 endforeach;
982 ?>
983 </select>
984 </div>
985 <div class="form-group">
986 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
987 </div>
988 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100989 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200990 </form>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +0100991 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +0200992 <div id="mrl" class="tab-pane">
993 <form data-id="mboxratelimit" class="form-inline well" method="post">
994 <div class="row">
995 <div class="col-sm-1">
996 <p class="help-block"><?=$lang['acl']['ratelimit'];?></p>
997 </div>
998 <div class="col-sm-10">
999 <div class="form-group">
1000 <input name="rl_value" type="number" autocomplete="off" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" class="form-control" placeholder="<?=$lang['ratelimit']['disabled']?>">
1001 </div>
1002 <div class="form-group">
1003 <select name="rl_frame" class="form-control">
1004 <option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>><?=$lang['ratelimit']['second']?></option>
1005 <option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>><?=$lang['ratelimit']['minute']?></option>
1006 <option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>><?=$lang['ratelimit']['hour']?></option>
1007 <option value="d" <?=(isset($rl['frame']) && $rl['frame'] == 'd') ? 'selected' : null;?>><?=$lang['ratelimit']['day']?></option>
1008 </select>
1009 </div>
1010 <div class="form-group">
1011 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
1012 </div>
1013 <p class="help-block"><?=$lang['edit']['mbox_rl_info'];?></p>
1014 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001015 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001016 </form>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001017 </div>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001018 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001019 <?php
1020 }
1021 }
1022 elseif (isset($_GET['relayhost']) && is_numeric($_GET["relayhost"]) && !empty($_GET["relayhost"])) {
1023 $relayhost = intval($_GET["relayhost"]);
1024 $result = relayhost('details', $relayhost);
1025 if (!empty($result)) {
1026 ?>
1027 <h4><?=$lang['edit']['resource'];?></h4>
1028 <form class="form-horizontal" role="form" method="post" data-id="editrelayhost">
1029 <input type="hidden" value="0" name="active">
1030 <div class="form-group">
1031 <label class="control-label col-sm-2" for="hostname"><?=$lang['add']['hostname'];?></label>
1032 <div class="col-sm-10">
1033 <input type="text" class="form-control" name="hostname" value="<?=htmlspecialchars($result['hostname'], ENT_QUOTES, 'UTF-8');?>" required>
1034 <p class="help-block"><?=$lang['add']['relayhost_wrapped_tls_info'];?></p>
1035 </div>
1036 </div>
1037 <div class="form-group">
1038 <label class="control-label col-sm-2" for="username"><?=$lang['add']['username'];?></label>
1039 <div class="col-sm-10">
1040 <input type="text" class="form-control" name="username" value="<?=htmlspecialchars($result['username'], ENT_QUOTES, 'UTF-8');?>">
1041 </div>
1042 </div>
1043 <div class="form-group">
1044 <label class="control-label col-sm-2" for="password"><?=$lang['add']['password'];?></label>
1045 <div class="col-sm-10">
1046 <input type="text" data-hibp="true" class="form-control" name="password" value="<?=htmlspecialchars($result['password'], ENT_QUOTES, 'UTF-8');?>">
1047 </div>
1048 </div>
1049 <div class="form-group">
1050 <div class="col-sm-offset-2 col-sm-10">
1051 <div class="checkbox">
1052 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
1053 </div>
1054 </div>
1055 </div>
1056 <div class="form-group">
1057 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001058 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001059 </div>
1060 </div>
1061 </form>
1062 <?php
1063 }
1064 else {
1065 ?>
1066 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1067 <?php
1068 }
1069 }
1070 elseif (isset($_GET['transport']) && is_numeric($_GET["transport"]) && !empty($_GET["transport"])) {
1071 $transport = intval($_GET["transport"]);
1072 $result = transport('details', $transport);
1073 if (!empty($result)) {
1074 ?>
1075 <h4><?=$lang['edit']['resource'];?></h4>
1076 <form class="form-horizontal" role="form" method="post" data-id="edittransport">
1077 <input type="hidden" value="0" name="active">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001078 <input type="hidden" value="0" name="is_mx_based">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001079 <div class="form-group">
1080 <label class="control-label col-sm-2" for="destination"><?=$lang['add']['destination'];?></label>
1081 <div class="col-sm-10">
1082 <input type="text" class="form-control" name="destination" value="<?=htmlspecialchars($result['destination'], ENT_QUOTES, 'UTF-8');?>" required>
1083 </div>
1084 </div>
1085 <div class="form-group">
1086 <label class="control-label col-sm-2" for="nexthop"><?=$lang['edit']['nexthop'];?></label>
1087 <div class="col-sm-10">
1088 <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>
1089 </div>
1090 </div>
1091 <div class="form-group">
1092 <label class="control-label col-sm-2" for="username"><?=$lang['add']['username'];?></label>
1093 <div class="col-sm-10">
1094 <input type="text" class="form-control" name="username" value="<?=htmlspecialchars($result['username'], ENT_QUOTES, 'UTF-8');?>">
1095 </div>
1096 </div>
1097 <div class="form-group">
1098 <label class="control-label col-sm-2" for="password"><?=$lang['add']['password'];?></label>
1099 <div class="col-sm-10">
1100 <input type="text" data-hibp="true" class="form-control" name="password" value="<?=htmlspecialchars($result['password'], ENT_QUOTES, 'UTF-8');?>">
1101 </div>
1102 </div>
1103 <div class="form-group">
1104 <div class="col-sm-offset-2 col-sm-10">
1105 <div class="checkbox">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001106 <label><input type="checkbox" value="1" name="is_mx_based" <?=($result['is_mx_based']=="1") ? "checked" : null;?>> <?=$lang['edit']['lookup_mx'];?></label>
1107 </div>
1108 </div>
1109 </div>
1110 <div class="form-group">
1111 <div class="col-sm-offset-2 col-sm-10">
1112 <div class="checkbox">
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001113 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
1114 </div>
1115 </div>
1116 </div>
1117 <div class="form-group">
1118 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001119 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001120 </div>
1121 </div>
1122 </form>
1123 <?php
1124 }
1125 else {
1126 ?>
1127 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1128 <?php
1129 }
1130 }
1131 elseif (isset($_GET['resource']) && filter_var(html_entity_decode(rawurldecode($_GET["resource"])), FILTER_VALIDATE_EMAIL) && !empty($_GET["resource"])) {
1132 $resource = html_entity_decode(rawurldecode($_GET["resource"]));
1133 $result = mailbox('get', 'resource_details', $resource);
1134 if (!empty($result)) {
1135 ?>
1136 <h4><?=$lang['edit']['resource'];?></h4>
1137 <form class="form-horizontal" role="form" method="post" data-id="editresource">
1138 <input type="hidden" value="0" name="active">
1139 <div class="form-group">
1140 <label class="control-label col-sm-2" for="description"><?=$lang['add']['description'];?></label>
1141 <div class="col-sm-10">
1142 <input type="text" class="form-control" name="description" value="<?=htmlspecialchars($result['description'], ENT_QUOTES, 'UTF-8');?>" required>
1143 </div>
1144 </div>
1145 <div class="form-group">
1146 <label class="control-label col-sm-2" for="domain"><?=$lang['edit']['kind'];?></label>
1147 <div class="col-sm-10">
1148 <select name="kind" title="<?=$lang['edit']['select'];?>" required>
1149 <option value="location" <?=($result['kind'] == "location") ? "selected" : null;?>>Location</option>
1150 <option value="group" <?=($result['kind'] == "group") ? "selected" : null;?>>Group</option>
1151 <option value="thing" <?=($result['kind'] == "thing") ? "selected" : null;?>>Thing</option>
1152 </select>
1153 </div>
1154 </div>
1155 <div class="form-group">
1156 <label class="control-label col-sm-2" for="multiple_bookings_select"><?=$lang['add']['multiple_bookings'];?></label>
1157 <div class="col-sm-10">
1158 <select name="multiple_bookings_select" id="editSelectMultipleBookings" title="<?=$lang['add']['select'];?>" required>
1159 <option value="0" <?=($result['multiple_bookings'] == 0) ? "selected" : null;?>><?=$lang['mailbox']['booking_0'];?></option>
1160 <option value="-1" <?=($result['multiple_bookings'] == -1) ? "selected" : null;?>><?=$lang['mailbox']['booking_lt0'];?></option>
1161 <option value="custom" <?=($result['multiple_bookings'] >= 1) ? "selected" : null;?>><?=$lang['mailbox']['booking_custom'];?></option>
1162 </select>
1163 <div style="display:none" id="multiple_bookings_custom_div">
1164 <hr>
1165 <input type="number" class="form-control" name="multiple_bookings_custom" id="multiple_bookings_custom" value="<?=($result['multiple_bookings'] >= 1) ? $result['multiple_bookings'] : null;?>">
1166 </div>
1167 <input type="hidden" name="multiple_bookings" id="multiple_bookings">
1168 </div>
1169 </div>
1170 <div class="form-group">
1171 <div class="col-sm-offset-2 col-sm-10">
1172 <div class="checkbox">
1173 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
1174 </div>
1175 </div>
1176 </div>
1177 <div class="form-group">
1178 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001179 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001180 </div>
1181 </div>
1182 </form>
1183 <?php
1184 }
1185 else {
1186 ?>
1187 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1188 <?php
1189 }
1190 }
1191 elseif (isset($_GET['bcc']) && !empty($_GET["bcc"])) {
1192 $bcc = intval($_GET["bcc"]);
1193 $result = bcc('details', $bcc);
1194 if (!empty($result)) {
1195 ?>
1196 <h4><?=$lang['mailbox']['bcc_map'];?></h4>
1197 <br>
1198 <form class="form-horizontal" data-id="editbcc" role="form" method="post">
1199 <input type="hidden" value="0" name="active">
1200 <div class="form-group">
1201 <label class="control-label col-sm-2" for="bcc_dest"><?=$lang['mailbox']['bcc_destination'];?></label>
1202 <div class="col-sm-10">
1203 <input value="<?=$result['bcc_dest'];?>" type="text" class="form-control" name="bcc_dest" id="bcc_dest">
1204 <small><?=$lang['edit']['bcc_dest_format'];?></small>
1205 </div>
1206 </div>
1207 <div class="form-group">
1208 <label class="control-label col-sm-2" for="type"><?=$lang['mailbox']['bcc_map_type'];?></label>
1209 <div class="col-sm-10">
1210 <select id="addFilterType" name="type" id="type" required>
1211 <option value="sender" <?=($result['type'] == 'sender') ? 'selected' : null;?>><?=$lang['mailbox']['bcc_sender_map'];?></option>
1212 <option value="rcpt" <?=($result['type'] == 'rcpt') ? 'selected' : null;?>><?=$lang['mailbox']['bcc_rcpt_map'];?></option>
1213 </select>
1214 </div>
1215 </div>
1216 <div class="form-group">
1217 <div class="col-sm-offset-2 col-sm-10">
1218 <div class="checkbox">
1219 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
1220 </div>
1221 </div>
1222 </div>
1223 <div class="form-group">
1224 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001225 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001226 </div>
1227 </div>
1228 </form>
1229 <?php
1230 }
1231 else {
1232 ?>
1233 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1234 <?php
1235 }
1236 }
1237 elseif (isset($_GET['recipient_map']) &&
1238 !empty($_GET["recipient_map"]) &&
1239 $_SESSION['mailcow_cc_role'] == "admin") {
1240 $map = intval($_GET["recipient_map"]);
1241 $result = recipient_map('details', $map);
1242 if (substr($result['recipient_map_old'], 0, 1) == '@') {
1243 $result['recipient_map_old'] = substr($result['recipient_map_old'], 1);
1244 }
1245 if (!empty($result)) {
1246 ?>
1247 <h4><?=$lang['mailbox']['recipient_map']?>: <?=$result['recipient_map_old'];?></h4>
1248 <br>
1249 <form class="form-horizontal" data-id="edit_recipient_map" role="form" method="post">
1250 <input type="hidden" value="0" name="active">
1251 <div class="form-group">
1252 <label class="control-label col-sm-2" for="recipient_map_new"><?=$lang['mailbox']['recipient_map_old'];?></label>
1253 <div class="col-sm-10">
1254 <input value="<?=$result['recipient_map_old'];?>" type="text" class="form-control" name="recipient_map_old" id="recipient_map_old">
1255 <small><?=$lang['mailbox']['recipient_map_old_info'];?></small>
1256 </div>
1257 </div>
1258 <div class="form-group">
1259 <label class="control-label col-sm-2" for="recipient_map_new"><?=$lang['mailbox']['recipient_map_new'];?></label>
1260 <div class="col-sm-10">
1261 <input value="<?=$result['recipient_map_new'];?>" type="text" class="form-control" name="recipient_map_new" id="recipient_map_new">
1262 <small><?=$lang['mailbox']['recipient_map_new_info'];?></small>
1263 </div>
1264 </div>
1265 <div class="form-group">
1266 <div class="col-sm-offset-2 col-sm-10">
1267 <div class="checkbox">
1268 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
1269 </div>
1270 </div>
1271 </div>
1272 <div class="form-group">
1273 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001274 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001275 </div>
1276 </div>
1277 </form>
1278 <?php
1279 }
1280 else {
1281 ?>
1282 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1283 <?php
1284 }
1285 }
1286 elseif (isset($_GET['tls_policy_map']) &&
1287 !empty($_GET["tls_policy_map"]) &&
1288 $_SESSION['mailcow_cc_role'] == "admin") {
1289 $map = intval($_GET["tls_policy_map"]);
1290 $result = tls_policy_maps('details', $map);
1291 if (!empty($result)) {
1292 ?>
1293 <h4><?=$lang['mailbox']['tls_policy_maps']?>: <?=$result['dest'];?></h4>
1294 <br>
1295 <form class="form-horizontal" data-id="edit_tls_policy_maps" role="form" method="post">
1296 <input type="hidden" value="0" name="active">
1297 <div class="form-group">
1298 <label class="control-label col-sm-2" for="dest"><?=$lang['mailbox']['tls_map_dest'];?></label>
1299 <div class="col-sm-10">
1300 <input value="<?=$result['dest'];?>" type="text" class="form-control" name="dest" id="dest">
1301 <small><?=$lang['mailbox']['tls_map_dest_info'];?></small>
1302 </div>
1303 </div>
1304 <div class="form-group">
1305 <label class="control-label col-sm-2" for="policy"><?=$lang['mailbox']['tls_map_policy'];?></label>
1306 <div class="col-sm-10">
1307 <select class="full-width-select" name="policy" required>
1308 <option value="none" <?=($result['policy'] != 'none') ?: 'selected';?>>none</option>
1309 <option value="may" <?=($result['policy'] != 'may') ?: 'selected';?>>may</option>
1310 <option value="encrypt" <?=($result['policy'] != 'encrypt') ?: 'selected';?>>encrypt</option>
1311 <option value="dane" <?=($result['policy'] != 'dane') ?: 'selected';?>>dane</option>
1312 <option value="dane-only" <?=($result['policy'] != 'dane-only') ?: 'selected';?>>dane-only</option>
1313 <option value="fingerprint" <?=($result['policy'] != 'fingerprint') ?: 'selected';?>>fingerprint</option>
1314 <option value="verify" <?=($result['policy'] != 'verify') ?: 'selected';?>>verify</option>
1315 <option value="secure" <?=($result['policy'] != 'secure') ?: 'selected';?>>secure</option>
1316 </select>
1317 </div>
1318 </div>
1319 <div class="form-group">
1320 <label class="control-label col-sm-2" for="parameters"><?=$lang['mailbox']['tls_map_parameters'];?></label>
1321 <div class="col-sm-10">
1322 <input value="<?=$result['parameters'];?>" type="text" class="form-control" name="parameters" id="parameters">
1323 <small><?=$lang['mailbox']['tls_map_parameters_info'];?></small>
1324 </div>
1325 </div>
1326 <div class="form-group">
1327 <div class="col-sm-offset-2 col-sm-10">
1328 <div class="checkbox">
1329 <label><input type="checkbox" value="1" name="active" <?php if (isset($result['active']) && $result['active']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['active'];?></label>
1330 </div>
1331 </div>
1332 </div>
1333 <div class="form-group">
1334 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001335 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001336 </div>
1337 </div>
1338 </form>
1339 <?php
1340 }
1341 else {
1342 ?>
1343 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1344 <?php
1345 }
1346 }
1347 }
1348 if ($_SESSION['mailcow_cc_role'] == "admin" || $_SESSION['mailcow_cc_role'] == "domainadmin" || $_SESSION['mailcow_cc_role'] == "user") {
1349 if (isset($_GET['syncjob']) &&
1350 is_numeric($_GET['syncjob'])) {
1351 $id = $_GET["syncjob"];
1352 $result = mailbox('get', 'syncjob_details', $id);
1353 if (!empty($result)) {
1354 ?>
1355 <h4><?=$lang['edit']['syncjob'];?></h4>
1356 <form class="form-horizontal" data-id="editsyncjob" role="form" method="post">
1357 <input type="hidden" value="0" name="delete2duplicates">
1358 <input type="hidden" value="0" name="delete1">
1359 <input type="hidden" value="0" name="delete2">
1360 <input type="hidden" value="0" name="automap">
1361 <input type="hidden" value="0" name="skipcrossduplicates">
1362 <input type="hidden" value="0" name="active">
1363 <input type="hidden" value="0" name="subscribeall">
1364 <div class="form-group">
1365 <label class="control-label col-sm-2" for="host1"><?=$lang['edit']['hostname'];?></label>
1366 <div class="col-sm-10">
1367 <input type="text" class="form-control" name="host1" id="host1" value="<?=htmlspecialchars($result['host1'], ENT_QUOTES, 'UTF-8');?>">
1368 </div>
1369 </div>
1370 <div class="form-group">
1371 <label class="control-label col-sm-2" for="port1">Port</label>
1372 <div class="col-sm-10">
1373 <input type="number" class="form-control" name="port1" id="port1" min="1" max="65535" value="<?=htmlspecialchars($result['port1'], ENT_QUOTES, 'UTF-8');?>">
1374 </div>
1375 </div>
1376 <div class="form-group">
1377 <label class="control-label col-sm-2" for="user1"><?=$lang['edit']['username'];?></label>
1378 <div class="col-sm-10">
1379 <input type="text" class="form-control" name="user1" id="user1" value="<?=htmlspecialchars($result['user1'], ENT_QUOTES, 'UTF-8');?>">
1380 </div>
1381 </div>
1382 <div class="form-group">
1383 <label class="control-label col-sm-2" for="password1"><?=$lang['edit']['password'];?></label>
1384 <div class="col-sm-10">
1385 <input type="password" class="form-control" name="password1" id="password1" value="<?=htmlspecialchars($result['password1'], ENT_QUOTES, 'UTF-8');?>">
1386 </div>
1387 </div>
1388 <div class="form-group">
1389 <label class="control-label col-sm-2" for="enc1"><?=$lang['edit']['encryption'];?></label>
1390 <div class="col-sm-10">
1391 <select id="enc1" name="enc1">
1392 <option value="SSL" <?=($result['enc1'] == "SSL") ? "selected" : null;?>>SSL</option>
1393 <option value="TLS" <?=($result['enc1'] == "TLS") ? "selected" : null;?>>STARTTLS</option>
1394 <option value="PLAIN" <?=($result['enc1'] == "PLAIN") ? "selected" : null;?>>PLAIN</option>
1395 </select>
1396 </div>
1397 </div>
1398 <div class="form-group">
1399 <label class="control-label col-sm-2" for="mins_interval"><?=$lang['edit']['mins_interval'];?></label>
1400 <div class="col-sm-10">
1401 <input type="number" class="form-control" name="mins_interval" min="1" max="43800" value="<?=htmlspecialchars($result['mins_interval'], ENT_QUOTES, 'UTF-8');?>" required>
1402 <small class="help-block">1-43800</small>
1403 </div>
1404 </div>
1405 <div class="form-group">
1406 <label class="control-label col-sm-2" for="subfolder2"><?=$lang['edit']['subfolder2'];?></label>
1407 <div class="col-sm-10">
1408 <input type="text" class="form-control" name="subfolder2" id="subfolder2" value="<?=htmlspecialchars($result['subfolder2'], ENT_QUOTES, 'UTF-8');?>">
1409 </div>
1410 </div>
1411 <div class="form-group">
1412 <label class="control-label col-sm-2" for="maxage"><?=$lang['edit']['maxage'];?></label>
1413 <div class="col-sm-10">
1414 <input type="number" class="form-control" name="maxage" id="maxage" min="0" max="32000" value="<?=htmlspecialchars($result['maxage'], ENT_QUOTES, 'UTF-8');?>">
1415 <small class="help-block">0-32000</small>
1416 </div>
1417 </div>
1418 <div class="form-group">
1419 <label class="control-label col-sm-2" for="maxbytespersecond"><?=$lang['edit']['maxbytespersecond'];?></label>
1420 <div class="col-sm-10">
1421 <input type="number" class="form-control" name="maxbytespersecond" id="maxbytespersecond" min="0" max="125000000" value="<?=htmlspecialchars($result['maxbytespersecond'], ENT_QUOTES, 'UTF-8');?>">
1422 <small class="help-block">0-125000000</small>
1423 </div>
1424 </div>
1425 <div class="form-group">
1426 <label class="control-label col-sm-2" for="timeout1"><?=$lang['add']['timeout1'];?></label>
1427 <div class="col-sm-10">
1428 <input type="number" class="form-control" name="timeout1" id="timeout1" min="1" max="32000" value="<?=htmlspecialchars($result['timeout1'], ENT_QUOTES, 'UTF-8');?>">
1429 <small class="help-block">1-32000</small>
1430 </div>
1431 </div>
1432 <div class="form-group">
1433 <label class="control-label col-sm-2" for="timeout2"><?=$lang['add']['timeout2'];?></label>
1434 <div class="col-sm-10">
1435 <input type="number" class="form-control" name="timeout2" id="timeout2" min="1" max="32000" value="<?=htmlspecialchars($result['timeout2'], ENT_QUOTES, 'UTF-8');?>">
1436 <small class="help-block">1-32000</small>
1437 </div>
1438 </div>
1439 <div class="form-group">
1440 <label class="control-label col-sm-2" for="exclude"><?=$lang['edit']['exclude'];?></label>
1441 <div class="col-sm-10">
1442 <input type="text" class="form-control" name="exclude" id="exclude" value="<?=htmlspecialchars($result['exclude'], ENT_QUOTES, 'UTF-8');?>">
1443 </div>
1444 </div>
1445 <div class="form-group">
1446 <label class="control-label col-sm-2" for="custom_params"><?=$lang['add']['custom_params'];?></label>
1447 <div class="col-sm-10">
1448 <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">
1449 <small class="help-block"><?=$lang['add']['custom_params_hint'];?></small>
1450 </div>
1451 </div>
1452 <div class="form-group">
1453 <div class="col-sm-offset-2 col-sm-10">
1454 <div class="checkbox">
1455 <label><input type="checkbox" value="1" name="delete2duplicates" <?=($result['delete2duplicates']=="1") ? "checked" : "";?>> <?=$lang['edit']['delete2duplicates'];?> (--delete2duplicates)</label>
1456 </div>
1457 </div>
1458 </div>
1459 <div class="form-group">
1460 <div class="col-sm-offset-2 col-sm-10">
1461 <div class="checkbox">
1462 <label><input type="checkbox" value="1" name="delete1" <?=($result['delete1']=="1") ? "checked" : "";?>> <?=$lang['edit']['delete1'];?> (--delete1)</label>
1463 </div>
1464 </div>
1465 </div>
1466 <div class="form-group">
1467 <div class="col-sm-offset-2 col-sm-10">
1468 <div class="checkbox">
1469 <label><input type="checkbox" value="1" name="delete2" <?=($result['delete2']=="1") ? "checked" : "";?>> <?=$lang['edit']['delete2'];?> (--delete2)</label>
1470 </div>
1471 </div>
1472 </div>
1473 <div class="form-group">
1474 <div class="col-sm-offset-2 col-sm-10">
1475 <div class="checkbox">
1476 <label><input type="checkbox" value="1" name="automap" <?=($result['automap']=="1") ? "checked" : "";?>> <?=$lang['edit']['automap'];?> (--automap)</label>
1477 </div>
1478 </div>
1479 </div>
1480 <div class="form-group">
1481 <div class="col-sm-offset-2 col-sm-10">
1482 <div class="checkbox">
1483 <label><input type="checkbox" value="1" name="skipcrossduplicates" <?=($result['skipcrossduplicates']=="1") ? "checked" : "";?>> <?=$lang['edit']['skipcrossduplicates'];?> (--skipcrossduplicates)</label>
1484 </div>
1485 </div>
1486 </div>
1487 <div class="form-group">
1488 <div class="col-sm-offset-2 col-sm-10">
1489 <div class="checkbox">
1490 <label><input type="checkbox" value="1" name="subscribeall" <?=($result['subscribeall']=="1") ? "checked" : "";?>> <?=$lang['add']['subscribeall'];?> (--subscribeall)</label>
1491 </div>
1492 </div>
1493 </div>
1494 <div class="form-group">
1495 <div class="col-sm-offset-2 col-sm-10">
1496 <div class="checkbox">
1497 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : "";?>> <?=$lang['edit']['active'];?></label>
1498 </div>
1499 </div>
1500 </div>
1501 <div class="form-group">
1502 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001503 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001504 </div>
1505 </div>
1506 </form>
1507 <?php
1508 }
1509 else {
1510 ?>
1511 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1512 <?php
1513 }
1514 }
1515 elseif (isset($_GET['filter']) &&
1516 is_numeric($_GET['filter'])) {
1517 $id = $_GET["filter"];
1518 $result = mailbox('get', 'filter_details', $id);
1519 if (!empty($result)) {
1520 ?>
1521 <h4>Filter</h4>
1522 <form class="form-horizontal" data-id="editfilter" role="form" method="post">
1523 <input type="hidden" value="0" name="active">
1524 <div class="form-group">
1525 <label class="control-label col-sm-2" for="script_desc"><?=$lang['edit']['sieve_desc'];?></label>
1526 <div class="col-sm-10">
1527 <input type="text" class="form-control" name="script_desc" id="script_desc" value="<?=htmlspecialchars($result['script_desc'], ENT_QUOTES, 'UTF-8');?>" required maxlength="255">
1528 </div>
1529 </div>
1530 <div class="form-group">
1531 <label class="control-label col-sm-2" for="filter_type"><?=$lang['edit']['sieve_type'];?></label>
1532 <div class="col-sm-10">
1533 <select id="addFilterType" name="filter_type" id="filter_type" required>
1534 <option value="prefilter" <?=($result['filter_type'] == 'prefilter') ? 'selected' : null;?>>Prefilter</option>
1535 <option value="postfilter" <?=($result['filter_type'] == 'postfilter') ? 'selected' : null;?>>Postfilter</option>
1536 </select>
1537 </div>
1538 </div>
1539 <div class="form-group">
1540 <label class="control-label col-sm-2" for="script_data">Script:</label>
1541 <div class="col-sm-10">
1542 <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>
1543 </div>
1544 </div>
1545 <div class="form-group">
1546 <div class="col-sm-offset-2 col-sm-10">
1547 <div class="checkbox">
1548 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : "";?>> <?=$lang['edit']['active'];?></label>
1549 </div>
1550 </div>
1551 </div>
1552 <div class="form-group">
1553 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001554 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001555 </div>
1556 </div>
1557 </form>
1558 <?php
1559 }
1560 else {
1561 ?>
1562 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1563 <?php
1564 }
1565 }
1566 elseif (isset($_GET['app-passwd']) &&
1567 is_numeric($_GET['app-passwd'])) {
1568 $id = $_GET["app-passwd"];
1569 $result = app_passwd('details', $id);
1570 if (!empty($result)) {
1571 ?>
1572 <h4><?=$lang['edit']['app_passwd'];?></h4>
1573 <form class="form-horizontal" data-pwgen-length="32" data-id="editapp" role="form" method="post">
1574 <input type="hidden" value="0" name="active">
1575 <div class="form-group">
1576 <label class="control-label col-sm-2" for="app_name"><?=$lang['edit']['app_name'];?></label>
1577 <div class="col-sm-10">
1578 <input type="text" class="form-control" name="app_name" id="app_name" value="<?=htmlspecialchars($result['name'], ENT_QUOTES, 'UTF-8');?>" required maxlength="255">
1579 </div>
1580 </div>
1581 <div class="form-group">
1582 <label class="control-label col-sm-2" for="password"><?=$lang['edit']['password'];?> (<a href="#" class="generate_password"><?=$lang['edit']['generate'];?></a>)</label>
1583 <div class="col-sm-10">
1584 <input type="password" data-pwgen-field="true" data-hibp="true" class="form-control" name="password" placeholder="" autocomplete="new-password">
1585 </div>
1586 </div>
1587 <div class="form-group">
1588 <label class="control-label col-sm-2" for="password2"><?=$lang['edit']['password_repeat'];?></label>
1589 <div class="col-sm-10">
1590 <input type="password" data-pwgen-field="true" class="form-control" name="password2" autocomplete="new-password">
1591 </div>
1592 </div>
1593 <div class="form-group">
1594 <div class="col-sm-offset-2 col-sm-10">
1595 <div class="checkbox">
1596 <label><input type="checkbox" value="1" name="active" <?=($result['active']=="1") ? "checked" : "";?>> <?=$lang['edit']['active'];?></label>
1597 </div>
1598 </div>
1599 </div>
1600 <div class="form-group">
1601 <div class="col-sm-offset-2 col-sm-10">
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001602 <button class="btn btn-xs-lg visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline 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>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001603 </div>
1604 </div>
1605 </form>
1606 <?php
1607 }
1608 else {
1609 ?>
1610 <div class="alert alert-info" role="alert"><?=$lang['info']['no_action'];?></div>
1611 <?php
1612 }
1613 }
1614 }
1615}
1616else {
1617?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001618 <div class="alert alert-danger" role="alert"><?=$lang['danger']['access_denied'];?></div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001619<?php
1620}
1621?>
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001622 </div>
1623 </div>
1624 </div>
1625 </div>
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001626<a href="<?=$_SESSION['return_to'];?>">&#8592; <?=$lang['edit']['previous'];?></a>
1627</div> <!-- /container -->
1628<script type='text/javascript'>
1629<?php
1630$lang_user = json_encode($lang['user']);
1631echo "var lang_user = ". $lang_user . ";\n";
1632echo "var table_for_domain = '". ((isset($domain)) ? $domain : null) . "';\n";
1633echo "var csrf_token = '". $_SESSION['CSRF']['TOKEN'] . "';\n";
1634echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
1635?>
1636</script>
1637<?php
1638$js_minifier->add('/web/js/site/edit.js');
1639$js_minifier->add('/web/js/site/pwgen.js');
1640require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
1641?>