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

Last change on this file since 9350 was 9350, checked in by patdenice, 13 years ago

Extended description now work on page title.
Language restriction is now optionnal.

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