fix undefined language indeces (add english as fallback as intented in case a string is not defined in the used language)

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-10-19 18:48:08 +02:00
parent 729b52cf0a
commit cb556093c1

View File

@@ -49,20 +49,24 @@ while($row = $db->fetch_array($result))
'MAX_PERCENT' => $settings['system']['report_webmax'] 'MAX_PERCENT' => $settings['system']['report_webmax']
); );
$lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` $lngfile = $db->query_first("
WHERE `language` ='" . $row['def_language'] . "'"); SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`
WHERE `language` ='" . $row['def_language'] . "'
");
if($lngfile !== NULL) if ($lngfile !== null) {
{
$langfile = $lngfile['file']; $langfile = $lngfile['file'];
} } else {
else $lngfile = $db->query_first("
{ SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`
$lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'
WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'"); ");
$langfile = $lngfile['file']; $langfile = $lngfile['file'];
} }
// include english language file (fallback)
include_once makeCorrectFile($pathtophpfiles . '/lng/english.lng.php');
// include admin/customer language file
include_once makeCorrectFile($pathtophpfiles . '/' . $langfile); include_once makeCorrectFile($pathtophpfiles . '/' . $langfile);
// Get mail templates from database; the ones from 'admin' are fetched for fallback // Get mail templates from database; the ones from 'admin' are fetched for fallback