1
|
<?php
|
2
|
|
3
|
// $Id: save.php 10 2005-09-04 08:59:31Z ryan $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2005, Ryan Djurovich
|
9
|
|
10
|
Website Baker is free software; you can redistribute it and/or modify
|
11
|
it under the terms of the GNU General Public License as published by
|
12
|
the Free Software Foundation; either version 2 of the License, or
|
13
|
(at your option) any later version.
|
14
|
|
15
|
Website Baker is distributed in the hope that it will be useful,
|
16
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
GNU General Public License for more details.
|
19
|
|
20
|
You should have received a copy of the GNU General Public License
|
21
|
along with Website Baker; if not, write to the Free Software
|
22
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
|
24
|
*/
|
25
|
|
26
|
// Print admin header
|
27
|
require('../../config.php');
|
28
|
require_once(WB_PATH.'/framework/class.admin.php');
|
29
|
$admin = new admin('Access', 'groups_modify');
|
30
|
|
31
|
// Create new database object
|
32
|
$database = new database();
|
33
|
|
34
|
// Check if group group_id is a valid number and doesnt equal 1
|
35
|
if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
|
36
|
header("Location: index.php");
|
37
|
} else {
|
38
|
$group_id = $_POST['group_id'];
|
39
|
}
|
40
|
|
41
|
// Gather details entered
|
42
|
$group_name = $admin->get_post('group_name');
|
43
|
|
44
|
// Create a javascript back link
|
45
|
$js_back = "javascript: history.go(-1);";
|
46
|
|
47
|
// Check values
|
48
|
if($group_name == "") {
|
49
|
$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
|
50
|
}
|
51
|
|
52
|
// Get system permissions
|
53
|
require_once(ADMIN_PATH.'/groups/get_permissions.php');
|
54
|
|
55
|
// Update the database
|
56
|
$query = "UPDATE ".TABLE_PREFIX."groups SET name = '$group_name', system_permissions = '$system_permissions', module_permissions = '$module_permissions', template_permissions = '$template_permissions' WHERE group_id = '$group_id'";
|
57
|
|
58
|
$database->query($query);
|
59
|
if($database->is_error()) {
|
60
|
$admin->print_error($database->get_error());
|
61
|
} else {
|
62
|
$admin->print_success($MESSAGE['GROUPS']['SAVED'], ADMIN_URL.'/groups/index.php');
|
63
|
}
|
64
|
|
65
|
// Print admin footer
|
66
|
$admin->print_footer();
|
67
|
|
68
|
?>
|