mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-12 11:43:01 +02:00
- bug 168 fixed: crash when language file does not exists. Constant
PHPWG_DEFAULT_LANGUAGE added. New function get_language_filepath always used to find language files. git-svn-id: http://piwigo.org/svn/trunk@879 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -497,4 +497,38 @@ SELECT name
|
||||
|
||||
return $groupname;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the file path of the given language filename, depending on the
|
||||
* availability of the file
|
||||
*
|
||||
* in descending order of preference: user language, default language,
|
||||
* PhpWebGallery default language.
|
||||
*
|
||||
* @param string filename
|
||||
* @return string filepath
|
||||
*/
|
||||
function get_language_filepath($filename)
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
$directories =
|
||||
array(
|
||||
PHPWG_ROOT_PATH.'language/'.$user['language'],
|
||||
PHPWG_ROOT_PATH.'language/'.$conf['default_language'],
|
||||
PHPWG_ROOT_PATH.'language/'.PHPWG_DEFAULT_LANGUAGE
|
||||
);
|
||||
|
||||
foreach ($directories as $directory)
|
||||
{
|
||||
$filepath = $directory.'/'.$filename;
|
||||
|
||||
if (file_exists($filepath))
|
||||
{
|
||||
return $filepath;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user