Project

General

Profile

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

    
61
// Print admin header
62
require('../../config.php');
63
require_once(WB_PATH.'/framework/class.admin.php');
64
$admin = new admin('Access', 'groups');
65

    
66
// Create new template object for the modify/remove menu
67
$template = new Template(THEME_PATH.'/templates');
68
$template->set_file('page', 'groups.htt');
69
$template->set_block('page', 'main_block', 'main');
70
$template->set_block('main_block', 'manage_users_block', 'users');
71
// insert urls
72
$template->set_var(array(
73
	'ADMIN_URL' => ADMIN_URL,
74
	'WB_URL' => WB_URL,
75
	'WB_PATH' => WB_PATH,
76
	'THEME_URL' => THEME_URL
77
	)
78
);
79

    
80
// Get existing value from database
81
$database = new database();
82
$query = "SELECT group_id,name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'";
83
$results = $database->query($query);
84
if($database->is_error()) {
85
	$admin->print_error($database->get_error(), 'index.php');
86
}
87

    
88
// Insert values into the modify/remove menu
89
$template->set_block('main_block', 'list_block', 'list');
90
if($results->numRows() > 0) {
91
	// Insert first value to say please select
92
	$template->set_var('VALUE', '');
93
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
94
	$template->parse('list', 'list_block', true);
95
	// Loop through groups
96
	while($group = $results->fetchRow()) {
97
		$template->set_var('VALUE', $group['group_id']);
98
		$template->set_var('NAME', $group['name']);
99
		$template->parse('list', 'list_block', true);
100
	}
101
} else {
102
	// Insert single value to say no groups were found
103
	$template->set_var('NAME', $TEXT['NONE_FOUND']);
104
	$template->parse('list', 'list_block', true);
105
}
106

    
107
// Insert permissions values
108
if($admin->get_permission('groups_add') != true) {
109
	$template->set_var('DISPLAY_ADD', 'hide');
110
}
111
if($admin->get_permission('groups_modify') != true) {
112
	$template->set_var('DISPLAY_MODIFY', 'hide');
113
}
114
if($admin->get_permission('groups_delete') != true) {
115
	$template->set_var('DISPLAY_DELETE', 'hide');
116
}
117

    
118
// Insert language headings
119
$template->set_var(array(
120
	'HEADING_MODIFY_DELETE_GROUP' => $HEADING['MODIFY_DELETE_GROUP'],
121
	'HEADING_ADD_GROUP' => $HEADING['ADD_GROUP']
122
	)
123
);
124
// Insert language text and messages
125
$template->set_var(array(
126
	'TEXT_MODIFY' => $TEXT['MODIFY'],
127
	'TEXT_DELETE' => $TEXT['DELETE'],
128
	'TEXT_MANAGE_USERS' => ( $admin->get_permission('users') == true ) ? $TEXT['MANAGE_USERS']: "",
129
	'CONFIRM_DELETE' => $MESSAGE['GROUPS']['CONFIRM_DELETE']
130
	)
131
);
132
if ( $admin->get_permission('users') == true ) $template->parse("users", "manage_users_block", true);
133
// Parse template object
134
$template->parse('main', 'main_block', false);
135
$template->pparse('output', 'page');
136

    
137
// Setup template for add group form
138
$template = new Template(THEME_PATH.'/templates');
139
$template->set_file('page', 'groups_form.htt');
140
$template->set_block('page', 'main_block', 'main');
141
$template->set_var('DISPLAY_EXTRA', 'display:none;');
142
$template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
143
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
144
$template->set_var('ADVANCED_ACTION', 'index.php');
145

    
146
// Tell the browser whether or not to show advanced options
147
if ( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
148
	$template->set_var('DISPLAY_ADVANCED', '');
149
	$template->set_var('DISPLAY_BASIC', 'display:none;');
150
	$template->set_var('ADVANCED', 'yes');
151
	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
152
} else {
153
	$template->set_var('DISPLAY_ADVANCED', 'display:none;');
154
	$template->set_var('DISPLAY_BASIC', '');
155
	$template->set_var('ADVANCED', 'no');
156
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
157
}
158

    
159
// Insert permissions values
160
if($admin->get_permission('groups_add') != true) {
161
	$template->set_var('DISPLAY_ADD', 'hide');
162
}
163

    
164
// Insert values into module list
165
$template->set_block('main_block', 'module_list_block', 'module_list');
166
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page'");
167
if($result->numRows() > 0) {
168
	while($addon = $result->fetchRow()) {
169
		$template->set_var('VALUE', $addon['directory']);
170
		$template->set_var('NAME', $addon['name']);
171
		$template->parse('module_list', 'module_list_block', true);
172
	}
173
}
174

    
175
// Insert values into template list
176
$template->set_block('main_block', 'template_list_block', 'template_list');
177
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
178
if($result->numRows() > 0) {
179
	while($addon = $result->fetchRow()) {
180
		$template->set_var('VALUE', $addon['directory']);
181
		$template->set_var('NAME', $addon['name']);
182
		$template->parse('template_list', 'template_list_block', true);
183
	}
184
}
185

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

    
233
// Parse template for add group form
234
$template->parse('main', 'main_block', false);
235
$template->pparse('output', 'page');
236

    
237
// Print the admin footer
238
$admin->print_footer();
239

    
240
?>
(4-4/5)