Project

General

Profile

1
<?php
2

    
3
// $Id: add.php 24 2005-09-05 22:31:19Z stefan $
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_add');
30

    
31
// Create new database object
32
$database = new database();
33

    
34
// Gather details entered
35
$group_name = $admin->get_post('group_name');
36

    
37
// Create a javascript back link
38
$js_back = "javascript: history.go(-1);";
39

    
40
// Check values
41
if($group_name == "") {
42
	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
43
}
44

    
45
// Get system and module permissions
46
require(ADMIN_PATH.'/groups/get_permissions.php');
47

    
48
// Update the database
49
$query = "INSERT INTO ".TABLE_PREFIX."groups (name,system_permissions,module_permissions,template_permissions) VALUES ('$group_name','$system_permissions','$module_permissions','$template_permissions')";
50

    
51
$database->query($query);
52
if($database->is_error()) {
53
	$admin->print_error($database->get_error());
54
} else {
55
	$admin->print_success($MESSAGE['GROUPS']['ADDED'], ADMIN_URL.'/groups/index.php');
56
}
57

    
58
// Print admin footer
59
$admin->print_footer();
60

    
61
?>
(1-1/7)