source: extensions/PWG_Stuffs/admin/config.inc.php @ 9383

Revision 9383, 1.3 KB checked in by patdenice, 9 years ago (diff)

Add display option. Optimizations.

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
26  $params = array('group_perm', 'user_perm', 'level_perm');
27
28  foreach ($params as $param)
29  {
30    $conf['Stuffs'][$param] = isset($_POST[$param]);
31  }
32
33  conf_update_param('PWG_Stuffs', pwg_db_real_escape_string(serialize($conf['Stuffs'])));
34
35  array_push($page['infos'], l10n('Information data registered in database'));
36}
37
38// Parametrage du template
39$template->assign('stuffs_conf', $conf['Stuffs']);
40
41$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/config.tpl'));
42$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
43
44?>
Note: See TracBrowser for help on using the repository browser.