Project

General

Profile

1 4 ryan
<?php
2
3 286 stefan
// $Id$
4 4 ryan
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8 519 Ruebenwurz
 Copyright (C) 2004-2008, Ryan Djurovich
9 4 ryan
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 286 stefan
	exit(0);
38 4 ryan
} else {
39
	$group_id = $_POST['group_id'];
40
}
41
42
// Gather details entered
43
$group_name = $admin->get_post('group_name');
44
45
// Create a javascript back link
46
$js_back = "javascript: history.go(-1);";
47
48
// Check values
49
if($group_name == "") {
50
	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
51
}
52
53
// Get system permissions
54
require_once(ADMIN_PATH.'/groups/get_permissions.php');
55
56
// Update the database
57
$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'";
58
59
$database->query($query);
60
if($database->is_error()) {
61
	$admin->print_error($database->get_error());
62
} else {
63
	$admin->print_success($MESSAGE['GROUPS']['SAVED'], ADMIN_URL.'/groups/index.php');
64
}
65
66
// Print admin footer
67
$admin->print_footer();
68
69
?>