1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | $mb_conf = @unserialize($conf['blk_menubar']); |
---|
6 | |
---|
7 | // Enregistrement de la configuration |
---|
8 | if (isset($_POST['submit'])) |
---|
9 | { |
---|
10 | if (!$conf['additional_pages']['user_perm'] and isset($_POST['user_perm'])) |
---|
11 | { |
---|
12 | pwg_query('UPDATE '.ADD_PAGES_TABLE.' SET users = "guest,generic,normal,admin,webmaster";'); |
---|
13 | } |
---|
14 | if ($conf['additional_pages']['user_perm'] and !isset($_POST['user_perm'])) |
---|
15 | { |
---|
16 | pwg_query('UPDATE '.ADD_PAGES_TABLE.' SET users = NULL;'); |
---|
17 | } |
---|
18 | if ($conf['additional_pages']['level_perm'] and !isset($_POST['level_perm'])) |
---|
19 | { |
---|
20 | $default_user = get_default_user_info(true); |
---|
21 | pwg_query('UPDATE '.ADD_PAGES_TABLE.' SET level = '.$default_user['level'].';'); |
---|
22 | } |
---|
23 | if ($conf['additional_pages']['group_perm'] and !isset($_POST['group_perm'])) |
---|
24 | { |
---|
25 | pwg_query('UPDATE '.ADD_PAGES_TABLE.' SET groups = NULL;'); |
---|
26 | } |
---|
27 | |
---|
28 | $params = array('show_home', 'group_perm', 'user_perm', 'level_perm'); |
---|
29 | |
---|
30 | foreach ($params as $param) |
---|
31 | { |
---|
32 | $conf['additional_pages'][$param] = isset($_POST[$param]); |
---|
33 | } |
---|
34 | |
---|
35 | $conf['additional_pages']['languages'] = array(); |
---|
36 | foreach($_POST['menu_lang'] as $language_code => $name) |
---|
37 | { |
---|
38 | if (!empty($name)) |
---|
39 | $conf['additional_pages']['languages'][$language_code] = $name; |
---|
40 | } |
---|
41 | |
---|
42 | conf_update_param('additional_pages', pwg_db_real_escape_string(serialize($conf['additional_pages']))); |
---|
43 | |
---|
44 | if (isset($_POST['show_menu']) xor (!isset($mb_conf['mbAdditionalPages']) or $mb_conf['mbAdditionalPages'] > 0)) |
---|
45 | { |
---|
46 | if (!isset($mb_conf['mbAdditionalPages'])) |
---|
47 | { |
---|
48 | $last = @abs(end($mb_conf)); |
---|
49 | $mb_conf['mbAdditionalPages'] = $last + 50; |
---|
50 | } |
---|
51 | $mb_conf['mbAdditionalPages'] = (isset($_POST['show_menu']) ? +1 : -1) * abs($mb_conf['mbAdditionalPages']); |
---|
52 | conf_update_param('blk_menubar', pwg_db_real_escape_string(serialize($mb_conf))); |
---|
53 | } |
---|
54 | |
---|
55 | array_push($page['infos'], l10n('ap_conf_saved')); |
---|
56 | } |
---|
57 | |
---|
58 | // Gestion des langues pour le bloc menu |
---|
59 | $template->append('language', array( |
---|
60 | 'LANGUAGE_NAME' => l10n('Default'), |
---|
61 | 'LANGUAGE_CODE' => 'default', |
---|
62 | 'VALUE' => @$conf['additional_pages']['languages']['default'], |
---|
63 | ) |
---|
64 | ); |
---|
65 | foreach (get_languages() as $language_code => $language_name) |
---|
66 | { |
---|
67 | $template->append('language', array( |
---|
68 | 'LANGUAGE_NAME' => $language_name, |
---|
69 | 'LANGUAGE_CODE' => $language_code, |
---|
70 | 'VALUE' => isset($conf['additional_pages']['languages'][$language_code]) ? $conf['additional_pages']['languages'][$language_code] : '', |
---|
71 | ) |
---|
72 | ); |
---|
73 | } |
---|
74 | |
---|
75 | // Parametrage du template |
---|
76 | $template->assign('ap_conf', $conf['additional_pages']); |
---|
77 | |
---|
78 | if (!isset($mb_conf['mbAdditionalPages']) or $mb_conf['mbAdditionalPages'] == abs($mb_conf['mbAdditionalPages'])) |
---|
79 | { |
---|
80 | $template->assign('SHOW_MENU', true); |
---|
81 | } |
---|
82 | |
---|
83 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/config.tpl')); |
---|
84 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
85 | |
---|
86 | ?> |
---|