Merge pull request #280 from Dennis14e/patch-2

Fix session bug, formatting, update bootstrap/bootswatch
master
André Peters 2017-05-16 20:11:25 +02:00 committed by GitHub
commit 73920fbbc0
7 changed files with 468 additions and 458 deletions

View File

@ -1,24 +1,28 @@
<?php <?php
require_once "inc/vars.inc.php"; require_once 'inc/vars.inc.php';
if (empty($mailcow_hostname)) { exit(); }
header("Content-Type: application/xml"); if (empty($mailcow_hostname)) {
exit();
}
header('Content-Type: application/xml');
?> ?>
<?='<?xml version="1.0"?>';?> <?= '<?xml version="1.0"?>'; ?>
<clientConfig version="1.1"> <clientConfig version="1.1">
<emailProvider id="<?=$mailcow_hostname;?>"> <emailProvider id="<?= $mailcow_hostname; ?>">
<domain>%EMAILDOMAIN%</domain> <domain>%EMAILDOMAIN%</domain>
<displayName>A mailcow mail server</displayName> <displayName>A mailcow mail server</displayName>
<displayShortName>mail server</displayShortName> <displayShortName>mail server</displayShortName>
<incomingServer type="imap"> <incomingServer type="imap">
<hostname><?=$mailcow_hostname;?></hostname> <hostname><?= $mailcow_hostname; ?></hostname>
<port>993</port> <port>993</port>
<socketType>SSL</socketType> <socketType>SSL</socketType>
<username>%EMAILADDRESS%</username> <username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication> <authentication>password-cleartext</authentication>
</incomingServer> </incomingServer>
<incomingServer type="imap"> <incomingServer type="imap">
<hostname><?=$mailcow_hostname;?></hostname> <hostname><?= $mailcow_hostname; ?></hostname>
<port>143</port> <port>143</port>
<socketType>STARTTLS</socketType> <socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username> <username>%EMAILADDRESS%</username>
@ -26,14 +30,14 @@ header("Content-Type: application/xml");
</incomingServer> </incomingServer>
<incomingServer type="pop3"> <incomingServer type="pop3">
<hostname><?=$mailcow_hostname;?></hostname> <hostname><?= $mailcow_hostname; ?></hostname>
<port>995</port> <port>995</port>
<socketType>SSL</socketType> <socketType>SSL</socketType>
<username>%EMAILADDRESS%</username> <username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication> <authentication>password-cleartext</authentication>
</incomingServer> </incomingServer>
<incomingServer type="pop3"> <incomingServer type="pop3">
<hostname><?=$mailcow_hostname;?></hostname> <hostname><?= $mailcow_hostname; ?></hostname>
<port>110</port> <port>110</port>
<socketType>STARTTLS</socketType> <socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username> <username>%EMAILADDRESS%</username>
@ -41,7 +45,7 @@ header("Content-Type: application/xml");
</incomingServer> </incomingServer>
<outgoingServer type="smtp"> <outgoingServer type="smtp">
<hostname><?=$mailcow_hostname;?></hostname> <hostname><?= $mailcow_hostname; ?></hostname>
<port>465</port> <port>465</port>
<socketType>SSL</socketType> <socketType>SSL</socketType>
<username>%EMAILADDRESS%</username> <username>%EMAILADDRESS%</username>
@ -49,14 +53,14 @@ header("Content-Type: application/xml");
</outgoingServer> </outgoingServer>
<outgoingServer type="smtp"> <outgoingServer type="smtp">
<hostname><?=$mailcow_hostname;?></hostname> <hostname><?= $mailcow_hostname; ?></hostname>
<port>587</port> <port>587</port>
<socketType>STARTTLS</socketType> <socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username> <username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication> <authentication>password-cleartext</authentication>
</outgoingServer> </outgoingServer>
<enable visiturl="https://<?=$mailcow_hostname;?>/admin.php"> <enable visiturl="https://<?= $mailcow_hostname; ?>/admin.php">
<instruction>If you didn't change the password given to you by the administrator or if you didn't change it in a long time, please consider doing that now.</instruction> <instruction>If you didn't change the password given to you by the administrator or if you didn't change it in a long time, please consider doing that now.</instruction>
<instruction lang="de">Sollten Sie das Ihnen durch den Administrator vergebene Passwort noch nicht geändert haben, empfehlen wir dies nun zu tun. Auch ein altes Passwort sollte aus Sicherheitsgründen geändert werden.</instruction> <instruction lang="de">Sollten Sie das Ihnen durch den Administrator vergebene Passwort noch nicht geändert haben, empfehlen wir dies nun zu tun. Auch ein altes Passwort sollte aus Sicherheitsgründen geändert werden.</instruction>
</enable> </enable>
@ -64,6 +68,6 @@ header("Content-Type: application/xml");
</emailProvider> </emailProvider>
<webMail> <webMail>
<loginPage url="https://<?=$mailcow_hostname;?>/SOGo/" /> <loginPage url="https://<?= $mailcow_hostname; ?>/SOGo/" />
</webMail> </webMail>
</clientConfig> </clientConfig>

View File

@ -1,19 +1,20 @@
<?php <?php
include("inc/tfa_modals.php"); include 'inc/tfa_modals.php';
if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admin"):
if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin'):
?> ?>
<div id="RestartSOGo" class="modal fade" role="dialog"> <div id="RestartSOGo" class="modal fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"><?=$lang['footer']['restart_sogo'];?></h4> <h4 class="modal-title"><?= $lang['footer']['restart_sogo']; ?></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p><?=$lang['footer']['restart_sogo_info'];?></p> <p><?= $lang['footer']['restart_sogo_info']; ?></p>
<hr /> <hr>
<button class="btn btn-md btn-primary" id="triggerRestartSogo"><?=$lang['footer']['restart_now'];?></button> <button class="btn btn-md btn-primary" id="triggerRestartSogo"><?= $lang['footer']['restart_now']; ?></button>
<br /><br /> <br><br>
<div id="statusTriggerRestartSogo"></div> <div id="statusTriggerRestartSogo"></div>
</div> </div>
</div> </div>
@ -27,20 +28,21 @@ endif;
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"><?=$lang['footer']['confirm_delete'];?></h4> <h4 class="modal-title"><?= $lang['footer']['confirm_delete']; ?></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p><?=$lang['footer']['delete_these_items'];?></p> <p><?= $lang['footer']['delete_these_items']; ?></p>
<ul id="ItemsToDelete"></ul> <ul id="ItemsToDelete"></ul>
<hr /> <hr>
<button class="btn btn-sm btn-danger" id="IsConfirmed"><?=$lang['footer']['delete_now'];?></button> <button class="btn btn-sm btn-danger" id="IsConfirmed"><?= $lang['footer']['delete_now']; ?></button>
<button class="btn btn-sm btn-default" id="isCanceled"><?=$lang['footer']['cancel'];?></button> <button class="btn btn-sm btn-default" id="isCanceled"><?= $lang['footer']['cancel']; ?></button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div style="margin-bottom:100px"></div> <div style="margin-bottom: 100px;"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<script src="/js/bootstrap-switch.min.js"></script> <script src="/js/bootstrap-switch.min.js"></script>
<script src="/js/bootstrap-slider.min.js"></script> <script src="/js/bootstrap-slider.min.js"></script>
<script src="/js/bootstrap-select.min.js"></script> <script src="/js/bootstrap-select.min.js"></script>
@ -49,7 +51,7 @@ endif;
<script> <script>
// Select language and reopen active URL without POST // Select language and reopen active URL without POST
function setLang(sel) { function setLang(sel) {
$.post( "<?=$_SERVER['REQUEST_URI'];?>", {lang: sel} ); $.post( "<?= $_SERVER['REQUEST_URI']; ?>", {lang: sel} );
window.location.href = window.location.pathname + window.location.search; window.location.href = window.location.pathname + window.location.search;
} }
@ -58,7 +60,7 @@ $(document).ready(function() {
$.notify({message: message},{type: type,placement: {from: "bottom",align: "right"},animate: {enter: 'animated fadeInUp',exit: 'animated fadeOutDown'}}); $.notify({message: message},{type: type,placement: {from: "bottom",align: "right"},animate: {enter: 'animated fadeInUp',exit: 'animated fadeOutDown'}});
} }
<?php if (isset($_SESSION['return'])): ?> <?php if (isset($_SESSION['return'])): ?>
mailcow_alert_box("<?=$_SESSION['return']['msg'];?>", "<?=$_SESSION['return']['type'];?>"); mailcow_alert_box("<?= $_SESSION['return']['msg']; ?>", "<?= $_SESSION['return']['type']; ?>");
<?php endif; unset($_SESSION['return']); ?> <?php endif; unset($_SESSION['return']); ?>
// Confirm TFA modal // Confirm TFA modal
<?php if (isset($_SESSION['pending_tfa_method'])):?> <?php if (isset($_SESSION['pending_tfa_method'])):?>
@ -74,7 +76,7 @@ $(document).ready(function() {
type: "GET", type: "GET",
cache: false, cache: false,
dataType: 'script', dataType: 'script',
url: "/api/v1/get/u2f-authentication/<?=(isset($_SESSION['pending_mailcow_cc_username'])) ? $_SESSION['pending_mailcow_cc_username'] : null;?>", url: "/api/v1/get/u2f-authentication/<?= (isset($_SESSION['pending_mailcow_cc_username'])) ? $_SESSION['pending_mailcow_cc_username'] : null; ?>",
success: function(data){ success: function(data){
data; data;
} }
@ -111,7 +113,7 @@ $(document).ready(function() {
type: "GET", type: "GET",
cache: false, cache: false,
dataType: 'script', dataType: 'script',
url: "/api/v1/get/u2f-registration/<?=(isset($_SESSION['mailcow_cc_username'])) ? $_SESSION['mailcow_cc_username'] : null;?>", url: "/api/v1/get/u2f-registration/<?= (isset($_SESSION['mailcow_cc_username'])) ? $_SESSION['mailcow_cc_username'] : null; ?>",
success: function(data){ success: function(data){
data; data;
} }
@ -180,7 +182,7 @@ $(document).ready(function() {
if ($('form button[type="submit"]').data('submitted') == '1') { if ($('form button[type="submit"]').data('submitted') == '1') {
return false; return false;
} else { } else {
$(this).find('button[type="submit"]').first().text('<?=$lang['footer']['loading'];?>'); $(this).find('button[type="submit"]').first().text('<?= $lang['footer']['loading']; ?>');
$('form button[type="submit"]').attr('data-submitted', '1'); $('form button[type="submit"]').attr('data-submitted', '1');
function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which || e.keyCode) == 82) e.preventDefault(); }; function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which || e.keyCode) == 82) e.preventDefault(); };
$(document).on("keydown", disableF5); $(document).on("keydown", disableF5);
@ -209,7 +211,7 @@ $(document).ready(function() {
}, },
success: function(data) { success: function(data) {
$('#statusTriggerRestartSogo').append(data); $('#statusTriggerRestartSogo').append(data);
$('#statusTriggerRestartSogo').append('<br />Starting SOGo... '); $('#statusTriggerRestartSogo').append('<br>Starting SOGo...');
$.ajax({ $.ajax({
method: 'get', method: 'get',
url: 'call_sogo_ctrl.php', url: 'call_sogo_ctrl.php',
@ -225,10 +227,14 @@ $(document).ready(function() {
} }
}); });
}); });
$("<input type='hidden' value='<?=$_SESSION['CSRF']['TOKEN'];?>' />").attr("id", "csrf_token").attr("name", "csrf_token").appendTo("form");
// CSRF
$('<input type="hidden" value="<?= $_SESSION['CSRF']['TOKEN']; ?>">').attr('id', 'csrf_token').attr('name', 'csrf_token').appendTo('form');
}); });
</script> </script>
</body> </body>
</html> </html>
<?php $stmt = null; $pdo = null; ?> <?php
$stmt = null;
$pdo = null;

View File

@ -6,12 +6,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>mailcow UI</title> <title>mailcow UI</title>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js" integrity="sha256-3Jy/GbSLrg0o9y5Z5n1uw0qxZECH7C6OQpVBgNFYa0g=" crossorigin="anonymous"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js" integrity="sha256-g6iAfvZp+nDQ2TdTR/VVKJf3bGro4ub5fvWSWVRi2NE=" crossorigin="anonymous"></script>
<![endif]--> <![endif]-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js" integrity="sha384-XxcvoeNF5V0ZfksTnV+bejnCsJjOOIzN6UVwF85WBsAnU3zeYh5bloN+L4WLgeNE" crossorigin="anonymous"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/<?=strtolower(trim($DEFAULT_THEME));?>/bootstrap.min.css"> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/<?= strtolower(trim($DEFAULT_THEME)); ?>/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-select.min.css"> <link rel="stylesheet" href="/css/bootstrap-select.min.css">
<link rel="stylesheet" href="/css/bootstrap-slider.min.css"> <link rel="stylesheet" href="/css/bootstrap-slider.min.css">
<link rel="stylesheet" href="/css/bootstrap-switch.min.css"> <link rel="stylesheet" href="/css/bootstrap-switch.min.css">
@ -19,12 +19,12 @@
<link rel="stylesheet" href="/inc/languages.min.css"> <link rel="stylesheet" href="/inc/languages.min.css">
<link rel="stylesheet" href="/css/mailcow.css"> <link rel="stylesheet" href="/css/mailcow.css">
<link rel="stylesheet" href="/css/animate.min.css"> <link rel="stylesheet" href="/css/animate.min.css">
<?=(preg_match("/mailbox.php/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/mailbox.css">' : null;?> <?= (preg_match("/mailbox.php/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/mailbox.css">' : null; ?>
<?=(preg_match("/admin.php/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/admin.css">' : null;?> <?= (preg_match("/admin.php/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/admin.css">' : null; ?>
<link rel="shortcut icon" href="/favicon.png" type="image/png"> <link rel="shortcut icon" href="/favicon.png" type="image/png">
<link rel="icon" href="/favicon.png" type="image/png"> <link rel="icon" href="/favicon.png" type="image/png">
</head> </head>
<body style="padding-top:70px"> <body style="padding-top: 70px;">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">
@ -34,7 +34,7 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand" href="/"><img height="32" alt="mailcow-logo" style="margin-top:-5px;" src="/img/cow_mailcow.svg" /></a> <a class="navbar-brand" href="/"><img height="32" alt="mailcow-logo" style="margin-top: -5px;" src="/img/cow_mailcow.svg"></a>
</div> </div>
<div id="navbar" class="navbar-collapse collapse"> <div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
@ -42,14 +42,15 @@
if (isset($_SESSION['mailcow_locale'])) { if (isset($_SESSION['mailcow_locale'])) {
?> ?>
<li class="dropdown"> <li class="dropdown">
<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> <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>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li <?=($_SESSION['mailcow_locale'] == 'de') ? 'class="active"' : ''?>> <a href="?<?= http_build_query(array_merge($_GET, array("lang" => "de"))) ?>"><span class="lang-xs lang-lbl-full" lang="de"></span></a></li> <?php
<li <?=($_SESSION['mailcow_locale'] == 'en') ? 'class="active"' : ''?>> <a href="?<?= http_build_query(array_merge($_GET, array("lang" => "en"))) ?>"><span class="lang-xs lang-lbl-full" lang="en"></span></a></li> foreach ($AVAILABLE_LANGUAGES as $language) {
<li <?=($_SESSION['mailcow_locale'] == 'es') ? 'class="active"' : ''?>> <a href="?<?= http_build_query(array_merge($_GET, array("lang" => "es"))) ?>"><span class="lang-xs lang-lbl-full" lang="es"></span></a></li> ?>
<li <?=($_SESSION['mailcow_locale'] == 'nl') ? 'class="active"' : ''?>> <a href="?<?= http_build_query(array_merge($_GET, array("lang" => "nl"))) ?>"><span class="lang-xs lang-lbl-full" lang="nl"></span></a></li> <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>
<li <?=($_SESSION['mailcow_locale'] == 'pt') ? 'class="active"' : ''?>> <a href="?<?= http_build_query(array_merge($_GET, array("lang" => "pt"))) ?>"><span class="lang-xs lang-lbl-full" lang="pt"></span></a></li> <?php
<li <?=($_SESSION['mailcow_locale'] == 'ru') ? 'class="active"' : ''?>> <a href="?<?= http_build_query(array_merge($_GET, array("lang" => "ru"))) ?>"><span class="lang-xs lang-lbl-full" lang="ru"></span></a></li> }
?>
</ul> </ul>
</li> </li>
<?php <?php
@ -57,23 +58,23 @@
if (isset($_SESSION['mailcow_cc_role'])) { if (isset($_SESSION['mailcow_cc_role'])) {
?> ?>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <?=$lang['header']['mailcow_settings'];?> <span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?= $lang['header']['mailcow_settings']; ?> <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<?php <?php
if (isset($_SESSION['mailcow_cc_role'])) { if (isset($_SESSION['mailcow_cc_role'])) {
if ($_SESSION['mailcow_cc_role'] == "admin") { if ($_SESSION['mailcow_cc_role'] == 'admin') {
?> ?>
<li <?=(preg_match("/admin/i", $_SERVER['REQUEST_URI'])) ? 'class="active"' : ''?>><a href="/admin.php"><?=$lang['header']['administration'];?></a></li> <li<?= (preg_match("/admin/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/admin.php"><?= $lang['header']['administration']; ?></a></li>
<?php <?php
} }
if ($_SESSION['mailcow_cc_role'] == "admin" || $_SESSION['mailcow_cc_role'] == "domainadmin") { if ($_SESSION['mailcow_cc_role'] == 'admin' || $_SESSION['mailcow_cc_role'] == 'domainadmin') {
?> ?>
<li <?=(preg_match("/mailbox/i", $_SERVER['REQUEST_URI'])) ? 'class="active"' : ''?>><a href="/mailbox.php"><?=$lang['header']['mailboxes'];?></a></li> <li<?= (preg_match("/mailbox/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/mailbox.php"><?= $lang['header']['mailboxes']; ?></a></li>
<?php <?php
} }
if ($_SESSION['mailcow_cc_role'] != "admin") { if ($_SESSION['mailcow_cc_role'] != 'admin') {
?> ?>
<li <?=(preg_match("/user/i", $_SERVER['REQUEST_URI'])) ? 'class="active"' : ''?>><a href="/user.php"><?=$lang['header']['user_settings'];?></a></li> <li<?= (preg_match("/user/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/user.php"><?= $lang['header']['user_settings']; ?></a></li>
<?php <?php
} }
} }
@ -81,11 +82,11 @@
</ul> </ul>
</li> </li>
<?php <?php
if ($_SESSION['mailcow_cc_role'] == "admin"): if ($_SESSION['mailcow_cc_role'] == 'admin') {
?> ?>
<li><a href data-toggle="modal" data-target="#RestartSOGo"><span style="font-size:12px" class="glyphicon glyphicon-refresh" aria-hidden="true"></span> <?=$lang['header']['restart_sogo'];?></a></li> <li><a href data-toggle="modal" data-target="#RestartSOGo"><span style="font-size: 12px;" class="glyphicon glyphicon-refresh" aria-hidden="true"></span> <?= $lang['header']['restart_sogo']; ?></a></li>
<?php <?php
endif; }
?> ?>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-link" aria-hidden="true"></span> Apps <span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-link" aria-hidden="true"></span> Apps <span class="caret"></span></a>
@ -93,7 +94,7 @@
<?php <?php
foreach ($MAILCOW_APPS as $app): foreach ($MAILCOW_APPS as $app):
?> ?>
<li><a href="<?=$app['link'];?>"><?=$app['name'];?></a></li> <li><a href="<?= $app['link']; ?>"><?= $app['name']; ?></a></li>
<?php <?php
endforeach; endforeach;
?> ?>
@ -101,13 +102,13 @@
</li> </li>
<?php <?php
} }
if (!isset($_SESSION["dual-login"]) && isset($_SESSION['mailcow_cc_username'])): if (!isset($_SESSION['dual-login']) && isset($_SESSION['mailcow_cc_username'])):
?> ?>
<li><a style="border-left:1px solid #E7E7E7" href="#" onclick="logout.submit()"><?=sprintf($lang['header']['logged_in_as_logout'], $_SESSION['mailcow_cc_username']);?></a></li> <li><a href="#" style="border-left: 1px solid #E7E7E7;" onclick="logout.submit()"><?= sprintf($lang['header']['logged_in_as_logout'], $_SESSION['mailcow_cc_username']); ?></a></li>
<?php <?php
elseif (isset($_SESSION["dual-login"])): elseif (isset($_SESSION['dual-login'])):
?> ?>
<li><a style="border-left:1px solid #E7E7E7" href="#" onclick="logout.submit()"><?=sprintf($lang['header']['logged_in_as_logout_dual'], $_SESSION['mailcow_cc_username'], $_SESSION["dual-login"]["username"]);?></a></li> <li><a href="#" style="border-left: 1px solid #E7E7E7;" onclick="logout.submit()"><?= sprintf($lang['header']['logged_in_as_logout_dual'], $_SESSION['mailcow_cc_username'], $_SESSION['dual-login']['username']); ?></a></li>
<?php <?php
endif; endif;
?> ?>

View File

@ -13,7 +13,7 @@ elseif (isset($_SERVER['HTTPS'])) {
else { else {
$IS_HTTPS = false; $IS_HTTPS = false;
} }
session_set_cookie_params($GLOBALS['SESSION_LIFETIME'], '/', $_SERVER['SERVER_NAME'], $IS_HTTPS, true); session_set_cookie_params($GLOBALS['SESSION_LIFETIME'], '/', '', $IS_HTTPS, true);
session_start(); session_start();
if (!isset($_SESSION['CSRF']['TOKEN'])) { if (!isset($_SESSION['CSRF']['TOKEN'])) {
$_SESSION['CSRF']['TOKEN'] = bin2hex(random_bytes(32)); $_SESSION['CSRF']['TOKEN'] = bin2hex(random_bytes(32));

View File

@ -9,8 +9,8 @@ This file will be reset on upgrades.
*/ */
// SQL database connection variables // SQL database connection variables
$database_type = "mysql"; $database_type = 'mysql';
$database_host = "mysql"; $database_host = 'mysql';
$database_user = getenv('DBUSER'); $database_user = getenv('DBUSER');
$database_pass = getenv('DBPASS'); $database_pass = getenv('DBPASS');
$database_name = getenv('DBNAME'); $database_name = getenv('DBNAME');
@ -21,23 +21,23 @@ $mailcow_hostname = getenv('MAILCOW_HOSTNAME');
// Where to go after adding and editing objects // Where to go after adding and editing objects
// Can be "form" or "previous" // Can be "form" or "previous"
// "form" will stay in the current form, "previous" will redirect to previous page // "form" will stay in the current form, "previous" will redirect to previous page
$FORM_ACTION = "previous"; $FORM_ACTION = 'previous';
// File locations should not be changed // File locations should not be changed
$MC_DKIM_TXTS = "/data/dkim/txt"; $MC_DKIM_TXTS = '/data/dkim/txt';
$MC_DKIM_KEYS = "/data/dkim/keys"; $MC_DKIM_KEYS = '/data/dkim/keys';
// Change default language, "de", "en", "es", "nl", "pt", "ru" // Change default language, "de", "en", "es", "nl", "pt", "ru"
$DEFAULT_LANG = "en"; $DEFAULT_LANG = 'en';
// Available languages // Available languages
$AVAILABLE_LANGUAGES = array("de", "en", "es", "nl", "pt", "ru"); $AVAILABLE_LANGUAGES = array('de', 'en', 'es', 'nl', 'pt', 'ru');
// Change theme (default: lumen) // Change theme (default: lumen)
// Needs to be one of those: cerulean, cosmo, cyborg, darkly, flatly, journal, lumen, paper, readable, sandstone, // Needs to be one of those: cerulean, cosmo, cyborg, darkly, flatly, journal, lumen, paper, readable, sandstone,
// simplex, slate, spacelab, superhero, united, yeti // simplex, slate, spacelab, superhero, united, yeti
// See https://bootswatch.com/ // See https://bootswatch.com/
$DEFAULT_THEME = "lumen"; $DEFAULT_THEME = 'lumen';
// Password complexity as regular expression // Password complexity as regular expression
$PASSWD_REGEP = '.{4,}'; $PASSWD_REGEP = '.{4,}';
@ -59,5 +59,3 @@ $PAGINATION_SIZE = 10;
// Session lifetime in seconds // Session lifetime in seconds
$SESSION_LIFETIME = 3600; $SESSION_LIFETIME = 3600;
?>

View File

@ -1,65 +1,67 @@
<?php <?php
require_once("inc/prerequisites.inc.php"); require_once 'inc/prerequisites.inc.php';
if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admin") { if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin') {
header('Location: /admin.php'); header('Location: /admin.php');
exit(); exit();
} }
elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "domainadmin") { elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'domainadmin') {
header('Location: /mailbox.php'); header('Location: /mailbox.php');
exit(); exit();
} }
elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "user") { elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'user') {
header('Location: /user.php'); header('Location: /user.php');
exit(); exit();
} }
require_once("inc/header.inc.php");
require_once 'inc/header.inc.php';
$_SESSION['return_to'] = $_SERVER['REQUEST_URI']; $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
?> ?>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-offset-3 col-md-6"> <div class="col-md-offset-3 col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?=$lang['login']['login'];?></div> <div class="panel-heading"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?= $lang['login']['login']; ?></div>
<div class="panel-body"> <div class="panel-body">
<center><img style="max-width:250px" src="/img/cow_mailcow.svg" alt="mailcow"></center> <div class="text-center"><img style="max-width: 250px;" src="/img/cow_mailcow.svg" alt="mailcow"></div>
<legend>mailcow UI</legend> <legend>mailcow UI</legend>
<form method="post" autofill="off"> <form method="post" autofill="off">
<div class="form-group"> <div class="form-group">
<label class="sr-only" for="login_user"><?=$lang['login']['username'];?></label> <label class="sr-only" for="login_user"><?= $lang['login']['username']; ?></label>
<div class="input-group"> <div class="input-group">
<div class="input-group-addon"><i class="glyphicon glyphicon-user"></i></div> <div class="input-group-addon"><i class="glyphicon glyphicon-user"></i></div>
<input name="login_user" autocorrect="off" autocapitalize="none" type="text" id="login_user" class="form-control" placeholder="<?=$lang['login']['username'];?>" required="" autofocus=""> <input name="login_user" autocorrect="off" autocapitalize="none" type="text" id="login_user" class="form-control" placeholder="<?= $lang['login']['username']; ?>" required="" autofocus="">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="sr-only" for="pass_user"><?=$lang['login']['password'];?></label> <label class="sr-only" for="pass_user"><?= $lang['login']['password']; ?></label>
<div class="input-group"> <div class="input-group">
<div class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></div> <div class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></div>
<input name="pass_user" type="password" id="pass_user" class="form-control" placeholder="<?=$lang['login']['password'];?>" required=""> <input name="pass_user" type="password" id="pass_user" class="form-control" placeholder="<?= $lang['login']['password']; ?>" required="">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<button type="submit" class="btn btn-success" value="Login"><?=$lang['login']['login'];?></button> <button type="submit" class="btn btn-success" value="Login"><?= $lang['login']['login']; ?></button>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="lang-sm lang-lbl" lang="<?=$_SESSION['mailcow_locale'];?>"></span> <span class="caret"></span> <span class="lang-sm lang-lbl" lang="<?= $_SESSION['mailcow_locale']; ?>"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li <?=($_SESSION['mailcow_locale'] == 'de') ? 'class="active"' : ''?>><a href="?<?= http_build_query(array_merge($_GET, array("lang" => "de"))) ?>"><span class="lang-xs lang-lbl-full" lang="de"></span></a></li> <?php
<li <?=($_SESSION['mailcow_locale'] == 'en') ? 'class="active"' : ''?>><a href="?<?= http_build_query(array_merge($_GET, array("lang" => "en"))) ?>"><span class="lang-xs lang-lbl-full" lang="en"></span></a></li> foreach ($AVAILABLE_LANGUAGES as $language):
<li <?=($_SESSION['mailcow_locale'] == 'es') ? 'class="active"' : ''?>><a href="?<?= http_build_query(array_merge($_GET, array("lang" => "es"))) ?>"><span class="lang-xs lang-lbl-full" lang="es"></span></a></li> ?>
<li <?=($_SESSION['mailcow_locale'] == 'nl') ? 'class="active"' : ''?>><a href="?<?= http_build_query(array_merge($_GET, array("lang" => "nl"))) ?>"><span class="lang-xs lang-lbl-full" lang="nl"></span></a></li> <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>
<li <?=($_SESSION['mailcow_locale'] == 'pt') ? 'class="active"' : ''?>><a href="?<?= http_build_query(array_merge($_GET, array("lang" => "pt"))) ?>"><span class="lang-xs lang-lbl-full" lang="pt"></span></a></li> <?php
<li <?=($_SESSION['mailcow_locale'] == 'ru') ? 'class="active"' : ''?>><a href="?<?= http_build_query(array_merge($_GET, array("lang" => "ru"))) ?>"><span class="lang-xs lang-lbl-full" lang="ru"></span></a></li> endforeach;
?>
</ul> </ul>
</div> </div>
</div> </div>
</form> </form>
<?php <?php
if (isset($_SESSION['ldelay']) && $_SESSION['ldelay'] != "0"): if (isset($_SESSION['ldelay']) && $_SESSION['ldelay'] != '0'):
?> ?>
<p><div class="alert alert-info"><?=sprintf($lang['login']['delayed'], $_SESSION['ldelay']);?></b></div></p> <p><div class="alert alert-info"><?= sprintf($lang['login']['delayed'], $_SESSION['ldelay']); ?></b></div></p>
<?php <?php
endif; endif;
?> ?>
@ -67,7 +69,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
<?php <?php
foreach ($MAILCOW_APPS as $app): foreach ($MAILCOW_APPS as $app):
?> ?>
<a href="<?=$app['link'];?>" role="button" class="btn btn-lg btn-default"><?=$app['name'];?></a>&nbsp; <a href="<?= $app['link']; ?>" role="button" class="btn btn-lg btn-default"><?= $app['name']; ?></a>&nbsp;
<?php <?php
endforeach; endforeach;
?> ?>
@ -75,23 +77,22 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
</div> </div>
</div> </div>
<div class="col-md-offset-3 col-md-6"> <div class="col-md-offset-3 col-md-6">
<div class="panel panel-default" style=""> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<a data-toggle="collapse" href="#collapse1"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?=$lang['start']['help'];?></a> <a data-toggle="collapse" href="#collapse1"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?= $lang['start']['help']; ?></a>
</div> </div>
<div id="collapse1" class="panel-collapse collapse"> <div id="collapse1" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
<p><span style="border-bottom: 1px dotted #999">mailcow UI</span></p> <p><span style="border-bottom: 1px dotted #999;">mailcow UI</span></p>
<p><?=$lang['start']['mailcow_panel_detail'];?></p> <p><?= $lang['start']['mailcow_panel_detail']; ?></p>
<p><span style="border-bottom: 1px dotted #999">mailcow Apps</span></p> <p><span style="border-bottom: 1px dotted #999;">mailcow Apps</span></p>
<p><?=$lang['start']['mailcow_apps_detail'];?></p> <p><?= $lang['start']['mailcow_apps_detail']; ?></p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> <!-- /container --> </div><!-- /.container -->
<script src="js/index.js"></script> <script src="js/index.js"></script>
<?php <?php
require_once("inc/footer.inc.php"); require_once 'inc/footer.inc.php';
?>