From cb556093c12d97afc74e407cc3c7c9366026eb6e Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Sat, 19 Oct 2013 18:48:08 +0200 Subject: [PATCH] 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) --- scripts/jobs/cron_usage.inc.diskspace.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/jobs/cron_usage.inc.diskspace.php b/scripts/jobs/cron_usage.inc.diskspace.php index e6a48726..2c3db743 100644 --- a/scripts/jobs/cron_usage.inc.diskspace.php +++ b/scripts/jobs/cron_usage.inc.diskspace.php @@ -49,20 +49,24 @@ while($row = $db->fetch_array($result)) 'MAX_PERCENT' => $settings['system']['report_webmax'] ); - $lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` - WHERE `language` ='" . $row['def_language'] . "'"); + $lngfile = $db->query_first(" + SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` + WHERE `language` ='" . $row['def_language'] . "' + "); - if($lngfile !== NULL) - { + if ($lngfile !== null) { $langfile = $lngfile['file']; - } - else - { - $lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` - WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'"); + } else { + $lngfile = $db->query_first(" + SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "` + WHERE `language` ='" . $settings['panel']['standardlanguage'] . "' + "); $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); // Get mail templates from database; the ones from 'admin' are fetched for fallback