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