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"' : '' ?>"> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 65 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="flag-icon flag-icon-<?= $_SESSION['mailcow_locale']; ?>"></span><span class="caret"></span></a> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 66 | <ul class="dropdown-menu" role="menu"> |
| 67 | <?php |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 68 | foreach ($AVAILABLE_LANGUAGES as $c => $v) { |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 69 | ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 70 | <li<?= ($_SESSION['mailcow_locale'] == $c) ? ' class="active"' : ''; ?>><a href="?<?= http_build_query(array_merge($_GET, array('lang' => $c))); ?>"><span class="flag-icon flag-icon-<?=$c;?>"></span> <?=$v;?></a></li> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 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'])) { ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 103 | <li<?= (preg_match("/quarantine/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/quarantine"><i class="bi bi-inbox-fill"></i> <?= $lang['header']['quarantine']; ?></a></li> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 104 | <?php } if ($_SESSION['mailcow_cc_role'] == 'admin' && getenv('SKIP_SOGO') != "y") { ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 105 | <li><a href data-toggle="modal" data-container="sogo-mailcow" data-target="#RestartContainer"><i class="bi bi-arrow-repeat"></i> <?= $lang['header']['restart_sogo']; ?></a></li> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 106 | <?php } ?> |
| 107 | <li class="dropdown"> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 108 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="bi bi-link-45deg"></i> <?=$UI_TEXTS['apps_name'];?> <span class="caret"></span></a> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 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 | ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 113 | <li title="<?=(isset($app['description'])) ? htmlspecialchars($app['description']) : '';?>"><a href="<?=(isset($app['link'])) ? htmlspecialchars($app['link']) : '';?>"><?=(isset($app['name'])) ? htmlspecialchars($app['name']) : '';?></a></li> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 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'])) { ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 130 | <li class="logged-in-as"><a href="#" onclick="logout.submit()"><b class="username-lia"><?= htmlspecialchars($_SESSION['mailcow_cc_username']); ?></b> <i class="bi bi-power"></i></a></li> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 131 | <?php } elseif (isset($_SESSION['dual-login'])) { ?> |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 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><i class="bi bi-power"></i></a></li> |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 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 } ?> |