Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before this commit, we were loading language files at compile time, w…
…hich means we had to choose between pretty error messages when the database connect failed and obeying the user's preferred language. With the help of Julian (nice suggestion, that get_defined_vars()), I've modified lang_api to load language files at compile time and made some other modifications to ensure that a failed database connect prints a nice message again. M core.php - Reordered the includes again M core/authentication_api.php - (auth_user_is_authenticated) Every function that was going to access the database first checked this function, so I've defined the lack of database connection as not authenticated M core/database_api.php - Now remembers whether a db_connect or db_pconnect succesfully terminated - Added db_is_connected(), which returns this remembered state M core/lang_api.php - Now loads the language into $g_lang_strings (as opposed to defining every language variable as global, because you were including a file in a function). This has the added benefit that language variables can only be defined in strings_<lang>.txt and custom_strings_inc.php, hopefully preventing all string-spoofing-vulnerabilities) - Remembers which language is loaded. I only need to know whether a language was loaded, but this has the added benefit of possibly preventing a language from loaded twice - Added lang_load(lang), which loads a language, and lang_load_default(), which loads the user's language (or default_language). lang_load_default might be wrongly named? Opinions? - Added lang_ensure_loaded, which calls lang_load_default if no language has previously been loaded - Modified lang_get and lang_exists to use $g_lang_strings, and call lang_ensure_loaded - Removed the 'main code', which was loading languages at compile time. git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1906 f5dc347c-c33d-0410-90a0-b07cc1902cb9
- Loading branch information
Jeroen Latour
committed
Feb 17, 2003
1 parent
de1bec6
commit 36f1cfc
Showing
5 changed files
with
119 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters