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';
|
2021-11-15 03:09:39 +08:00
|
|
|
$number_of_app_passwords = 0;
|
|
|
|
foreach (app_passwd("get") as $app_password)
|
|
|
|
{
|
|
|
|
$app_password = app_passwd("details", $app_password['id']);
|
|
|
|
if ($app_password['active'])
|
|
|
|
{
|
|
|
|
++$number_of_app_passwords;
|
|
|
|
}
|
|
|
|
}
|
2021-09-23 02:47:10 +08:00
|
|
|
$template_data = [
|
|
|
|
'acl' => $_SESSION['acl'],
|
|
|
|
'acl_json' => json_encode($_SESSION['acl']),
|
|
|
|
'user_spam_score' => mailbox('get', 'spam_score', $username),
|
|
|
|
'tfa_data' => $tfa_data,
|
2022-03-07 18:41:13 +08:00
|
|
|
'tfa_id' => @$_SESSION['tfa_id'],
|
2021-09-23 02:47:10 +08:00
|
|
|
'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-11-15 03:09:39 +08:00
|
|
|
'number_of_app_passwords' => $number_of_app_passwords,
|
2022-06-03 21:45:36 +08:00
|
|
|
'lang_datatables' => json_encode($lang['datatables']),
|
2021-09-23 02:47:10 +08:00
|
|
|
];
|
|
|
|
}
|
2022-07-12 21:26:03 +08:00
|
|
|
else {
|
2021-09-23 02:47:10 +08:00
|
|
|
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';
|