Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame^] | 1 | <!DOCTYPE html> |
| 2 | <html lang="<?= $_SESSION['mailcow_locale'] ?>"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> |
| 7 | <meta name="theme-color" content="#F5D76E"/> |
| 8 | <meta http-equiv="Referrer-Policy" content="same-origin"> |
| 9 | <title><?=$UI_TEXTS['title_name'];?></title> |
| 10 | <?php |
| 11 | if (preg_match("/mailbox/i", $_SERVER['REQUEST_URI'])) { |
| 12 | $css_minifier->add('/web/css/site/mailbox.css'); |
| 13 | } |
| 14 | if (preg_match("/admin/i", $_SERVER['REQUEST_URI'])) { |
| 15 | $css_minifier->add('/web/css/site/admin.css'); |
| 16 | } |
| 17 | if (preg_match("/user/i", $_SERVER['REQUEST_URI'])) { |
| 18 | $css_minifier->add('/web/css/site/user.css'); |
| 19 | } |
| 20 | if (preg_match("/edit/i", $_SERVER['REQUEST_URI'])) { |
| 21 | $css_minifier->add('/web/css/site/edit.css'); |
| 22 | } |
| 23 | if (preg_match("/(quarantine|qhandler)/i", $_SERVER['REQUEST_URI'])) { |
| 24 | $css_minifier->add('/web/css/site/quarantine.css'); |
| 25 | } |
| 26 | if (preg_match("/debug/i", $_SERVER['REQUEST_URI'])) { |
| 27 | $css_minifier->add('/web/css/site/debug.css'); |
| 28 | } |
| 29 | if ($_SERVER['REQUEST_URI'] == '/') { |
| 30 | $css_minifier->add('/web/css/site/index.css'); |
| 31 | } |
| 32 | |
| 33 | $hash = $css_minifier->getDataHash(); |
| 34 | $CSSPath = '/tmp/' . $hash . '.css'; |
| 35 | if(!file_exists($CSSPath)) { |
| 36 | $css_minifier->minify($CSSPath); |
| 37 | cleanupCSS($hash); |
| 38 | } |
| 39 | ?> |
| 40 | <link rel="stylesheet" href="/cache/<?=basename($CSSPath)?>"> |
| 41 | <?php if (strtolower(trim($DEFAULT_THEME)) != "lumen") { ?> |
| 42 | <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/<?= strtolower(trim($DEFAULT_THEME)); ?>/bootstrap.min.css"> |
| 43 | <?php } ?> |
| 44 | <link rel="shortcut icon" href="/favicon.png" type="image/png"> |
| 45 | <link rel="icon" href="/favicon.png" type="image/png"> |
| 46 | </head> |
| 47 | <body id="top"> |
| 48 | <div class="overlay"></div> |
| 49 | <nav class="navbar navbar-default navbar-fixed-top" role="navigation"> |
| 50 | <div class="container-fluid"> |
| 51 | <div class="navbar-header"> |
| 52 | <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> |
| 53 | <span class="icon-bar"></span> |
| 54 | <span class="icon-bar"></span> |
| 55 | <span class="icon-bar"></span> |
| 56 | </button> |
| 57 | <a class="navbar-brand" href="/"><img alt="mailcow-logo" src="<?=($main_logo = customize('get', 'main_logo')) ? $main_logo : '/img/cow_mailcow.svg';?>"></a> |
| 58 | </div> |
| 59 | <div id="navbar" class="navbar-collapse collapse"> |
| 60 | <ul class="nav navbar-nav navbar-right"> |
| 61 | <?php |
| 62 | if (isset($_SESSION['mailcow_locale'])) { |
| 63 | ?> |
| 64 | <li class="dropdown<?=(isset($_SESSION['mailcow_locale']) && count($AVAILABLE_LANGUAGES) === 1) ? ' lang-link-disabled"' : '' ?>"> |
| 65 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="lang-sm lang-lbl" lang="<?= $_SESSION['mailcow_locale']; ?>"></span><span class="caret"></span></a> |
| 66 | <ul class="dropdown-menu" role="menu"> |
| 67 | <?php |
| 68 | foreach ($AVAILABLE_LANGUAGES as $language) { |
| 69 | ?> |
| 70 | <li<?= ($_SESSION['mailcow_locale'] == $language) ? ' class="active"' : ''; ?>><a href="?<?= http_build_query(array_merge($_GET, array('lang' => $language))); ?>"><span class="lang-xs lang-lbl-full" lang="<?= $language; ?>"></span></a></li> |
| 71 | <?php |
| 72 | } |
| 73 | ?> |
| 74 | </ul> |
| 75 | </li> |
| 76 | <?php |
| 77 | } |
| 78 | if (isset($_SESSION['mailcow_cc_role'])) { |
| 79 | ?> |
| 80 | <li class="dropdown"> |
| 81 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?= $lang['header']['mailcow_settings']; ?> <span class="caret"></span></a> |
| 82 | <ul class="dropdown-menu" role="menu"> |
| 83 | <?php |
| 84 | if (isset($_SESSION['mailcow_cc_role'])) { |
| 85 | if ($_SESSION['mailcow_cc_role'] == 'admin') { |
| 86 | ?> |
| 87 | <li<?= (preg_match("/admin/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/admin"><?= $lang['header']['administration']; ?></a></li> |
| 88 | <li<?= (preg_match("/debug/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/debug"><?= $lang['header']['debug']; ?></a></li> |
| 89 | <?php |
| 90 | } |
| 91 | if ($_SESSION['mailcow_cc_role'] == 'admin' || $_SESSION['mailcow_cc_role'] == 'domainadmin') { |
| 92 | ?> |
| 93 | <li<?= (preg_match("/mailbox/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/mailbox"><?= $lang['header']['mailboxes']; ?></a></li> |
| 94 | <?php } if ($_SESSION['mailcow_cc_role'] != 'admin') { ?> |
| 95 | <li<?= (preg_match("/user/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/user"><?= $lang['header']['user_settings']; ?></a></li> |
| 96 | <?php |
| 97 | } |
| 98 | } |
| 99 | ?> |
| 100 | </ul> |
| 101 | </li> |
| 102 | <?php if (isset($_SESSION['mailcow_cc_role'])) { ?> |
| 103 | <li<?= (preg_match("/quarantine/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/quarantine"><span class="glyphicon glyphicon-briefcase"></span> <?= $lang['header']['quarantine']; ?></a></li> |
| 104 | <?php } if ($_SESSION['mailcow_cc_role'] == 'admin' && getenv('SKIP_SOGO') != "y") { ?> |
| 105 | <li><a href data-toggle="modal" data-container="sogo-mailcow" data-target="#RestartContainer"><span class="glyphicon glyphicon-refresh"></span> <?= $lang['header']['restart_sogo']; ?></a></li> |
| 106 | <?php } ?> |
| 107 | <li class="dropdown"> |
| 108 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-link"></span> <?= $lang['header']['apps']; ?> <span class="caret"></span></a> |
| 109 | <ul class="dropdown-menu" role="menu"> |
| 110 | <?php foreach ($MAILCOW_APPS as $app) { |
| 111 | if (getenv('SKIP_SOGO') == "y" && preg_match('/^\/SOGo/i', $app['link'])) { continue; } |
| 112 | ?> |
| 113 | <li title="<?= htmlspecialchars($app['description']); ?>"><a href="<?= htmlspecialchars($app['link']); ?>"><?= htmlspecialchars($app['name']); ?></a></li> |
| 114 | <?php |
| 115 | } |
| 116 | $app_links = customize('get', 'app_links'); |
| 117 | if ($app_links) { |
| 118 | foreach ($app_links as $row) { |
| 119 | foreach ($row as $key => $val) { |
| 120 | ?> |
| 121 | <li><a href="<?= htmlspecialchars($val); ?>"><?= htmlspecialchars($key); ?></a></li> |
| 122 | <?php |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | ?> |
| 127 | </ul> |
| 128 | </li> |
| 129 | <?php } if (!isset($_SESSION['dual-login']) && isset($_SESSION['mailcow_cc_username'])) { ?> |
| 130 | <li class="logged-in-as"><a href="#" onclick="logout.submit()"><b class="username-lia"><?= htmlspecialchars($_SESSION['mailcow_cc_username']); ?></b> <span class="glyphicon glyphicon-log-out"></span></a></li> |
| 131 | <?php } elseif (isset($_SESSION['dual-login'])) { ?> |
| 132 | <li class="logged-in-as"><a href="#" onclick="logout.submit()"><b class="username-lia"><?= htmlspecialchars($_SESSION['mailcow_cc_username']); ?> <span class="text-info">(<?= htmlspecialchars($_SESSION['dual-login']['username']); ?>)</span> </b><span class="glyphicon glyphicon-log-out"></span></a></li> |
| 133 | <?php } if (!preg_match('/y|yes/i', getenv('MASTER'))) { ?> |
| 134 | <li class="text-warning slave-info">[ slave ]</li> |
| 135 | <?php } ?> |
| 136 | </ul> |
| 137 | </div><!--/.nav-collapse --> |
| 138 | </div><!--/.container-fluid --> |
| 139 | </nav> |
| 140 | <form action="/" method="post" id="logout"><input type="hidden" name="logout"></form> |
| 141 | <?php if (!empty($UI_TEXTS['ui_announcement_text']) && |
| 142 | in_array($UI_TEXTS['ui_announcement_type'], array('info', 'warning', 'danger')) && |
| 143 | $UI_TEXTS['ui_announcement_active'] == 1 && |
| 144 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) != '/') { ?> |
| 145 | <div class="container"> |
| 146 | <div class="alert alert-<?=$UI_TEXTS['ui_announcement_type'];?>"><?=$UI_TEXTS['ui_announcement_text'];?></div> |
| 147 | </div> |
| 148 | <?php } ?> |