Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 1 | <?php |
| 2 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php'; |
| 3 | |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 4 | if (!isset($_SESSION['mailcow_cc_role']) || $_SESSION['mailcow_cc_role'] != "admin" && $_SESSION['mailcow_cc_role'] != "domainadmin") { |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 5 | header('Location: /'); |
| 6 | exit(); |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 7 | } |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 8 | require_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 = []; |
| 26 | foreach ($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']), |
| 43 | ]; |
| 44 | |
| 45 | require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php'; |