|
Changeset |
Before this commit, we were loading language files at compile time, which 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_langstrings (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 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9 |