1 | <?php |
---|
2 | /* $Id: cf_language.tab.php,v 1.5 2009/08/19 14:51:59 Criss Exp $ */ |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | check_status(ACCESS_ADMINISTRATOR); |
---|
5 | global $user; |
---|
6 | CF_Log::add_debug($user, 'USER'); |
---|
7 | $all_languages = get_languages(); |
---|
8 | $cf_languages = $cf_config->get_config_lang(); |
---|
9 | $cf_item_selected=''; |
---|
10 | if (isset($_POST['submit'])) { |
---|
11 | |
---|
12 | if (isset($_POST['cf_item']) and is_array($_POST['cf_item'])) { |
---|
13 | $cf_languages->mass_update($_POST['cf_item']); |
---|
14 | } |
---|
15 | |
---|
16 | // Save config |
---|
17 | $cf_config->save_config(); |
---|
18 | $saved = $cf_config->save_config(); |
---|
19 | if ($saved) { |
---|
20 | CF_Log::add_message(l10n('cf_config_saved')); |
---|
21 | } else { |
---|
22 | CF_Log::add_error(l10n('cf_config_saved_with_errors')); |
---|
23 | } |
---|
24 | |
---|
25 | if (isset($_POST['cf_selected'])) { |
---|
26 | $cf_item_selected = trim(stripslashes($_POST['cf_selected'])); |
---|
27 | } |
---|
28 | } |
---|
29 | |
---|
30 | $config_values=array(); |
---|
31 | |
---|
32 | foreach($cf_languages->get_keys() as $key) { |
---|
33 | $current = array(); |
---|
34 | $current[CF_LANG_DEFAULT] = array( |
---|
35 | 'LANG' => CF_LANG_DEFAULT, |
---|
36 | 'NAME' => l10n('cf_default_lang'), |
---|
37 | 'VALUE' => $cf_languages->get_value(CF_LANG_DEFAULT, $key, false), |
---|
38 | ); |
---|
39 | foreach($all_languages as $lang_key => $lang_name) { |
---|
40 | $current[$lang_key] = array( |
---|
41 | 'LANG' => $lang_key, |
---|
42 | 'NAME' => $lang_name, |
---|
43 | 'VALUE' => $cf_languages->get_value($lang_key, $key, false), |
---|
44 | ); |
---|
45 | } |
---|
46 | $config_values[$key] = array( |
---|
47 | 'KEY' => l10n($key . '_label'), |
---|
48 | 'VALUE' => $current, |
---|
49 | ); |
---|
50 | } |
---|
51 | if ('' == $cf_item_selected) { |
---|
52 | $cf_item_selected = 0; |
---|
53 | } |
---|
54 | $template->assign('CF_CONFIG_KEYS_SELECTED', $cf_item_selected); |
---|
55 | $template->assign('CF_CONFIG_VALUES', $config_values); |
---|
56 | ?> |
---|