Project

General

Profile

1 4 ryan
<?php
2 1398 FrankH
/**
3
 *
4
 * @category        admin
5
 * @package         groups
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL:  $
15
 * @lastmodified    $Date:  $
16
 *
17
 */
18 4 ryan
19
// Print admin header
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22
$admin = new admin('Access', 'groups_modify');
23
24 1398 FrankH
if (!$admin->checkFTAN())
25
{
26
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
27
	exit();
28
}
29 4 ryan
30
// Check if group group_id is a valid number and doesnt equal 1
31
if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
32
	header("Location: index.php");
33 286 stefan
	exit(0);
34 4 ryan
} else {
35
	$group_id = $_POST['group_id'];
36
}
37
38
// Gather details entered
39 656 thorn
$group_name = $admin->get_post_escaped('group_name');
40 4 ryan
41
// Create a javascript back link
42
$js_back = "javascript: history.go(-1);";
43
44
// Check values
45
if($group_name == "") {
46
	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
47
}
48
49
// Get system permissions
50
require_once(ADMIN_PATH.'/groups/get_permissions.php');
51
52
// Update the database
53
$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'";
54
55
$database->query($query);
56
if($database->is_error()) {
57
	$admin->print_error($database->get_error());
58
} else {
59
	$admin->print_success($MESSAGE['GROUPS']['SAVED'], ADMIN_URL.'/groups/index.php');
60
}
61
62
// Print admin footer
63
$admin->print_footer();
64
65
?>