2021-07-09 14:21:09 +08:00
|
|
|
<?php
|
|
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
|
|
|
|
if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'domainadmin') {
|
|
|
|
|
|
|
|
/*
|
|
|
|
/ DOMAIN ADMIN
|
|
|
|
*/
|
|
|
|
|
2021-08-20 02:27:59 +08:00
|
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
|
|
|
|
$_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
2021-07-09 14:21:09 +08:00
|
|
|
$tfa_data = get_tfa();
|
|
|
|
$fido2_data = fido2(array("action" => "get_friendly_names"));
|
2021-08-20 02:27:59 +08:00
|
|
|
$username = $_SESSION['mailcow_cc_username'];
|
2021-07-09 14:21:09 +08:00
|
|
|
|
2021-09-23 02:47:10 +08:00
|
|
|
$template = 'domainadmin.twig';
|
|
|
|
$template_data = [
|
|
|
|
'acl' => $_SESSION['acl'],
|
|
|
|
'acl_json' => json_encode($_SESSION['acl']),
|
|
|
|
'user_spam_score' => mailbox('get', 'spam_score', $username),
|
|
|
|
'tfa_data' => $tfa_data,
|
|
|
|
'fido2_data' => $fido2_data,
|
|
|
|
'lang_user' => json_encode($lang['user']),
|
|
|
|
];
|
2021-07-09 14:21:09 +08:00
|
|
|
}
|
|
|
|
elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'user') {
|
|
|
|
|
|
|
|
/*
|
|
|
|
/ USER
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
|
|
|
|
$_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
|
|
|
$username = $_SESSION['mailcow_cc_username'];
|
|
|
|
$mailboxdata = mailbox('get', 'mailbox_details', $username);
|
|
|
|
$pushover_data = pushover('get', $username);
|
|
|
|
$tfa_data = get_tfa();
|
|
|
|
$fido2_data = fido2(array("action" => "get_friendly_names"));
|
|
|
|
|
|
|
|
$clientconfigstr = "host=" . urlencode($mailcow_hostname) . "&email=" . urlencode($username) . "&name=" . urlencode($mailboxdata['name']) . "&ui=" . urlencode(strtok($_SERVER['HTTP_HOST'], ':')) . "&port=" . urlencode($autodiscover_config['caldav']['port']);
|
|
|
|
if ($autodiscover_config['useEASforOutlook'] == 'yes')
|
|
|
|
$clientconfigstr .= "&outlookEAS=1";
|
|
|
|
if (file_exists('thunderbird-plugins/version.csv')) {
|
|
|
|
$fh = fopen('thunderbird-plugins/version.csv', 'r');
|
|
|
|
if ($fh) {
|
|
|
|
while (($row = fgetcsv($fh, 1000, ';')) !== FALSE) {
|
|
|
|
if ($row[0] == 'sogo-connector@inverse.ca') {
|
|
|
|
$clientconfigstr .= "&connector=" . urlencode($row[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose($fh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-23 02:47:10 +08:00
|
|
|
// Get user information about aliases
|
|
|
|
$user_get_alias_details = user_get_alias_details($username);
|
|
|
|
$user_get_alias_details['direct_aliases'] = array_filter($user_get_alias_details['direct_aliases']);
|
|
|
|
$user_get_alias_details['shared_aliases'] = array_filter($user_get_alias_details['shared_aliases']);
|
|
|
|
$user_domains[] = mailbox('get', 'mailbox_details', $username)['domain'];
|
|
|
|
$user_alias_domains = $user_get_alias_details['alias_domains'];
|
|
|
|
if (!empty($user_alias_domains)) {
|
|
|
|
$user_domains = array_merge($user_domains, $user_alias_domains);
|
|
|
|
}
|
2021-07-09 14:21:09 +08:00
|
|
|
|
2021-09-23 02:47:10 +08:00
|
|
|
$template = 'user.twig';
|
|
|
|
$template_data = [
|
|
|
|
'acl' => $_SESSION['acl'],
|
|
|
|
'acl_json' => json_encode($_SESSION['acl']),
|
|
|
|
'user_spam_score' => mailbox('get', 'spam_score', $username),
|
|
|
|
'tfa_data' => $tfa_data,
|
|
|
|
'fido2_data' => $fido2_data,
|
|
|
|
'mailboxdata' => $mailboxdata,
|
|
|
|
'clientconfigstr' => $clientconfigstr,
|
|
|
|
'user_get_alias_details' => $user_get_alias_details,
|
|
|
|
'get_tagging_options' => mailbox('get', 'delimiter_action', $username),
|
|
|
|
'get_tls_policy' => mailbox('get', 'tls_policy', $username),
|
|
|
|
'quarantine_notification' => mailbox('get', 'quarantine_notification', $username),
|
|
|
|
'quarantine_category' => mailbox('get', 'quarantine_category', $username),
|
|
|
|
'user_domains' => $user_domains,
|
|
|
|
'pushover_data' => $pushover_data,
|
|
|
|
'lang_user' => json_encode($lang['user']),
|
|
|
|
];
|
|
|
|
}
|
2021-07-09 14:21:09 +08:00
|
|
|
|
2021-09-23 02:47:10 +08:00
|
|
|
if (!isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin') {
|
|
|
|
header('Location: /');
|
|
|
|
exit();
|
2021-07-09 14:21:09 +08:00
|
|
|
}
|
2021-09-23 02:47:10 +08:00
|
|
|
|
2021-07-09 14:21:09 +08:00
|
|
|
$js_minifier->add('/web/js/site/user.js');
|
|
|
|
$js_minifier->add('/web/js/site/pwgen.js');
|
2021-09-23 02:47:10 +08:00
|
|
|
|
2021-07-09 14:21:09 +08:00
|
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|