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 1473 2011-07-09 00:40:50Z Luisehahne $
14
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/groups/add.php $
15
 * @lastmodified    $Date: 2011-07-09 02:40:50 +0200 (Sat, 09 Jul 2011) $
16
 *
17
 */
18

    
19
// Print admin header
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
22

    
23
// suppress to print the header, so no new FTAN will be set
24
$admin = new admin('Access', 'groups_add', false);
25
// Create a javascript back link
26
$js_back = ADMIN_URL.'/groups/index.php';
27

    
28
if (!$admin->checkFTAN())
29
{
30
	$admin->print_header();
31
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
32
}
33
// After check print the header
34
$admin->print_header();
35

    
36
// Gather details entered
37
$group_name = mysql_real_escape_string(strip_tags(trim($admin->get_post('group_name'))));
38

    
39
// Check values
40
if($group_name == "") {
41
	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
42
}
43
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."groups WHERE name = '$group_name'");  
44
if($results->numRows()>0) {
45
	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_EXISTS'], $js_back);  
46
}
47

    
48
// Get system and module permissions
49
require(ADMIN_PATH.'/groups/get_permissions.php');
50

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

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

    
61
// Print admin footer
62
$admin->print_footer();
(1-1/5)