blob: 65c76f5318904b50f72a80deed5603d39dcf9117 [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
3
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01004if (!isset($_SESSION['mailcow_cc_role']) || $_SESSION['mailcow_cc_role'] != "admin" && $_SESSION['mailcow_cc_role'] != "domainadmin") {
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02005 header('Location: /');
6 exit();
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01007}
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01008require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
9$_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
10
11
12
13$js_minifier->add('/web/js/site/mailbox.js');
14$js_minifier->add('/web/js/presets/sieveMailbox.js');
15$js_minifier->add('/web/js/site/pwgen.js');
16
17$role = ($_SESSION['mailcow_cc_role'] == "admin") ? 'admin' : 'domainadmin';
18$is_dual = (!empty($_SESSION["dual-login"]["username"])) ? 'true' : 'false';
19$allow_admin_email_login = (preg_match("/^([yY][eE][sS]|[yY])+$/", $_ENV["ALLOW_ADMIN_EMAIL_LOGIN"])) ? 'true' : 'false';
20
21// domains
22$domains = mailbox('get', 'domains');
23
24// mailboxes
25$mailboxes = [];
26foreach ($domains as $domain) {
27 foreach (mailbox('get', 'mailboxes', $domain) as $mailbox) {
28 $mailboxes[] = $mailbox;
29 }
30}
31
32$template = 'mailbox.twig';
33$template_data = [
34 'acl' => $_SESSION['acl'],
35 'acl_json' => json_encode($_SESSION['acl']),
36 'role' => $role,
37 'is_dual' => $is_dual,
38 'allow_admin_email_login' => $allow_admin_email_login,
39 'global_filters' => mailbox('get', 'global_filter_details'),
40 'domains' => $domains,
41 'mailboxes' => $mailboxes,
42 'lang_mailbox' => json_encode($lang['mailbox']),
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010043 'lang_rl' => json_encode($lang['ratelimit']),
44 'lang_datatables' => json_encode($lang['datatables']),
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010045];
46
47require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';