Project

General

Profile

1
<?php
2

    
3
// $Id: index.php,v 1.5 2005/04/03 12:15:14 rdjurovich Exp $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
// Print admin header
27
require('../../config.php');
28
require_once(WB_PATH.'/framework/class.admin.php');
29
$admin = new admin('Access', 'groups');
30

    
31
// Create new template object for the modify/remove menu
32
$template = new Template(ADMIN_PATH.'/groups');
33
$template->set_file('page', 'template.html');
34
$template->set_block('page', 'main_block', 'main');
35
$template->set_var('ADMIN_URL', ADMIN_URL);
36

    
37
// Get existing value from database
38
$database = new database();
39
$query = "SELECT group_id,name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'";
40
$results = $database->query($query);
41
if($database->is_error()) {
42
	$admin->print_error($database->get_error(), 'index.php');
43
}
44

    
45
// Insert values into the modify/remove menu
46
$template->set_block('main_block', 'list_block', 'list');
47
if($results->numRows() > 0) {
48
	// Insert first value to say please select
49
	$template->set_var('VALUE', '');
50
	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
51
	$template->parse('list', 'list_block', true);
52
	// Loop through groups
53
	while($group = $results->fetchRow()) {
54
		$template->set_var('VALUE', $group['group_id']);
55
		$template->set_var('NAME', $group['name']);
56
		$template->parse('list', 'list_block', true);
57
	}
58
} else {
59
	// Insert single value to say no groups were found
60
	$template->set_var('NAME', $TEXT['NONE_FOUND']);
61
	$template->parse('list', 'list_block', true);
62
}
63

    
64
// Insert permissions values
65
if($admin->get_permission('groups_add') != true) {
66
	$template->set_var('DISPLAY_ADD', 'hide');
67
}
68
if($admin->get_permission('groups_modify') != true) {
69
	$template->set_var('DISPLAY_MODIFY', 'hide');
70
}
71
if($admin->get_permission('groups_delete') != true) {
72
	$template->set_var('DISPLAY_DELETE', 'hide');
73
}
74

    
75
// Insert language headings
76
$template->set_var(array(
77
								'HEADING_MODIFY_DELETE_GROUP' => $HEADING['MODIFY_DELETE_GROUP'],
78
								'HEADING_ADD_GROUP' => $HEADING['ADD_GROUP']
79
								)
80
						);
81
// Insert language text and messages
82
$template->set_var(array(
83
								'TEXT_MODIFY' => $TEXT['MODIFY'],
84
								'TEXT_DELETE' => $TEXT['DELETE'],
85
								'TEXT_MANAGE_USERS' => $TEXT['MANAGE_USERS'],
86
								'CONFIRM_DELETE' => $MESSAGE['GROUPS']['CONFIRM_DELETE']
87
								)
88
						);
89

    
90
// Parse template object
91
$template->parse('main', 'main_block', false);
92
$template->pparse('output', 'page');
93

    
94
// Setup template for add group form
95
$template = new Template(ADMIN_PATH.'/groups');
96
$template->set_file('page', 'group_form.html');
97
$template->set_block('page', 'main_block', 'main');
98
$template->set_var('DISPLAY_EXTRA', 'none');
99
$template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
100
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
101
$template->set_var('ADVANCED_ACTION', 'index.php');
102

    
103
// Tell the browser whether or not to show advanced options
104
if(isset($_POST['advanced']) AND $_POST['advanced'] == $TEXT['SHOW_ADVANCED'].' >>') {
105
	$template->set_var('DISPLAY_ADVANCED', '');
106
	$template->set_var('DISPLAY_BASIC', 'none');
107
	$template->set_var('ADVANCED', 'yes');
108
	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
109
} else {
110
	$template->set_var('DISPLAY_ADVANCED', 'none');
111
	$template->set_var('DISPLAY_BASIC', '');
112
	$template->set_var('ADVANCED', 'no');
113
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
114
}
115

    
116
// Insert permissions values
117
if($admin->get_permission('groups_add') != true) {
118
	$template->set_var('DISPLAY_ADD', 'hide');
119
}
120

    
121
// Insert values into module list
122
$template->set_block('main_block', 'module_list_block', 'module_list');
123
if($handle = opendir(WB_PATH.'/modules/')) {
124
	while (false !== ($file = readdir($handle))) {
125
		if($file != '.' AND $file != '..' AND $file != 'CVS' AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
126
			// Include the modules info file
127
			require(WB_PATH.'/modules/'.$file.'/info.php');
128
			$template->set_var('VALUE', $file);
129
			$template->set_var('NAME', $module_name);
130
			$template->parse('module_list', 'module_list_block', true);
131
		}
132
	}
133
}
134

    
135
// Insert values into template list
136
$template->set_block('main_block', 'template_list_block', 'template_list');
137
if($handle = opendir(WB_PATH.'/templates/')) {
138
	while (false !== ($file = readdir($handle))) {
139
		if($file != '.' AND $file != '..' AND $file != 'CVS' AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
140
			// Include the modules info file
141
			require(WB_PATH.'/templates/'.$file.'/info.php');
142
			$template->set_var('VALUE', $file);
143
			$template->set_var('NAME', $template_name);
144
			$template->parse('template_list', 'template_list_block', true);
145
		}
146
	}
147
}
148

    
149
// Insert language text and messages
150
$template->set_var(array(
151
								'TEXT_RESET' => $TEXT['RESET'],
152
								'TEXT_ACTIVE' => $TEXT['ACTIVE'],
153
								'TEXT_DISABLED' => $TEXT['DISABLED'],
154
								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
155
								'TEXT_USERNAME' => $TEXT['USERNAME'],
156
								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
157
								'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
158
								'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
159
								'TEXT_EMAIL' => $TEXT['EMAIL'],
160
								'TEXT_GROUP' => $TEXT['GROUP'],
161
								'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'],
162
								'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'],
163
								'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'],
164
								'TEXT_NAME' => $TEXT['NAME'],
165
								'SECTION_PAGES' => $MENU['PAGES'],
166
								'SECTION_MEDIA' => $MENU['MEDIA'],
167
								'SECTION_MODULES' => $MENU['MODULES'],
168
								'SECTION_TEMPLATES' => $MENU['TEMPLATES'],
169
								'SECTION_SETTINGS' => $MENU['SETTINGS'],
170
								'SECTION_LANGUAGES' => $MENU['LANGUAGES'],
171
								'SECTION_USERS' => $MENU['USERS'],
172
								'SECTION_GROUPS' => $MENU['GROUPS'],
173
								'TEXT_VIEW' => $TEXT['VIEW'],
174
								'TEXT_ADD' => $TEXT['ADD'],
175
								'TEXT_LEVEL' => $TEXT['LEVEL'],
176
								'TEXT_MODIFY' => $TEXT['MODIFY'],
177
								'TEXT_DELETE' => $TEXT['DELETE'],
178
								'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'],
179
								'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
180
								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'],
181
								'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
182
								'TEXT_RENAME' => $TEXT['RENAME'],
183
								'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
184
								'TEXT_BASIC' => $TEXT['BASIC'],
185
								'TEXT_ADVANCED' => $TEXT['ADVANCED'],
186
								'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
187
								'CHECKED' => 'checked'
188
								)
189
						);
190

    
191
// Parse template for add group form
192
$template->parse('main', 'main_block', false);
193
$template->pparse('output', 'page');
194

    
195
// Print the admin footer
196
$admin->print_footer();
197

    
198
?>
(5-5/7)