1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | load_language('plugin.lang', AP_PATH); |
---|
5 | |
---|
6 | global $conf, $template, $lang; |
---|
7 | |
---|
8 | $ap_conf = explode ("," , $conf['additional_pages']); |
---|
9 | |
---|
10 | // Enregistrement de la configuration |
---|
11 | if (isset($_POST['submit'])) |
---|
12 | { |
---|
13 | foreach($_POST['menu_lang'] as $language_code => $name) |
---|
14 | { |
---|
15 | if ($language_code == 'default') $save_languages[] = $name; |
---|
16 | elseif (!empty($name)) $save_languages[] = $language_code . ':' . $name; |
---|
17 | } |
---|
18 | $languages = implode('/', $save_languages); |
---|
19 | if (!isset($_POST['show_menu'])) |
---|
20 | $_POST['show_menu'] = 'off'; |
---|
21 | if (!isset($_POST['show_home'])) |
---|
22 | $_POST['show_home'] = 'off'; |
---|
23 | if (!isset($_POST['show_edit'])) |
---|
24 | $_POST['show_edit'] = 'off'; |
---|
25 | if (!isset($_POST['redirect'])) |
---|
26 | $_POST['redirect'] = 'off'; |
---|
27 | if (!isset($_POST['group_perm'])) |
---|
28 | $_POST['group_perm'] = 'off'; |
---|
29 | if (!isset($_POST['user_perm'])) |
---|
30 | $_POST['user_perm'] = 'off'; |
---|
31 | $ap_conf = array($languages, |
---|
32 | $_POST['show_menu'], |
---|
33 | $_POST['show_home'], |
---|
34 | $_POST['show_edit'], |
---|
35 | $_POST['redirect'], |
---|
36 | $ap_conf[5], //Ancien emplacement du bbcode |
---|
37 | $_POST['group_perm'], |
---|
38 | $_POST['user_perm']); |
---|
39 | $query = ' |
---|
40 | UPDATE ' . CONFIG_TABLE . ' |
---|
41 | SET value="' . implode ("," , $ap_conf) . '" |
---|
42 | WHERE param="additional_pages" |
---|
43 | LIMIT 1'; |
---|
44 | pwg_query($query); |
---|
45 | array_push($page['infos'], l10n('ap_conf_saved')); |
---|
46 | } |
---|
47 | |
---|
48 | // Gestion des langues pour le bloc menu |
---|
49 | $languages = explode('/', $ap_conf[0]); |
---|
50 | foreach($languages as $language) |
---|
51 | { |
---|
52 | $array = explode(':', $language); |
---|
53 | if (!isset($array[1])) $menu_langs['default'] = $array[0]; |
---|
54 | else $menu_langs[$array[0]] = $array[1]; |
---|
55 | } |
---|
56 | |
---|
57 | $template->assign('LANG_DEFAULT_VALUE', $menu_langs['default']); |
---|
58 | foreach (get_languages() as $language_code => $language_name) |
---|
59 | { |
---|
60 | $template->append('language', array( |
---|
61 | 'LANGUAGE_NAME' => $language_name, |
---|
62 | 'LANGUAGE_CODE' => $language_code, |
---|
63 | 'VALUE' => (isset($menu_langs[$language_code]) ? $menu_langs[$language_code] : ''))); |
---|
64 | } |
---|
65 | |
---|
66 | // Parametrage du template |
---|
67 | $template->assign(array( |
---|
68 | 'MENU_NAME' => $ap_conf[0], |
---|
69 | 'SHOW_MENU' => (isset($ap_conf[1]) and $ap_conf[1] == 'on') ? 'checked="checked"' : '', |
---|
70 | 'SHOW_HOME' => (isset($ap_conf[2]) and $ap_conf[2] == 'on') ? 'checked="checked"' : '', |
---|
71 | 'SHOW_EDIT' => (isset($ap_conf[3]) and $ap_conf[3] == 'on') ? 'checked="checked"' : '', |
---|
72 | 'REDIRECT' => (isset($ap_conf[4]) and $ap_conf[4] == 'on') ? 'checked="checked"' : '', |
---|
73 | 'GROUP_PERM' => (isset($ap_conf[6]) and $ap_conf[6] == 'on') ? 'checked="checked"' : '', |
---|
74 | 'USER_PERM' => (isset($ap_conf[7]) and $ap_conf[7] == 'on') ? 'checked="checked"' : '')); |
---|
75 | |
---|
76 | // Lien de conversion bbcode |
---|
77 | if (isset($ap_conf[5]) and $ap_conf[5] == 'on') |
---|
78 | { |
---|
79 | $template->assign('convert_bbcode', array('PATH' => get_admin_plugin_menu_link(AP_PATH . 'admin/parse_bbcode.php'))); |
---|
80 | } |
---|
81 | |
---|
82 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); |
---|
83 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
84 | |
---|
85 | ?> |
---|