source: extensions/PWG_Stuffs/trunk/admin/config.inc.php @ 9736

Last change on this file since 9736 was 9575, checked in by patdenice, 14 years ago

Level permission was not saved.

File size: 1.5 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5// Save config
6if (isset($_POST['submit']))
7{
8  if (!$conf['Stuffs']['user_perm'] and isset($_POST['user_perm']))
9  {
10    pwg_query('UPDATE '.STUFFS_TABLE.' SET users = "guest,generic,normal,admin,webmaster";');
11  }
12  if ($conf['Stuffs']['user_perm'] and !isset($_POST['user_perm']))
13  {
14    pwg_query('UPDATE '.STUFFS_TABLE.' SET users = NULL;');
15  }
16  if ($conf['Stuffs']['level_perm'] and !isset($_POST['level_perm']))
17  {
18    $default_user = get_default_user_info(true);
19    pwg_query('UPDATE '.STUFFS_TABLE.' SET level = '.$default_user['level'].';');
20  }
21  if ($conf['Stuffs']['group_perm'] and !isset($_POST['group_perm']))
22  {
23    pwg_query('UPDATE '.STUFFS_TABLE.' SET groups = NULL;');
24  }
25  if ($conf['Stuffs']['level_perm'] and !isset($_POST['level_perm']))
26  {
27    pwg_query('UPDATE '.STUFFS_TABLE.' SET level = 0;');
28  }
29
30  $params = array('group_perm', 'user_perm', 'level_perm');
31
32  foreach ($params as $param)
33  {
34    $conf['Stuffs'][$param] = isset($_POST[$param]);
35  }
36
37  conf_update_param('PWG_Stuffs', pwg_db_real_escape_string(serialize($conf['Stuffs'])));
38
39  array_push($page['infos'], l10n('Information data registered in database'));
40}
41
42// Parametrage du template
43$template->assign('stuffs_conf', $conf['Stuffs']);
44
45$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/config.tpl'));
46$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
47
48?>
Note: See TracBrowser for help on using the repository browser.