From 47481aab5608b2bd5727595be7cb4fcf24740d85 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Sun, 10 Mar 2013 10:23:24 +0100 Subject: [PATCH] check if the used froxlor version has already iso-codes in the language-table for this will output undefined variables after updating the files before updating the database in the panel Signed-off-by: Michael Kaufmann (d00p) --- .../preconfig/0.9/preconfig_0.9.inc.php | 3 +- lib/init.php | 51 ++++++++++--------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php index e4ffd48d..b96d5e09 100644 --- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -457,7 +457,8 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) if ($settings['system']['webserver'] == 'apache2') { $has_preconfig = true; $description = 'Froxlor now supports the new Apache 2.4. Please be aware that you need to load additional apache-modules in ordner to use it.
'; - $description.= '
LoadModule authz_core_module modules/mod_authz_core.so LoadModule authz_host_module modules/mod_authz_host.so

'; + $description.= '
LoadModule authz_core_module modules/mod_authz_core.so
+LoadModule authz_host_module modules/mod_authz_host.so

'; $question = 'Do you want to enable the Apache-2.4 modification?: '; $question.= makeyesno('update_system_apache24', '1', '0', '0'); eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); diff --git a/lib/init.php b/lib/init.php index 15c48af4..11ed93b3 100644 --- a/lib/init.php +++ b/lib/init.php @@ -276,7 +276,13 @@ $result = $db->query($query); while($row = $db->fetch_array($result)) { $langs[$row['language']][] = $row; - $iso[$row['iso']] = $row['language']; + // check for row[iso] cause older froxlor + // versions didn't have that and it will + // lead to a lot of undfined variables + // before the admin can even update + if (isset($row['iso'])) { + $iso[$row['iso']] = $row['language']; + } } // buildup $languages for the login screen @@ -285,43 +291,40 @@ foreach($langs as $key => $value) $languages[$key] = $key; } -if (isset($userinfo['language']) && isset($languages[$userinfo['language']])) -{ +// set default langauge before anything else to +// ensure that we can display messages +$language = $settings['panel']['standardlanguage']; + +if (isset($userinfo['language']) && isset($languages[$userinfo['language']])) { // default: use language from session, #277 $language = $userinfo['language']; -} -else -{ - if(!isset($userinfo['def_language']) - || !isset($languages[$userinfo['def_language']]))// this will always evaluat true, since it is the above statement inverted. @todo remove - { - if(isset($_GET['language']) - && isset($languages[$_GET['language']])) - { +} else { + if (!isset($userinfo['def_language']) + || !isset($languages[$userinfo['def_language']]) // this will always evaluat true, since it is the above statement inverted. @todo remove + ) { + if (isset($_GET['language']) + && isset($languages[$_GET['language']]) + ) { $language = $_GET['language']; - } - else - { + } else { $accept_langs = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']); for($i = 0; $i0) { + if (!strlen($language)>0) { $language = $settings['panel']['standardlanguage']; } } - } - else - { + } else { $language = $userinfo['def_language']; } }