source: extensions/AdditionalPages/admin/config.inc.php @ 9546

Last change on this file since 9546 was 9546, checked in by patdenice, 10 years ago

Default privacy level must be 0.

File size: 2.9 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5$mb_conf = @unserialize($conf['blk_menubar']);
6
7// Enregistrement de la configuration
8if (isset($_POST['submit']))
9{
10  if (!$conf['AP']['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['AP']['user_perm'] and !isset($_POST['user_perm']))
15  {
16    pwg_query('UPDATE '.ADD_PAGES_TABLE.' SET users = NULL;');
17  }
18  if ($conf['AP']['level_perm'] and !isset($_POST['level_perm']))
19  {
20    pwg_query('UPDATE '.ADD_PAGES_TABLE.' SET level = 0;');
21  }
22  if ($conf['AP']['group_perm'] and !isset($_POST['group_perm']))
23  {
24    pwg_query('UPDATE '.ADD_PAGES_TABLE.' SET groups = NULL;');
25  }
26  if ($conf['AP']['language_perm'] and !isset($_POST['language_perm']))
27  {
28    pwg_query('UPDATE '.ADD_PAGES_TABLE.' SET lang = NULL;');
29  }
30
31  $params = array('show_home', 'group_perm', 'user_perm', 'level_perm', 'language_perm');
32
33  foreach ($params as $param)
34  {
35    $conf['AP'][$param] = isset($_POST[$param]);
36  }
37
38  $conf['AP']['languages'] = array();
39        foreach($_POST['menu_lang'] as $language_code => $name)
40  {
41                if (!empty($name))
42      $conf['AP']['languages'][$language_code] = $name;
43        }
44
45  conf_update_param('additional_pages', pwg_db_real_escape_string(serialize($conf['AP'])));
46
47  if (isset($_POST['show_menu']) xor (!isset($mb_conf['mbAdditionalPages']) or $mb_conf['mbAdditionalPages'] > 0))
48  {
49    if (!isset($mb_conf['mbAdditionalPages']))
50    {
51      $last = @abs(end($mb_conf));
52      $mb_conf['mbAdditionalPages'] = $last + 50;
53    }
54    $mb_conf['mbAdditionalPages'] = (isset($_POST['show_menu']) ? +1 : -1) * abs($mb_conf['mbAdditionalPages']);
55    conf_update_param('blk_menubar', pwg_db_real_escape_string(serialize($mb_conf)));
56  }
57
58  array_push($page['infos'], l10n('ap_conf_saved'));
59}
60
61// Gestion des langues pour le bloc menu
62$template->append('language', array(
63  'LANGUAGE_NAME' => l10n('Default'),
64  'LANGUAGE_CODE' => 'default',
65  'VALUE' => @$conf['AP']['languages']['default'],
66  )
67);
68foreach (get_languages() as $language_code => $language_name)
69{
70        $template->append('language', array(
71    'LANGUAGE_NAME' => $language_name,
72    'LANGUAGE_CODE' => $language_code,
73    'VALUE' => isset($conf['AP']['languages'][$language_code]) ? $conf['AP']['languages'][$language_code] : '',
74    )
75  );
76}
77
78// Parametrage du template
79$template->assign(array(
80  'ap_conf' => $conf['AP'],
81  'SHOW_MENU' => (!isset($mb_conf['mbAdditionalPages']) or $mb_conf['mbAdditionalPages'] > 0),
82  'AMM_INSTALLED' => defined('AMM_PATH'),
83  )
84);
85
86if (defined('AMM_PATH'))
87{
88  load_language('plugin.lang', AMM_PATH);
89  $template->assign('AMM_URI', get_admin_plugin_menu_link(AMM_PATH.'admin/plugin_admin.php'));
90}
91
92$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/config.tpl'));
93$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
94
95?>
Note: See TracBrowser for help on using the repository browser.