Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         groups
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: index.php 1529 2011-11-25 05:03:32Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/groups/index.php $
14
 * @lastmodified    $Date: 2011-11-25 06:03:32 +0100 (Fri, 25 Nov 2011) $
15
 *
16
*/
17

    
18
// Print admin header
19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
21
$admin = new admin('Access', 'groups');
22
$ftan = $admin->getFTAN();
23

    
24
// Setup template object, parse vars to it, then parse it
25
$ThemePath = realpath(WB_PATH.$admin->correct_theme_source('groups.htt'));
26
// Create new template object
27
$template = new Template($ThemePath);
28
// $template->debug = true;
29
$template->set_file('page', 'groups.htt');
30
$template->set_block('page', 'main_block', 'main');
31
$template->set_block('main_block', 'manage_users_block', 'users');
32
// insert urls
33
$template->set_var(array(
34
	'ADMIN_URL' => ADMIN_URL,
35
	'WB_URL' => WB_URL,
36
	'THEME_URL' => THEME_URL,
37
	'FTAN' => $ftan
38
	)
39
);
40

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

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

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

    
79
// Insert language headings
80
$template->set_var(array(
81
	'HEADING_MODIFY_DELETE_GROUP' => $HEADING['MODIFY_DELETE_GROUP'],
82
	'HEADING_ADD_GROUP' => $HEADING['ADD_GROUP']
83
	)
84
);
85
// Insert language text and messages
86
$template->set_var(array(
87
	'TEXT_MODIFY' => $TEXT['MODIFY'],
88
	'TEXT_DELETE' => $TEXT['DELETE'],
89
	'TEXT_MANAGE_USERS' => ( $admin->get_permission('users') == true ) ? $TEXT['MANAGE_USERS']: "",
90
	'CONFIRM_DELETE' => $MESSAGE['GROUPS']['CONFIRM_DELETE']
91
	)
92
);
93
if ( $admin->get_permission('users') == true ) $template->parse("users", "manage_users_block", true);
94
// Parse template object
95
$template->parse('main', 'main_block', false);
96
$template->pparse('output', 'page');
97

    
98
// Setup template object, parse vars to it, then parse it
99
$ThemePath = realpath(WB_PATH.$admin->correct_theme_source('groups_form.htt'));
100
// Create new template object
101
$template = new Template($ThemePath);
102
// $template->debug = true;
103
$template->set_file('page', 'groups_form.htt');
104
$template->set_block('page', 'main_block', 'main');
105
$template->set_var('DISPLAY_EXTRA', 'display:none;');
106
$template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
107
$template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
108
$template->set_var('ADVANCED_LINK', 'index.php');
109

    
110
// Tell the browser whether or not to show advanced options
111
if ( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
112
	$template->set_var('DISPLAY_ADVANCED', '');
113
	$template->set_var('DISPLAY_BASIC', 'display:none;');
114
	$template->set_var('ADVANCED', 'yes');
115
	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
116
} else {
117
	$template->set_var('DISPLAY_ADVANCED', 'display:none;');
118
	$template->set_var('DISPLAY_BASIC', '');
119
	$template->set_var('ADVANCED', 'no');
120
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
121
}
122

    
123
// Insert permissions values
124
if($admin->get_permission('groups_add') != true) {
125
	$template->set_var('DISPLAY_ADD', 'hide');
126
}
127

    
128
// Insert values into module list
129
$template->set_block('main_block', 'module_list_block', 'module_list');
130
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "module" AND `function` = "page" ORDER BY `name`');
131
if($result->numRows() > 0) {
132
	while($addon = $result->fetchRow()) {
133
		$template->set_var('VALUE', $addon['directory']);
134
		$template->set_var('NAME', $addon['name']);
135
		$template->parse('module_list', 'module_list_block', true);
136
	}
137
}
138

    
139
// Insert values into template list
140
$template->set_block('main_block', 'template_list_block', 'template_list');
141
$result = $database->query('SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" ORDER BY `name`');
142
if($result->numRows() > 0) {
143
	while($addon = $result->fetchRow()) {
144
		$template->set_var('VALUE', $addon['directory']);
145
		$template->set_var('NAME', $addon['name']);
146
		$template->parse('template_list', 'template_list_block', true);
147
	}
148
}
149

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

    
197
// Parse template for add group form
198
$template->parse('main', 'main_block', false);
199
$template->pparse('output', 'page');
200

    
201
// Print the admin footer
202
$admin->print_footer();
(4-4/5)