diff --git a/webmail/action.php b/webmail/action.php
index 952a2db..45d95bb 100644
--- a/webmail/action.php
+++ b/webmail/action.php
@@ -13,7 +13,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
- * @version SVN: $Id: action.php 2974 2021-12-14 13:19:30Z oheil $
+ * @version SVN: $Id: action.php 3016 2022-08-25 11:00:42Z oheil $
*/
require_once './common.php';
@@ -506,9 +506,15 @@ switch($action) {
if (isset($_REQUEST['lang']))
$user_prefs->lang = $_REQUEST['lang'];
- if (isset($_REQUEST['theme'])) {
+
+ if( isset($_REQUEST['theme']) ) {
$user_prefs->theme = $_REQUEST['theme'];
- $_SESSION['nocc_theme'] = $_REQUEST['theme'];
+ if( $_REQUEST['theme']=="default" ) {
+ $_SESSION['nocc_theme'] = $conf->default_theme;
+ }
+ else {
+ $_SESSION['nocc_theme'] = $_REQUEST['theme'];
+ }
}
if ($conf->prefs_dir) {
diff --git a/webmail/classes/nocc_languages.php b/webmail/classes/nocc_languages.php
index 7c00a60..c794b80 100644
--- a/webmail/classes/nocc_languages.php
+++ b/webmail/classes/nocc_languages.php
@@ -10,7 +10,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
- * @version SVN: $Id: nocc_languages.php 2373 2011-01-04 15:06:58Z gerundt $
+ * @version SVN: $Id: nocc_languages.php 3016 2022-08-25 11:00:42Z oheil $
*/
/**
@@ -56,6 +56,7 @@ class NOCC_Languages {
$path .= '/';
}
+ $this->_languages["default"]=convertLang2Html($html_default);
//TODO: Move some code to a NOCC_Directory class?
if ($handle = opendir($path)) { //if can open the directory...
while (false !== ($name = readdir($handle))) { //for each item...
diff --git a/webmail/classes/nocc_themes.php b/webmail/classes/nocc_themes.php
index cf79cc6..fb7dc48 100644
--- a/webmail/classes/nocc_themes.php
+++ b/webmail/classes/nocc_themes.php
@@ -10,7 +10,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
- * @version SVN: $Id: nocc_themes.php 2580 2013-08-19 21:57:33Z gerundt $
+ * @version SVN: $Id: nocc_themes.php 3016 2022-08-25 11:00:42Z oheil $
*/
/**
@@ -47,7 +47,7 @@ class NOCC_Themes {
*/
public function __construct($path, $defaultThemeName = '') {
$this->_themes = array();
- $this->_defaultThemeName = 'standard';
+ $this->_defaultThemeName = 'default';
$this->_selectedThemeName = '';
if (isset($path) && is_string($path) && !empty($path)) { //if path is set...
@@ -149,4 +149,4 @@ class NOCC_Themes {
}
return false;
}
-}
\ No newline at end of file
+}
diff --git a/webmail/common.php b/webmail/common.php
index 7720f6c..49df406 100644
--- a/webmail/common.php
+++ b/webmail/common.php
@@ -11,7 +11,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
- * @version SVN: $Id: common.php 2981 2021-12-22 08:53:00Z oheil $
+ * @version SVN: $Id: common.php 3016 2022-08-25 11:00:42Z oheil $
*/
define('NOCC_DEBUG_LEVEL', 0);
@@ -132,19 +132,29 @@ $languages = new NOCC_Languages('./lang/', $conf->default_lang);
//TODO: Check $_REQUEST['lang'] also when force_default_lang?
if (isset($_REQUEST['lang'])) { //if a language is requested...
- if ($languages->setSelectedLangId($_REQUEST['lang'])) { //if the language exists...
+ if( $languages->setSelectedLangId($_REQUEST['lang']) || $_REQUEST['lang']=="default" ) { //if the language exists...
$_SESSION['nocc_lang'] = $languages->getSelectedLangId();
}
}
-if (isset($_SESSION['nocc_lang'])) { //if session language already set...
+if( isset($_SESSION['nocc_lang']) && $_SESSION['nocc_lang']!="default" ) { //if session language already set...
$languages->setSelectedLangId($_SESSION['nocc_lang']);
}
else { //if session language NOT already set...
if (!isset($conf->force_default_lang) || !$conf->force_default_lang) { //if NOT force default language...
$languages->detectFromBrowser();
}
- $_SESSION['nocc_lang'] = $languages->getSelectedLangId();
+ else {
+ if( isset($conf->default_lang) ) {
+ $languages->setSelectedLangId($conf->default_lang);
+ }
+ else {
+ $languages->setSelectedLangId('en');
+ }
+ }
+ if( $_SESSION['nocc_lang']!="default" ) {
+ $_SESSION['nocc_lang'] = $languages->getSelectedLangId();
+ }
}
$lang = $languages->getSelectedLangId();
@@ -161,17 +171,20 @@ if ($lang != 'en') { //if NOT English...
//--------------------------------------------------------------------------------
// Set the theme...
//--------------------------------------------------------------------------------
+
$themes = new NOCC_Themes('./themes/', $conf->default_theme);
//TODO: Check $_REQUEST['theme'] also when NOT use_theme?
-if (isset($_REQUEST['theme'])) { //if a theme is requested...
- if ($themes->setSelectedThemeName($_REQUEST['theme'])) { //if the theme exists...
+if( isset($_REQUEST['theme']) && isset($conf->use_theme) && $conf->use_theme ) {
+ if( $themes->setSelectedThemeName($_REQUEST['theme']) ) { //if the theme exists...
$_SESSION['nocc_theme'] = $themes->getSelectedThemeName();
}
}
-if (!isset($_SESSION['nocc_theme'])) { //if session theme NOT already set...
- $_SESSION['nocc_theme'] = $themes->getDefaultThemeName();
+$default_theme_set=false;
+if( !isset($_SESSION['nocc_theme']) ) { //if session theme NOT already set...
+ $_SESSION['nocc_theme'] = $themes->getDefaultThemeName();
+ $default_theme_set=true;
}
//--------------------------------------------------------------------------------
@@ -333,19 +346,20 @@ if (isset($_SESSION['nocc_user']) && isset($_SESSION['nocc_domain'])) {
//--------------------------------------------------------------------------------
// Set and load the user prefs language...
//--------------------------------------------------------------------------------
- //TODO: Move to normal language loading!
- if (isset($user_prefs->lang) && $user_prefs->lang != '') {
- $userLang = $languages->getSelectedLangId();
- if ($languages->setSelectedLangId($user_prefs->lang)) { //if the language exists...
- $userLang = $languages->getSelectedLangId();
- if (($userLang != 'en') && ($userLang != $lang)) { //if NOT English AND current language...
- $_SESSION['nocc_lang'] = $languages->getSelectedLangId();
- $lang = $languages->getSelectedLangId();
+ if( !isset($_SESSION['nocc_lang']) || (isset($_SESSION['nocc_lang']) && $_SESSION['nocc_lang']=='default') ) {
+ if( isset($user_prefs->lang) && $user_prefs->lang != '' && $user_prefs->lang != 'default' ) {
+ $userLang = $languages->getSelectedLangId();
+ if ($languages->setSelectedLangId($user_prefs->lang)) { //if the language exists...
+ $userLang = $languages->getSelectedLangId();
+ if (($userLang != 'en') && ($userLang != $lang)) { //if NOT English AND current language...
+ $_SESSION['nocc_lang'] = $languages->getSelectedLangId();
+ $lang = $languages->getSelectedLangId();
- require './lang/'. $lang . '.php';
- }
- }
- unset($userLang);
+ require './lang/'. $lang . '.php';
+ }
+ }
+ unset($userLang);
+ }
}
unset($languages);
//--------------------------------------------------------------------------------
@@ -353,13 +367,14 @@ if (isset($_SESSION['nocc_user']) && isset($_SESSION['nocc_domain'])) {
//--------------------------------------------------------------------------------
// Set the user prefs theme...
//--------------------------------------------------------------------------------
- //TODO: Move to normal theme loading!
- if (isset($conf->use_theme) && ($conf->use_theme == true)) { //if allow theme changing...
- if (isset($user_prefs->theme) && $user_prefs->theme != '') {
- if ($themes->setSelectedThemeName($user_prefs->theme)) { //if the theme exists...
- $_SESSION['nocc_theme'] = $themes->getSelectedThemeName();
- }
- }
+ if( $default_theme_set || !isset($_SESSION['nocc_theme']) || (isset($_SESSION['nocc_theme']) && $_SESSION['nocc_theme']=='default') ) {
+ if (isset($conf->use_theme) && ($conf->use_theme == true)) { //if allow theme changing...
+ if( isset($user_prefs->theme) && $user_prefs->theme != '' && $user_prefs->theme != 'default' ) {
+ if ($themes->setSelectedThemeName($user_prefs->theme)) { //if the theme exists...
+ $_SESSION['nocc_theme'] = $themes->getSelectedThemeName();
+ }
+ }
+ }
}
unset($themes);
//--------------------------------------------------------------------------------
diff --git a/webmail/config/conf_lang.php b/webmail/config/conf_lang.php
index c6f5068..3a9c7c7 100644
--- a/webmail/config/conf_lang.php
+++ b/webmail/config/conf_lang.php
@@ -13,7 +13,7 @@
* @package NOCC
* @subpackage Configuration
* @license http://www.gnu.org/licenses/ GNU General Public License
- * @version SVN: $Id: conf_lang.php 2967 2021-12-10 14:24:34Z oheil $
+ * @version SVN: $Id: conf_lang.php 3016 2022-08-25 11:00:42Z oheil $
*/
// ################### Language Array ################### //
@@ -585,6 +585,10 @@ $lang_array[$i]->label = 'ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ';
usort($lang_array, function($a,$b){return($a->filename <=> $b->filename);});
+$default=new lang();
+$default->filename = 'default';
+$default->label = convertLang2Html($html_default);
+array_unshift($lang_array,$default);
/* Message documentation (translatewiki.net specific)
diff --git a/webmail/docs/NEWS b/webmail/docs/NEWS
index 0593017..eb9f539 100644
--- a/webmail/docs/NEWS
+++ b/webmail/docs/NEWS
@@ -4,10 +4,17 @@ Latest version is 1.9.11
NOCC 1.9.12-dev ???????? ??, ????
Misc
- * Bug in mail part/attachment parsing (Oliver Heil).
* Autoupdate: a -dev version is smaller than the release,
e.g. 1.9.12-dev is smaller than 1.9.12, because release is later (Oliver Heil).
- * Regression bug in session handling: session expires premature (Oliver Heil).
+ * Language/theme selector and preferences logic enhanced (Oliver Heil)
+ https://github.com/oheil/NOCC/issues/1
+
+ Bugs
+ * Bug in mail part/attachment parsing (Oliver Heil).
+ * Regression bug in session handling: session expires premature (Oliver Heil).
+ * Bug in check for AES256, should be lowercase, check for both (Oliver Heil).
+ * Bug on login screen: reload when lang/theme change, new session is
+ ignored (Oliver Heil).
NOCC 1.9.11 December 10, 2021
diff --git a/webmail/html/prefs.php b/webmail/html/prefs.php
index 105f024..15af884 100644
--- a/webmail/html/prefs.php
+++ b/webmail/html/prefs.php
@@ -1,4 +1,4 @@
-
+
loaded))
die('Hacking attempt');
@@ -257,13 +257,20 @@ if (count($big_list) > 1) {
|
@@ -274,12 +281,18 @@ if (count($big_list) > 1) {
|