Exemplo n.º 1
0
/**
 * Refreshes the list of available language files found in the /global/lang folder. This
 * function parses the folder and stores the language info in the "available_languages"
 * settings in the settings table.
 *
 * @return array [0]: true/false (success / failure)
 *               [1]: message string
 */
function ft_refresh_language_list()
{
    global $g_root_dir, $g_table_prefix, $LANG;
    $language_folder_dir = "{$g_root_dir}/global/lang";
    $available_language_info = array();
    if ($handle = opendir($language_folder_dir)) {
        while (false !== ($filename = readdir($handle))) {
            if ($filename != '.' && $filename != '..' && $filename != "index.php" && ft_get_filename_extension($filename, true) == "php") {
                list($lang_file, $lang_display) = _ft_get_language_file_info("{$language_folder_dir}/{$filename}");
                $available_language_info[$lang_file] = $lang_display;
            }
        }
        closedir($handle);
    }
    // sort the languages alphabetically
    ksort($available_language_info);
    // now piece everything together in a single string for storing in the database
    $available_languages = array();
    while (list($key, $val) = each($available_language_info)) {
        $available_languages[] = "{$key},{$val}";
    }
    $available_language_str = join("|", $available_languages);
    mysql_query("\n    UPDATE {$g_table_prefix}settings\n    SET    setting_value = '{$available_language_str}'\n    WHERE  setting_name = 'available_languages'\n      ");
    // update the values in sessions
    $_SESSION["ft"]["settings"]["available_languages"] = $available_language_str;
    return array(true, $LANG["notify_lang_list_updated"]);
}
Exemplo n.º 2
0
/**
 * Returns a list of all export icons, found in the /modules/export_manager/images/icons/ folder.
 *
 * return array an array of image filenames.
 */
function exp_get_export_icons()
{
    global $g_root_dir;
    $icon_folder = "{$g_root_dir}/modules/export_manager/images/icons/";
    // store all the icon filenames in an array
    $filenames = array();
    if ($handle = opendir($icon_folder)) {
        while (false !== ($file = readdir($handle))) {
            $extension = ft_get_filename_extension($file, true);
            if ($extension == "jpg" || $extension == "gif" || $extension == "bmp" || $extension == "png") {
                $filenames[] = $file;
            }
        }
    }
    return $filenames;
}