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 1398 2011-01-20 18:44:35Z FrankH $
|
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
|
if (!$admin->checkFTAN())
|
25
|
{
|
26
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
|
27
|
exit();
|
28
|
}
|
29
|
|
30
|
// Gather details entered
|
31
|
$group_name = $admin->get_post('group_name');
|
32
|
|
33
|
// Create a javascript back link
|
34
|
$js_back = "javascript: history.go(-1);";
|
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
|
?>
|