public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/web/inc/footer.inc.php
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
<?php
2
logger();
4
$hash = $js_minifier->getDataHash();
5
$JSPath = '/tmp/' . $hash . '.js';
6
if(!file_exists($JSPath)) {
7
$js_minifier->minify($JSPath);
8
cleanupJS($hash);
9
}
11
$alertbox_log_parser = alertbox_log_parser($_SESSION);
12
$alerts = [];
13
if (is_array($alertbox_log_parser)) {
14
foreach ($alertbox_log_parser as $log) {
15
$message = htmlspecialchars($log['msg'], ENT_QUOTES);
16
$message = strtr($message, ["\n" => '', "\r" => '', "\t" => '<br>']);
17
$alerts[trim($log['type'], '"')][] = trim($message, '"');
18
}
19
$alert = array_filter(array_unique($alerts));
20
foreach($alert as $alert_type => $alert_msg) {
21
// html breaks from mysql alerts, replace ` with '
22
$alerts[$alert_type] = implode('<hr class="alert-hr">', str_replace("`", "'", $alert_msg));
23
}
24
unset($_SESSION['return']);
25
}
27
// map tfa details for twig
28
$pending_tfa_authmechs = [];
29
if (array_key_exists('pending_tfa_methods', $_SESSION)) {
30
foreach($_SESSION['pending_tfa_methods'] as $authdata){
31
$pending_tfa_authmechs[$authdata['authmech']] = false;
32
}
33
if (isset($pending_tfa_authmechs['webauthn'])) {
34
$pending_tfa_authmechs['webauthn'] = true;
35
}
36
if (!isset($pending_tfa_authmechs['webauthn'])
37
&& isset($pending_tfa_authmechs['yubi_otp'])) {
38
$pending_tfa_authmechs['yubi_otp'] = true;
39
}
40
if (!isset($pending_tfa_authmechs['webauthn'])
41
&& !isset($pending_tfa_authmechs['yubi_otp'])
42
&& isset($pending_tfa_authmechs['totp'])) {
43
$pending_tfa_authmechs['totp'] = true;
44
}
45
if (isset($pending_tfa_authmechs['u2f'])) {
46
$pending_tfa_authmechs['u2f'] = true;
47
}
48
}
50
// globals
51
$globalVariables = [
52
'mailcow_info' => array(
53
'version_tag' => $GLOBALS['MAILCOW_GIT_VERSION'],
54
'last_version_tag' => $GLOBALS['MAILCOW_LAST_GIT_VERSION'],
55
'git_owner' => $GLOBALS['MAILCOW_GIT_OWNER'],
56
'git_repo' => $GLOBALS['MAILCOW_GIT_REPO'],
57
'git_project_url' => $GLOBALS['MAILCOW_GIT_URL'],
58
'git_commit' => $GLOBALS['MAILCOW_GIT_COMMIT'],
59
'git_commit_date' => $GLOBALS['MAILCOW_GIT_COMMIT_DATE'],
60
'mailcow_branch' => $GLOBALS['MAILCOW_BRANCH'],
61
'updated_at' => $GLOBALS['MAILCOW_UPDATEDAT']
62
),
63
'js_path' => '/cache/'.basename($JSPath),
64
'pending_tfa_methods' => @$_SESSION['pending_tfa_methods'],
65
'pending_tfa_authmechs' => $pending_tfa_authmechs,
66
'pending_mailcow_cc_username' => @$_SESSION['pending_mailcow_cc_username'],
67
'pending_tfa_setup' => !empty($_SESSION['pending_tfa_setup']),
68
'pending_pw_update_modal' => !empty($_SESSION['pending_pw_update']),
69
'lang_footer' => json_encode($lang['footer']),
70
'lang_acl' => json_encode($lang['acl']),
71
'lang_tfa' => json_encode($lang['tfa']),
72
'lang_fido2' => json_encode($lang['fido2']),
73
'lang_success' => json_encode($lang['success']),
74
'lang_danger' => json_encode($lang['danger']),
75
'docker_timeout' => $DOCKER_TIMEOUT,
76
'session_lifetime' => (int)$SESSION_LIFETIME,
77
'csrf_token' => $_SESSION['CSRF']['TOKEN'],
78
'pagination_size' => $PAGINATION_SIZE,
79
'log_pagination_size' => $LOG_PAGINATION_SIZE,
80
'alerts' => $alerts,
81
'totp_secret' => $tfa->createSecret(),
82
];
84
foreach ($globalVariables as $globalVariableName => $globalVariableValue) {
85
$twig->addGlobal($globalVariableName, $globalVariableValue);
86
}
88
if (is_array($template_data)) {
89
echo $twig->render($template, $template_data);
90
}
92
if (isset($_SESSION['mailcow_cc_api'])) {
93
session_regenerate_id(true);
94
session_unset();
95
session_destroy();
96
session_write_close();
97
header("Location: /");
98
}
99
$stmt = null;
100
$pdo = null;