Project

General

Profile

1
<?php
2
/**
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: add.php 1426 2011-02-04 04:27:35Z Luisehahne $
14
 * @filesource		$HeadURL:  $
15
 * @lastmodified    $Date:  $
16
 *
17
 */
18

    
19
// Print admin header
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22
$admin = new admin('Access', 'groups_add');
23

    
24
// Create a javascript back link
25
$js_back = ADMIN_URL.'/groups/index.php';
26

    
27
if (!$admin->checkFTAN())
28
{
29
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
30
	exit();
31
}
32

    
33
// Gather details entered
34
$group_name = mysql_real_escape_string(strip_tags(trim($admin->get_post('group_name'))));
35

    
36
// Check values
37
if($group_name == "") {
38
	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
39
}
40
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."groups WHERE name = '$group_name'");  
41
if($results->numRows()>0) {
42
	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_EXISTS'], $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/5)