NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
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

Commit

Remember selected lang in cookie

# Conflicts: # data/web/inc/prerequisites.inc.php

b5793048
Kristian <[email protected]> 9 years ago
data/web/inc/prerequisites.inc.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Diff

diff --git a/data/web/inc/prerequisites.inc.php b/data/web/inc/prerequisites.inc.php
index c78b5aad..8aa20770 100644
--- a/data/web/inc/prerequisites.inc.php
+++ b/data/web/inc/prerequisites.inc.php
@@ -55,7 +55,7 @@ exit;
 require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/sessions.inc.php';
 
 // Set language
-if (!isset($_SESSION['mailcow_locale'])) {
+if (!isset($_SESSION['mailcow_locale']) && !isset($_COOKIE['mailcow_locale'])) {
   if ($DETECT_LANGUAGE && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
     $header_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
     foreach ($AVAILABLE_LANGUAGES as $available_lang) {
@@ -68,8 +68,12 @@ if (!isset($_SESSION['mailcow_locale'])) {
     $_SESSION['mailcow_locale'] = strtolower(trim($DEFAULT_LANG));
   }
 }
+if (isset($_COOKIE['mailcow_locale'])) {
+  $_SESSION['mailcow_locale'] = $_COOKIE['mailcow_locale'];
+}
 if (isset($_GET['lang']) && in_array($_GET['lang'], $AVAILABLE_LANGUAGES)) {
   $_SESSION['mailcow_locale'] = $_GET['lang'];
+  setcookie("mailcow_locale", $_GET['lang'], time()+30758400); // one year
 }
 
 require_once $_SERVER['DOCUMENT_ROOT'] . '/lang/lang.en.php';