2017-05-16 19:20:58 +02:00
|
|
|
<?php
|
2018-08-03 20:31:33 +02:00
|
|
|
logger();
|
2019-10-20 21:25:58 +02:00
|
|
|
|
|
|
|
$hash = $js_minifier->getDataHash();
|
|
|
|
$JSPath = '/tmp/' . $hash . '.js';
|
|
|
|
if(!file_exists($JSPath)) {
|
|
|
|
$js_minifier->minify($JSPath);
|
|
|
|
cleanupJS($hash);
|
|
|
|
}
|
2021-09-22 20:47:10 +02:00
|
|
|
|
|
|
|
$alertbox_log_parser = alertbox_log_parser($_SESSION);
|
|
|
|
$alerts = [];
|
|
|
|
if (is_array($alertbox_log_parser)) {
|
|
|
|
foreach ($alertbox_log_parser as $log) {
|
2021-10-15 17:18:26 +02:00
|
|
|
$alerts[trim($log['type'], '"')][] = trim($log['msg'], '"');
|
2020-11-15 20:32:37 +02:00
|
|
|
}
|
2021-09-22 20:47:10 +02:00
|
|
|
$alert = array_filter(array_unique($alerts));
|
|
|
|
foreach($alert as $alert_type => $alert_msg) {
|
2021-10-16 15:23:39 +02:00
|
|
|
$alerts[$alert_type] = implode('<hr class="alert-hr">', $alert_msg);
|
2020-11-15 20:32:37 +02:00
|
|
|
}
|
2018-08-03 20:31:33 +02:00
|
|
|
unset($_SESSION['return']);
|
2021-09-22 20:47:10 +02:00
|
|
|
}
|
2017-05-16 19:20:58 +02:00
|
|
|
|
2021-09-22 20:47:10 +02:00
|
|
|
$globalVariables = [
|
|
|
|
'js_path' => '/cache/'.basename($JSPath),
|
|
|
|
'pending_tfa_method' => @$_SESSION['pending_tfa_method'],
|
|
|
|
'pending_mailcow_cc_username' => @$_SESSION['pending_mailcow_cc_username'],
|
|
|
|
'lang_footer' => json_encode($lang['footer']),
|
|
|
|
'lang_acl' => json_encode($lang['acl']),
|
|
|
|
'lang_tfa' => json_encode($lang['tfa']),
|
|
|
|
'lang_fido2' => json_encode($lang['fido2']),
|
|
|
|
'docker_timeout' => $DOCKER_TIMEOUT,
|
|
|
|
'session_lifetime' => (int)$SESSION_LIFETIME,
|
|
|
|
'csrf_token' => $_SESSION['CSRF']['TOKEN'],
|
|
|
|
'pagination_size' => $PAGINATION_SIZE,
|
|
|
|
'log_pagination_size' => $LOG_PAGINATION_SIZE,
|
|
|
|
'alerts' => $alerts,
|
2021-10-21 00:10:05 +02:00
|
|
|
'totp_secret' => $tfa->createSecret(),
|
2021-09-22 20:47:10 +02:00
|
|
|
];
|
2019-09-22 15:10:56 +02:00
|
|
|
|
2021-09-22 20:47:10 +02:00
|
|
|
foreach ($globalVariables as $globalVariableName => $globalVariableValue) {
|
|
|
|
$twig->addGlobal($globalVariableName, $globalVariableValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $twig->render($template, $template_data);
|
2019-10-23 22:09:10 +02:00
|
|
|
|
2021-05-20 15:51:52 +02:00
|
|
|
if (isset($_SESSION['mailcow_cc_api'])) {
|
|
|
|
session_regenerate_id(true);
|
|
|
|
session_unset();
|
|
|
|
session_destroy();
|
|
|
|
session_write_close();
|
|
|
|
header("Location: /");
|
|
|
|
}
|
2017-05-16 19:20:58 +02:00
|
|
|
$stmt = null;
|
2017-12-09 14:17:15 +02:00
|
|
|
$pdo = null;
|