diff options
author | patdenice <patdenice@piwigo.org> | 2010-03-25 20:18:28 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2010-03-25 20:18:28 +0000 |
commit | 6b445114da301438f386eeb9853448b53fd9e516 (patch) | |
tree | 029b826deec8d484047a7394c92b9477f3e54f43 /include/functions.inc.php | |
parent | 7ebdbee901b1290fc3578b81241b25227c786efb (diff) |
Feature 1535: Add language manager.
git-svn-id: http://piwigo.org/svn/trunk@5357 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions.inc.php | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index 5d095eaa1..b31a074a0 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -396,29 +396,23 @@ function str2url($str) * * @returns array */ -function get_languages($target_charset = null) +function get_languages() { - if ( empty($target_charset) ) - { - $target_charset = get_pwg_charset(); - } - $target_charset = strtolower($target_charset); + $query = ' +SELECT id, name + FROM '.LANGUAGES_TABLE.' + ORDER BY name ASC +;'; + $result = pwg_query($query); - $dir = opendir(PHPWG_ROOT_PATH.'language'); $languages = array(); - - while ($file = readdir($dir)) + while ($row = pwg_db_fetch_assoc($result)) { - $path = PHPWG_ROOT_PATH.'language/'.$file; - if (!is_link($path) and is_dir($path) and file_exists($path.'/iso.txt')) + if (is_dir(PHPWG_ROOT_PATH.'language/'.$row['id'])) { - list($language_name) = @file($path.'/iso.txt'); - - $languages[$file] = convert_charset($language_name, $target_charset); + $languages[ $row['id'] ] = $row['name']; } } - closedir($dir); - @asort($languages); return $languages; } |