Project

General

Profile

1 1386 Luisehahne
<?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$
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');
23 1398 FrankH
$ftan = $admin->getFTAN();
24 1386 Luisehahne
25
// Create new template object for the modify/remove menu
26
$template = new Template(THEME_PATH.'/templates');
27
$template->set_file('page', 'groups.htt');
28
$template->set_block('page', 'main_block', 'main');
29
$template->set_block('main_block', 'manage_users_block', 'users');
30
// insert urls
31
$template->set_var(array(
32
	'ADMIN_URL' => ADMIN_URL,
33
	'WB_URL' => WB_URL,
34 1398 FrankH
	'THEME_URL' => THEME_URL,
35
	'FTAN' => $ftan
36 1386 Luisehahne
	)
37
);
38
39
// Get existing value from database
40
// $database = new database();
41
$query = "SELECT group_id,name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'";
42
$results = $database->query($query);
43
if($database->is_error()) {
44
	$admin->print_error($database->get_error(), 'index.php');
45
}
46
47
// Insert values into the modify/remove menu
48
$template->set_block('main_block', 'list_block', 'list');
49
if($results->numRows() > 0) {
50
	// Insert first value to say please select
51
	$template->set_var('VALUE', '');
52
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
53
	$template->parse('list', 'list_block', true);
54
	// Loop through groups
55
	while($group = $results->fetchRow()) {
56 1475 Luisehahne
		$template->set_var('VALUE',$admin->getIDKEY($group['group_id']));
57 1386 Luisehahne
		$template->set_var('NAME', $group['name']);
58
		$template->parse('list', 'list_block', true);
59
	}
60
} else {
61
	// Insert single value to say no groups were found
62
	$template->set_var('NAME', $TEXT['NONE_FOUND']);
63
	$template->parse('list', 'list_block', true);
64
}
65
66
// Insert permissions values
67
if($admin->get_permission('groups_add') != true) {
68
	$template->set_var('DISPLAY_ADD', 'hide');
69
}
70
if($admin->get_permission('groups_modify') != true) {
71
	$template->set_var('DISPLAY_MODIFY', 'hide');
72
}
73
if($admin->get_permission('groups_delete') != true) {
74
	$template->set_var('DISPLAY_DELETE', 'hide');
75
}
76
77
// Insert language headings
78
$template->set_var(array(
79
	'HEADING_MODIFY_DELETE_GROUP' => $HEADING['MODIFY_DELETE_GROUP'],
80
	'HEADING_ADD_GROUP' => $HEADING['ADD_GROUP']
81
	)
82
);
83
// Insert language text and messages
84
$template->set_var(array(
85
	'TEXT_MODIFY' => $TEXT['MODIFY'],
86
	'TEXT_DELETE' => $TEXT['DELETE'],
87
	'TEXT_MANAGE_USERS' => ( $admin->get_permission('users') == true ) ? $TEXT['MANAGE_USERS']: "",
88
	'CONFIRM_DELETE' => $MESSAGE['GROUPS']['CONFIRM_DELETE']
89
	)
90
);
91
if ( $admin->get_permission('users') == true ) $template->parse("users", "manage_users_block", true);
92
// Parse template object
93
$template->parse('main', 'main_block', false);
94
$template->pparse('output', 'page');
95
96
// Setup template for add group form
97
$template = new Template(THEME_PATH.'/templates');
98
$template->set_file('page', 'groups_form.htt');
99
$template->set_block('page', 'main_block', 'main');
100
$template->set_var('DISPLAY_EXTRA', 'display:none;');
101
$template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
102
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
103
$template->set_var('ADVANCED_ACTION', 'index.php');
104
105
// Tell the browser whether or not to show advanced options
106
if ( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
107
	$template->set_var('DISPLAY_ADVANCED', '');
108
	$template->set_var('DISPLAY_BASIC', 'display:none;');
109
	$template->set_var('ADVANCED', 'yes');
110
	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
111
} else {
112
	$template->set_var('DISPLAY_ADVANCED', 'display:none;');
113
	$template->set_var('DISPLAY_BASIC', '');
114
	$template->set_var('ADVANCED', 'no');
115
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
116
}
117
118
// Insert permissions values
119
if($admin->get_permission('groups_add') != true) {
120
	$template->set_var('DISPLAY_ADD', 'hide');
121
}
122
123
// Insert values into module list
124
$template->set_block('main_block', 'module_list_block', 'module_list');
125
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "module" AND `function` = "page" ORDER BY `name`');
126
if($result->numRows() > 0) {
127
	while($addon = $result->fetchRow()) {
128
		$template->set_var('VALUE', $addon['directory']);
129
		$template->set_var('NAME', $addon['name']);
130
		$template->parse('module_list', 'module_list_block', true);
131
	}
132
}
133
134
// Insert values into template list
135
$template->set_block('main_block', 'template_list_block', 'template_list');
136
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" ORDER BY `name`');
137
if($result->numRows() > 0) {
138
	while($addon = $result->fetchRow()) {
139
		$template->set_var('VALUE', $addon['directory']);
140
		$template->set_var('NAME', $addon['name']);
141
		$template->parse('template_list', 'template_list_block', true);
142
	}
143
}
144
145
// Insert language text and messages
146
$template->set_var(array(
147
								'TEXT_RESET' => $TEXT['RESET'],
148
								'TEXT_ACTIVE' => $TEXT['ACTIVE'],
149
								'TEXT_DISABLED' => $TEXT['DISABLED'],
150
								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
151
								'TEXT_USERNAME' => $TEXT['USERNAME'],
152
								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
153
								'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
154
								'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
155
								'TEXT_EMAIL' => $TEXT['EMAIL'],
156
								'TEXT_GROUP' => $TEXT['GROUP'],
157
								'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'],
158
								'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'],
159
								'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'],
160
								'TEXT_NAME' => $TEXT['NAME'],
161
								'SECTION_PAGES' => $MENU['PAGES'],
162
								'SECTION_MEDIA' => $MENU['MEDIA'],
163
								'SECTION_MODULES' => $MENU['MODULES'],
164
								'SECTION_TEMPLATES' => $MENU['TEMPLATES'],
165
								'SECTION_SETTINGS' => $MENU['SETTINGS'],
166
								'SECTION_LANGUAGES' => $MENU['LANGUAGES'],
167
								'SECTION_USERS' => $MENU['USERS'],
168
								'SECTION_GROUPS' => $MENU['GROUPS'],
169
								'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'],
170
								'TEXT_VIEW' => $TEXT['VIEW'],
171
								'TEXT_ADD' => $TEXT['ADD'],
172
								'TEXT_LEVEL' => $TEXT['LEVEL'],
173
								'TEXT_MODIFY' => $TEXT['MODIFY'],
174
								'TEXT_DELETE' => $TEXT['DELETE'],
175
								'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'],
176
								'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
177
								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'],
178
								'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
179
								'TEXT_RENAME' => $TEXT['RENAME'],
180
								'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
181
								'TEXT_BASIC' => $TEXT['BASIC'],
182
								'TEXT_ADVANCED' => $TEXT['ADVANCED'],
183
								'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
184
								'CHECKED' => ' checked="checked"',
185
								'ADMIN_URL' => ADMIN_URL,
186
								'WB_URL' => WB_URL,
187 1398 FrankH
								'THEME_URL' => THEME_URL,
188
								'FTAN' => $ftan
189 1386 Luisehahne
								)
190
						);
191
192
// Parse template for add group form
193
$template->parse('main', 'main_block', false);
194
$template->pparse('output', 'page');
195
196
// Print the admin footer
197
$admin->print_footer();