From 9cbe8a39c54392df5b629b56696d935b58499ae7 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 26 Jan 2009 15:47:28 +0100 Subject: [PATCH] Changed loading of language files, now english files are loaded first. If another language is configured, the translation is loaded after the english language files. By using this method, you are able to use older translations with newer phpLogCon versions, without having display issues. Strings which are not translated are just shown in english. --- src/classes/logstreampdo.class.php | 6 ++++++ src/include/functions_common.php | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php index 5ad98f5..f54610f 100644 --- a/src/classes/logstreampdo.class.php +++ b/src/classes/logstreampdo.class.php @@ -712,7 +712,10 @@ class LogStreamPDO extends LogStream { return ERROR_DB_QUERYFAILED; if ( $this->_myDBQuery->rowCount() == 0 ) + { + $this->_myDBQuery = null; return ERROR_NOMORERECORDS; + } // Initialize Array variable $aResult = array(); @@ -728,6 +731,9 @@ class LogStreamPDO extends LogStream { } } + // Delete handle + $this->_myDBQuery = null; + // return finished array if ( count($aResult) > 0 ) return $aResult; diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 21a3813..95de275 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -1031,12 +1031,23 @@ function IncludeLanguageFile( $langfile ) { global $LANG, $LANG_EN; - if ( file_exists( $langfile ) ) - include( $langfile ); + // If english is not selected, we load ENGLISH first - then overwrite with configured language + if ( $LANG != "en" ) + $langengfile = str_replace( $LANG, $LANG_EN, $langfile ); else + $langengfile = $langfile; + if ( file_exists($langengfile) ) + include( $langengfile ); + else + DieWithErrorMsg( "FATAL Error initialzing sublanguage system. Please make sure that all files have been uploaded correctly." ); + + // If nto english, load the additional translations + if ( $LANG != "en" ) { - $langfile = str_replace( $LANG, $LANG_EN, $langfile ); - include( $langfile ); + if ( file_exists( $langfile ) ) + include( $langfile ); + else + OutputDebugMessage("FATAL Error reading the configured language $LANG. Please make sure that all files have been uploaded correctly.", DEBUG_ERROR); } }