Project

General

Profile

1
<?php
2
/*
3
*
4
*                       About WebsiteBaker
5
*
6
* Website Baker is a PHP-based Content Management System (CMS)
7
* designed with one goal in mind: to enable its users to produce websites
8
* with ease.
9
*
10
*                       LICENSE INFORMATION
11
*
12
* WebsiteBaker is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU General Public License
14
* as published by the Free Software Foundation; either version 2
15
* of the License, or (at your option) any later version.
16
*
17
* WebsiteBaker is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
* See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
*
26
*                   WebsiteBaker Extra Information
27
*
28
*
29
*/
30
/**
31
 *
32
 * @category        admin
33
 * @package         groups
34
 * @author          WebsiteBaker Project
35
 * @copyright       2004-2009, Ryan Djurovich
36
 * @copyright       2009-2010, Website Baker Org. e.V.
37
 * @link			http://www.websitebaker2.org/
38
 * @license         http://www.gnu.org/licenses/gpl.html
39
 * @platform        WebsiteBaker 2.8.x
40
 * @requirements    PHP 4.3.4 and higher
41
 * @version         $Id: index.php 1271 2010-01-23 02:30:24Z Luisehahne $
42
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/groups/index.php $
43
 * @lastmodified    $Date: 2010-01-23 03:30:24 +0100 (Sat, 23 Jan 2010) $
44
 *
45
*/
46

    
47
// Print admin header
48
require('../../config.php');
49
require_once(WB_PATH.'/framework/class.admin.php');
50
$admin = new admin('Access', 'groups');
51

    
52
// Create new template object for the modify/remove menu
53
$template = new Template(THEME_PATH.'/templates');
54
$template->set_file('page', 'groups.htt');
55
$template->set_block('page', 'main_block', 'main');
56
$template->set_block('main_block', 'manage_users_block', 'users');
57
// insert urls
58
$template->set_var(array(
59
	'ADMIN_URL' => ADMIN_URL,
60
	'WB_URL' => WB_URL,
61
	'WB_PATH' => WB_PATH,
62
	'THEME_URL' => THEME_URL
63
	)
64
);
65

    
66
// Get existing value from database
67
$database = new database();
68
$query = "SELECT group_id,name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'";
69
$results = $database->query($query);
70
if($database->is_error()) {
71
	$admin->print_error($database->get_error(), 'index.php');
72
}
73

    
74
// Insert values into the modify/remove menu
75
$template->set_block('main_block', 'list_block', 'list');
76
if($results->numRows() > 0) {
77
	// Insert first value to say please select
78
	$template->set_var('VALUE', '');
79
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
80
	$template->parse('list', 'list_block', true);
81
	// Loop through groups
82
	while($group = $results->fetchRow()) {
83
		$template->set_var('VALUE', $group['group_id']);
84
		$template->set_var('NAME', $group['name']);
85
		$template->parse('list', 'list_block', true);
86
	}
87
} else {
88
	// Insert single value to say no groups were found
89
	$template->set_var('NAME', $TEXT['NONE_FOUND']);
90
	$template->parse('list', 'list_block', true);
91
}
92

    
93
// Insert permissions values
94
if($admin->get_permission('groups_add') != true) {
95
	$template->set_var('DISPLAY_ADD', 'hide');
96
}
97
if($admin->get_permission('groups_modify') != true) {
98
	$template->set_var('DISPLAY_MODIFY', 'hide');
99
}
100
if($admin->get_permission('groups_delete') != true) {
101
	$template->set_var('DISPLAY_DELETE', 'hide');
102
}
103

    
104
// Insert language headings
105
$template->set_var(array(
106
	'HEADING_MODIFY_DELETE_GROUP' => $HEADING['MODIFY_DELETE_GROUP'],
107
	'HEADING_ADD_GROUP' => $HEADING['ADD_GROUP']
108
	)
109
);
110
// Insert language text and messages
111
$template->set_var(array(
112
	'TEXT_MODIFY' => $TEXT['MODIFY'],
113
	'TEXT_DELETE' => $TEXT['DELETE'],
114
	'TEXT_MANAGE_USERS' => ( $admin->get_permission('users') == true ) ? $TEXT['MANAGE_USERS']: "",
115
	'CONFIRM_DELETE' => $MESSAGE['GROUPS']['CONFIRM_DELETE']
116
	)
117
);
118
if ( $admin->get_permission('users') == true ) $template->parse("users", "manage_users_block", true);
119
// Parse template object
120
$template->parse('main', 'main_block', false);
121
$template->pparse('output', 'page');
122

    
123
// Setup template for add group form
124
$template = new Template(THEME_PATH.'/templates');
125
$template->set_file('page', 'groups_form.htt');
126
$template->set_block('page', 'main_block', 'main');
127
$template->set_var('DISPLAY_EXTRA', 'display:none;');
128
$template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
129
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
130
$template->set_var('ADVANCED_ACTION', 'index.php');
131

    
132
// Tell the browser whether or not to show advanced options
133
if ( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
134
	$template->set_var('DISPLAY_ADVANCED', '');
135
	$template->set_var('DISPLAY_BASIC', 'display:none;');
136
	$template->set_var('ADVANCED', 'yes');
137
	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
138
} else {
139
	$template->set_var('DISPLAY_ADVANCED', 'display:none;');
140
	$template->set_var('DISPLAY_BASIC', '');
141
	$template->set_var('ADVANCED', 'no');
142
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
143
}
144

    
145
// Insert permissions values
146
if($admin->get_permission('groups_add') != true) {
147
	$template->set_var('DISPLAY_ADD', 'hide');
148
}
149

    
150
// Insert values into module list
151
$template->set_block('main_block', 'module_list_block', 'module_list');
152
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page'");
153
if($result->numRows() > 0) {
154
	while($addon = $result->fetchRow()) {
155
		$template->set_var('VALUE', $addon['directory']);
156
		$template->set_var('NAME', $addon['name']);
157
		$template->parse('module_list', 'module_list_block', true);
158
	}
159
}
160

    
161
// Insert values into template list
162
$template->set_block('main_block', 'template_list_block', 'template_list');
163
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
164
if($result->numRows() > 0) {
165
	while($addon = $result->fetchRow()) {
166
		$template->set_var('VALUE', $addon['directory']);
167
		$template->set_var('NAME', $addon['name']);
168
		$template->parse('template_list', 'template_list_block', true);
169
	}
170
}
171

    
172
// Insert language text and messages
173
$template->set_var(array(
174
								'TEXT_RESET' => $TEXT['RESET'],
175
								'TEXT_ACTIVE' => $TEXT['ACTIVE'],
176
								'TEXT_DISABLED' => $TEXT['DISABLED'],
177
								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
178
								'TEXT_USERNAME' => $TEXT['USERNAME'],
179
								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
180
								'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
181
								'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
182
								'TEXT_EMAIL' => $TEXT['EMAIL'],
183
								'TEXT_GROUP' => $TEXT['GROUP'],
184
								'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'],
185
								'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'],
186
								'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'],
187
								'TEXT_NAME' => $TEXT['NAME'],
188
								'SECTION_PAGES' => $MENU['PAGES'],
189
								'SECTION_MEDIA' => $MENU['MEDIA'],
190
								'SECTION_MODULES' => $MENU['MODULES'],
191
								'SECTION_TEMPLATES' => $MENU['TEMPLATES'],
192
								'SECTION_SETTINGS' => $MENU['SETTINGS'],
193
								'SECTION_LANGUAGES' => $MENU['LANGUAGES'],
194
								'SECTION_USERS' => $MENU['USERS'],
195
								'SECTION_GROUPS' => $MENU['GROUPS'],
196
								'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'],
197
								'TEXT_VIEW' => $TEXT['VIEW'],
198
								'TEXT_ADD' => $TEXT['ADD'],
199
								'TEXT_LEVEL' => $TEXT['LEVEL'],
200
								'TEXT_MODIFY' => $TEXT['MODIFY'],
201
								'TEXT_DELETE' => $TEXT['DELETE'],
202
								'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'],
203
								'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
204
								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'],
205
								'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
206
								'TEXT_RENAME' => $TEXT['RENAME'],
207
								'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
208
								'TEXT_BASIC' => $TEXT['BASIC'],
209
								'TEXT_ADVANCED' => $TEXT['ADVANCED'],
210
								'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
211
								'CHECKED' => ' checked="checked"',
212
								'ADMIN_URL' => ADMIN_URL,
213
								'WB_URL' => WB_URL,
214
								'WB_PATH' => WB_PATH,
215
								'THEME_URL' => THEME_URL
216
								)
217
						);
218

    
219
// Parse template for add group form
220
$template->parse('main', 'main_block', false);
221
$template->pparse('output', 'page');
222

    
223
// Print the admin footer
224
$admin->print_footer();
225

    
226
?>
(4-4/5)