Revision 16
Added by stefan over 19 years ago
trunk/wb/admin/groups/get_permissions.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id: get_permissions.php,v 1.2 2005/03/27 06:54:28 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 |
// Get system permissions |
|
27 |
if($admin->get_post('advanced') != 'yes') { |
|
28 |
$system_permissions['pages'] = $admin->get_post('pages'); |
|
1 |
<?php
|
|
2 |
|
|
3 |
// $Id$
|
|
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 |
// Get system permissions
|
|
27 |
if($admin->get_post('advanced') != 'yes') {
|
|
28 |
$system_permissions['pages'] = $admin->get_post('pages');
|
|
29 | 29 |
$system_permissions['pages_view'] = $system_permissions['pages']; |
30 |
$system_permissions['pages_add'] = $system_permissions['pages']; |
|
30 |
$system_permissions['pages_add'] = $system_permissions['pages'];
|
|
31 | 31 |
$system_permissions['pages_add_l0'] = $system_permissions['pages']; |
32 | 32 |
$system_permissions['pages_settings'] = $system_permissions['pages']; |
33 |
$system_permissions['pages_modify'] = $system_permissions['pages']; |
|
33 |
$system_permissions['pages_modify'] = $system_permissions['pages'];
|
|
34 | 34 |
$system_permissions['pages_intro'] = $system_permissions['pages']; |
35 |
$system_permissions['pages_delete'] = $system_permissions['pages']; |
|
36 |
$system_permissions['media'] = $admin->get_post('media'); |
|
35 |
$system_permissions['pages_delete'] = $system_permissions['pages'];
|
|
36 |
$system_permissions['media'] = $admin->get_post('media');
|
|
37 | 37 |
$system_permissions['media_view'] = $system_permissions['media']; |
38 | 38 |
$system_permissions['media_upload'] = $system_permissions['media']; |
39 | 39 |
$system_permissions['media_rename'] = $system_permissions['media']; |
40 |
$system_permissions['media_delete'] = $system_permissions['media']; |
|
41 |
$system_permissions['media_create'] = $system_permissions['media']; |
|
42 |
if($admin->get_post('modules') != '' AND $admin->get_post('templates') != '' AND $admin->get_post('languages') != '') { |
|
43 |
$system_permissions['addons'] = 1; |
|
44 |
} else { |
|
45 |
$system_permissions['addons'] = 0; |
|
46 |
} |
|
47 |
$system_permissions['modules'] = $admin->get_post('modules'); |
|
40 |
$system_permissions['media_delete'] = $system_permissions['media'];
|
|
41 |
$system_permissions['media_create'] = $system_permissions['media'];
|
|
42 |
if($admin->get_post('modules') != '' AND $admin->get_post('templates') != '' AND $admin->get_post('languages') != '') {
|
|
43 |
$system_permissions['addons'] = 1;
|
|
44 |
} else {
|
|
45 |
$system_permissions['addons'] = 0;
|
|
46 |
}
|
|
47 |
$system_permissions['modules'] = $admin->get_post('modules');
|
|
48 | 48 |
$system_permissions['modules_view'] = $system_permissions['modules']; |
49 | 49 |
$system_permissions['modules_install'] = $system_permissions['modules']; |
50 |
$system_permissions['modules_uninstall'] = $system_permissions['modules']; |
|
51 |
$system_permissions['templates'] = $admin->get_post('templates'); |
|
50 |
$system_permissions['modules_uninstall'] = $system_permissions['modules'];
|
|
51 |
$system_permissions['templates'] = $admin->get_post('templates');
|
|
52 | 52 |
$system_permissions['templates_view'] = $system_permissions['templates']; |
53 | 53 |
$system_permissions['templates_install'] = $system_permissions['templates']; |
54 |
$system_permissions['templates_uninstall'] = $system_permissions['templates']; |
|
55 |
$system_permissions['languages'] = $admin->get_post('languages'); |
|
54 |
$system_permissions['templates_uninstall'] = $system_permissions['templates'];
|
|
55 |
$system_permissions['languages'] = $admin->get_post('languages');
|
|
56 | 56 |
$system_permissions['languages_view'] = $system_permissions['languages']; |
57 | 57 |
$system_permissions['languages_install'] = $system_permissions['languages']; |
58 |
$system_permissions['languages_uninstall'] = $system_permissions['languages']; |
|
59 |
$system_permissions['settings'] = $admin->get_post('settings'); |
|
58 |
$system_permissions['languages_uninstall'] = $system_permissions['languages'];
|
|
59 |
$system_permissions['settings'] = $admin->get_post('settings');
|
|
60 | 60 |
$system_permissions['settings_basic'] = $system_permissions['settings']; |
61 |
$system_permissions['settings_advanced'] = $system_permissions['settings']; |
|
62 |
if($admin->get_post('users') != '' AND $admin->get_post('groups') != '') { |
|
63 |
$system_permissions['access'] = 1; |
|
64 |
} else { |
|
65 |
$system_permissions['access'] = 0; |
|
66 |
} |
|
67 |
$system_permissions['users'] = $admin->get_post('users'); |
|
61 |
$system_permissions['settings_advanced'] = $system_permissions['settings'];
|
|
62 |
if($admin->get_post('users') != '' AND $admin->get_post('groups') != '') {
|
|
63 |
$system_permissions['access'] = 1;
|
|
64 |
} else {
|
|
65 |
$system_permissions['access'] = 0;
|
|
66 |
}
|
|
67 |
$system_permissions['users'] = $admin->get_post('users');
|
|
68 | 68 |
$system_permissions['users_view'] = $system_permissions['users']; |
69 | 69 |
$system_permissions['users_add'] = $system_permissions['users']; |
70 | 70 |
$system_permissions['users_modify'] = $system_permissions['users']; |
71 |
$system_permissions['users_delete'] = $system_permissions['users']; |
|
72 |
$system_permissions['groups'] = $admin->get_post('groups'); |
|
71 |
$system_permissions['users_delete'] = $system_permissions['users'];
|
|
72 |
$system_permissions['groups'] = $admin->get_post('groups');
|
|
73 | 73 |
$system_permissions['groups_view'] = $system_permissions['groups']; |
74 | 74 |
$system_permissions['groups_add'] = $system_permissions['groups']; |
75 | 75 |
$system_permissions['groups_modify'] = $system_permissions['groups']; |
76 |
$system_permissions['groups_delete'] = $system_permissions['groups']; |
|
77 |
} else { |
|
78 |
// Pages |
|
79 |
$system_permissions['pages_view'] = $admin->get_post('pages_view'); |
|
80 |
$system_permissions['pages_add'] = $admin->get_post('pages_add'); |
|
81 |
if($admin->get_post('pages_add') != 1 AND $admin->get_post('pages_add_l0') == 1) { |
|
82 |
$system_permissions['pages_add'] = $admin->get_post('pages_add_l0'); |
|
76 |
$system_permissions['groups_delete'] = $system_permissions['groups'];
|
|
77 |
} else {
|
|
78 |
// Pages
|
|
79 |
$system_permissions['pages_view'] = $admin->get_post('pages_view');
|
|
80 |
$system_permissions['pages_add'] = $admin->get_post('pages_add');
|
|
81 |
if($admin->get_post('pages_add') != 1 AND $admin->get_post('pages_add_l0') == 1) {
|
|
82 |
$system_permissions['pages_add'] = $admin->get_post('pages_add_l0');
|
|
83 | 83 |
} |
84 | 84 |
$system_permissions['pages_add_l0'] = $admin->get_post('pages_add_l0'); |
85 |
$system_permissions['pages_settings'] = $admin->get_post('pages_settings'); |
|
86 |
$system_permissions['pages_modify'] = $admin->get_post('pages_modify'); |
|
85 |
$system_permissions['pages_settings'] = $admin->get_post('pages_settings');
|
|
86 |
$system_permissions['pages_modify'] = $admin->get_post('pages_modify');
|
|
87 | 87 |
$system_permissions['pages_intro'] = $admin->get_post('pages_intro'); |
88 |
$system_permissions['pages_delete'] = $admin->get_post('pages_delete'); |
|
89 |
if($system_permissions['pages_view'] == 1 OR $system_permissions['pages_add'] == 1 OR $system_permissions['pages_settings'] == 1 OR $system_permissions['pages_modify'] == 1 OR $system_permissions['pages_intro'] == 1 OR $system_permissions['pages_delete'] == 1) { |
|
90 |
$system_permissions['pages'] = 1; |
|
91 |
} else { |
|
92 |
$system_permissions['pages'] = ''; |
|
93 |
} |
|
94 |
// Media |
|
88 |
$system_permissions['pages_delete'] = $admin->get_post('pages_delete');
|
|
89 |
if($system_permissions['pages_view'] == 1 OR $system_permissions['pages_add'] == 1 OR $system_permissions['pages_settings'] == 1 OR $system_permissions['pages_modify'] == 1 OR $system_permissions['pages_intro'] == 1 OR $system_permissions['pages_delete'] == 1) {
|
|
90 |
$system_permissions['pages'] = 1;
|
|
91 |
} else {
|
|
92 |
$system_permissions['pages'] = '';
|
|
93 |
}
|
|
94 |
// Media
|
|
95 | 95 |
$system_permissions['media_view'] = $admin->get_post('media_view'); |
96 | 96 |
$system_permissions['media_upload'] = $admin->get_post('media_upload'); |
97 | 97 |
$system_permissions['media_rename'] = $admin->get_post('media_rename'); |
98 |
$system_permissions['media_delete'] = $admin->get_post('media_delete'); |
|
99 |
$system_permissions['media_create'] = $admin->get_post('media_create'); |
|
100 |
if($system_permissions['media_view'] == 1 OR $system_permissions['media_upload'] == 1 OR $system_permissions['media_rename'] == 1 OR $system_permissions['media_delete'] == 1 OR $system_permissions['media_create'] == 1) { |
|
101 |
$system_permissions['media'] = 1; |
|
102 |
} else { |
|
103 |
$system_permissions['media'] = ''; |
|
104 |
} |
|
105 |
// Add-ons |
|
106 |
// Modules |
|
98 |
$system_permissions['media_delete'] = $admin->get_post('media_delete');
|
|
99 |
$system_permissions['media_create'] = $admin->get_post('media_create');
|
|
100 |
if($system_permissions['media_view'] == 1 OR $system_permissions['media_upload'] == 1 OR $system_permissions['media_rename'] == 1 OR $system_permissions['media_delete'] == 1 OR $system_permissions['media_create'] == 1) {
|
|
101 |
$system_permissions['media'] = 1;
|
|
102 |
} else {
|
|
103 |
$system_permissions['media'] = '';
|
|
104 |
}
|
|
105 |
// Add-ons
|
|
106 |
// Modules
|
|
107 | 107 |
$system_permissions['modules_view'] = $admin->get_post('modules_view'); |
108 | 108 |
$system_permissions['modules_install'] = $admin->get_post('modules_install'); |
109 |
$system_permissions['modules_uninstall'] = $admin->get_post('modules_uninstall'); |
|
110 |
if($system_permissions['modules_view'] == 1 OR $system_permissions['modules_install'] == 1 OR $system_permissions['modules_uninstall'] == 1) { |
|
111 |
$system_permissions['modules'] = 1; |
|
112 |
} else { |
|
113 |
$system_permissions['modules'] = ''; |
|
114 |
} |
|
115 |
// Templates |
|
109 |
$system_permissions['modules_uninstall'] = $admin->get_post('modules_uninstall');
|
|
110 |
if($system_permissions['modules_view'] == 1 OR $system_permissions['modules_install'] == 1 OR $system_permissions['modules_uninstall'] == 1) {
|
|
111 |
$system_permissions['modules'] = 1;
|
|
112 |
} else {
|
|
113 |
$system_permissions['modules'] = '';
|
|
114 |
}
|
|
115 |
// Templates
|
|
116 | 116 |
$system_permissions['templates_view'] = $admin->get_post('templates_view'); |
117 | 117 |
$system_permissions['templates_install'] = $admin->get_post('templates_install'); |
118 |
$system_permissions['templates_uninstall'] = $admin->get_post('templates_uninstall'); |
|
119 |
if($system_permissions['templates_view'] == 1 OR $system_permissions['templates_install'] == 1 OR $system_permissions['templates_uninstall'] == 1) { |
|
120 |
$system_permissions['templates'] = 1; |
|
121 |
} else { |
|
122 |
$system_permissions['templates'] = ''; |
|
123 |
} |
|
124 |
// Languages |
|
118 |
$system_permissions['templates_uninstall'] = $admin->get_post('templates_uninstall');
|
|
119 |
if($system_permissions['templates_view'] == 1 OR $system_permissions['templates_install'] == 1 OR $system_permissions['templates_uninstall'] == 1) {
|
|
120 |
$system_permissions['templates'] = 1;
|
|
121 |
} else {
|
|
122 |
$system_permissions['templates'] = '';
|
|
123 |
}
|
|
124 |
// Languages
|
|
125 | 125 |
$system_permissions['languages_view'] = $admin->get_post('languages_view'); |
126 | 126 |
$system_permissions['languages_install'] = $admin->get_post('languages_install'); |
127 |
$system_permissions['languages_uninstall'] = $admin->get_post('languages_uninstall'); |
|
128 |
if($system_permissions['languages_install'] == 1 OR $system_permissions['languages_uninstall'] == 1) { |
|
129 |
$system_permissions['languages'] = 1; |
|
130 |
} else { |
|
131 |
$system_permissions['languages'] = ''; |
|
132 |
} |
|
133 |
if($system_permissions['modules'] == 1 OR $system_permissions['templates'] == 1 OR $system_permissions['languages'] == 1) { |
|
134 |
$system_permissions['addons'] = 1; |
|
135 |
} else { |
|
136 |
$system_permissions['addons'] = ''; |
|
137 |
} |
|
138 |
// Settings |
|
127 |
$system_permissions['languages_uninstall'] = $admin->get_post('languages_uninstall');
|
|
128 |
if($system_permissions['languages_install'] == 1 OR $system_permissions['languages_uninstall'] == 1) {
|
|
129 |
$system_permissions['languages'] = 1;
|
|
130 |
} else {
|
|
131 |
$system_permissions['languages'] = '';
|
|
132 |
}
|
|
133 |
if($system_permissions['modules'] == 1 OR $system_permissions['templates'] == 1 OR $system_permissions['languages'] == 1) {
|
|
134 |
$system_permissions['addons'] = 1;
|
|
135 |
} else {
|
|
136 |
$system_permissions['addons'] = '';
|
|
137 |
}
|
|
138 |
// Settings
|
|
139 | 139 |
$system_permissions['settings_basic'] = $admin->get_post('settings_basic'); |
140 |
$system_permissions['settings_advanced'] = $admin->get_post('settings_advanced'); |
|
141 |
if($system_permissions['settings_basic'] == 1 OR $system_permissions['settings_advanced'] == 1) { |
|
142 |
$system_permissions['settings'] = 1; |
|
143 |
} else { |
|
144 |
$system_permissions['settings'] = ''; |
|
145 |
} |
|
146 |
// Access |
|
147 |
// Users |
|
140 |
$system_permissions['settings_advanced'] = $admin->get_post('settings_advanced');
|
|
141 |
if($system_permissions['settings_basic'] == 1 OR $system_permissions['settings_advanced'] == 1) {
|
|
142 |
$system_permissions['settings'] = 1;
|
|
143 |
} else {
|
|
144 |
$system_permissions['settings'] = '';
|
|
145 |
}
|
|
146 |
// Access
|
|
147 |
// Users
|
|
148 | 148 |
$system_permissions['users_view'] = $admin->get_post('users_view'); |
149 | 149 |
$system_permissions['users_add'] = $admin->get_post('users_add'); |
150 | 150 |
$system_permissions['users_modify'] = $admin->get_post('users_modify'); |
151 |
$system_permissions['users_delete'] = $admin->get_post('users_delete'); |
|
152 |
if($system_permissions['users_view'] == 1 OR $system_permissions['users_add'] == 1 OR $system_permissions['users_modify'] == 1 OR $system_permissions['users_delete'] == 1) { |
|
153 |
$system_permissions['users'] = 1; |
|
154 |
} else { |
|
155 |
$system_permissions['users'] = ''; |
|
156 |
} |
|
157 |
// Groups |
|
151 |
$system_permissions['users_delete'] = $admin->get_post('users_delete');
|
|
152 |
if($system_permissions['users_view'] == 1 OR $system_permissions['users_add'] == 1 OR $system_permissions['users_modify'] == 1 OR $system_permissions['users_delete'] == 1) {
|
|
153 |
$system_permissions['users'] = 1;
|
|
154 |
} else {
|
|
155 |
$system_permissions['users'] = '';
|
|
156 |
}
|
|
157 |
// Groups
|
|
158 | 158 |
$system_permissions['groups_view'] = $admin->get_post('groups_view'); |
159 | 159 |
$system_permissions['groups_add'] = $admin->get_post('groups_add'); |
160 | 160 |
$system_permissions['groups_modify'] = $admin->get_post('groups_modify'); |
161 |
$system_permissions['groups_delete'] = $admin->get_post('groups_delete'); |
|
162 |
if($system_permissions['groups_view'] == 1 OR $system_permissions['groups_add'] == 1 OR $system_permissions['groups_modify'] == 1 OR $system_permissions['groups_delete'] == 1) { |
|
163 |
$system_permissions['groups'] = 1; |
|
164 |
} else { |
|
165 |
$system_permissions['groups'] = ''; |
|
166 |
} |
|
167 |
if($system_permissions['users'] == 1 OR $system_permissions['groups'] == 1) { |
|
168 |
$system_permissions['access'] = 1; |
|
169 |
} else { |
|
170 |
$system_permissions['access'] = ''; |
|
171 |
} |
|
172 |
} |
|
173 |
|
|
174 |
// Implode system permissions |
|
175 |
$imploded_system_permissions = ''; |
|
176 |
foreach($system_permissions AS $name => $value) { |
|
177 |
if($value == true) { |
|
178 |
if($imploded_system_permissions == '') { |
|
179 |
$imploded_system_permissions = $name; |
|
180 |
} else { |
|
181 |
$imploded_system_permissions .= ','.$name; |
|
182 |
} |
|
183 |
} |
|
184 |
} |
|
185 |
|
|
186 |
$system_permissions = $imploded_system_permissions; |
|
187 |
|
|
188 |
// Get module permissions |
|
189 |
$module_permissions = ''; |
|
161 |
$system_permissions['groups_delete'] = $admin->get_post('groups_delete');
|
|
162 |
if($system_permissions['groups_view'] == 1 OR $system_permissions['groups_add'] == 1 OR $system_permissions['groups_modify'] == 1 OR $system_permissions['groups_delete'] == 1) {
|
|
163 |
$system_permissions['groups'] = 1;
|
|
164 |
} else {
|
|
165 |
$system_permissions['groups'] = '';
|
|
166 |
}
|
|
167 |
if($system_permissions['users'] == 1 OR $system_permissions['groups'] == 1) {
|
|
168 |
$system_permissions['access'] = 1;
|
|
169 |
} else {
|
|
170 |
$system_permissions['access'] = '';
|
|
171 |
}
|
|
172 |
}
|
|
173 |
|
|
174 |
// Implode system permissions
|
|
175 |
$imploded_system_permissions = '';
|
|
176 |
foreach($system_permissions AS $name => $value) {
|
|
177 |
if($value == true) {
|
|
178 |
if($imploded_system_permissions == '') {
|
|
179 |
$imploded_system_permissions = $name;
|
|
180 |
} else {
|
|
181 |
$imploded_system_permissions .= ','.$name;
|
|
182 |
}
|
|
183 |
}
|
|
184 |
}
|
|
185 |
|
|
186 |
$system_permissions = $imploded_system_permissions;
|
|
187 |
|
|
188 |
// Get module permissions
|
|
189 |
$module_permissions = '';
|
|
190 | 190 |
if($handle = opendir(WB_PATH.'/modules/')) { |
191 | 191 |
while (false !== ($file = readdir($handle))) { |
192 |
if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
|
|
193 |
// Include the modules info file |
|
194 |
require(WB_PATH.'/modules/'.$file.'/info.php'); |
|
195 |
// Check if it was selected to be used or not |
|
196 |
$count = 0; |
|
197 |
if(is_array($admin->get_post('module_permissions'))) { |
|
198 |
foreach($admin->get_post('module_permissions') AS $selected_name) { |
|
199 |
if($file == $selected_name) { |
|
200 |
$count = $count+1; |
|
201 |
} |
|
202 |
} |
|
203 |
} |
|
204 |
if($count == 0) { |
|
205 |
// Add unselected modules to list |
|
206 |
if($module_permissions == '') { |
|
207 |
$module_permissions = $file; |
|
208 |
} else { |
|
209 |
$module_permissions .= ','.$file; |
|
210 |
} |
|
211 |
} |
|
212 |
} |
|
213 |
} |
|
214 |
} |
|
215 |
|
|
216 |
// Get template permissions |
|
217 |
$template_permissions = ''; |
|
192 |
if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
|
|
193 |
// Include the modules info file
|
|
194 |
require(WB_PATH.'/modules/'.$file.'/info.php');
|
|
195 |
// Check if it was selected to be used or not
|
|
196 |
$count = 0;
|
|
197 |
if(is_array($admin->get_post('module_permissions'))) {
|
|
198 |
foreach($admin->get_post('module_permissions') AS $selected_name) {
|
|
199 |
if($file == $selected_name) {
|
|
200 |
$count = $count+1;
|
|
201 |
}
|
|
202 |
}
|
|
203 |
}
|
|
204 |
if($count == 0) {
|
|
205 |
// Add unselected modules to list
|
|
206 |
if($module_permissions == '') {
|
|
207 |
$module_permissions = $file;
|
|
208 |
} else {
|
|
209 |
$module_permissions .= ','.$file;
|
|
210 |
}
|
|
211 |
}
|
|
212 |
}
|
|
213 |
}
|
|
214 |
}
|
|
215 |
|
|
216 |
// Get template permissions
|
|
217 |
$template_permissions = '';
|
|
218 | 218 |
if($handle = opendir(WB_PATH.'/templates/')) { |
219 | 219 |
while (false !== ($file = readdir($handle))) { |
220 |
if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) { |
|
221 |
// Include the modules info file |
|
222 |
require(WB_PATH.'/templates/'.$file.'/info.php'); |
|
223 |
// Check if it was selected to be used or not |
|
224 |
$count = 0; |
|
225 |
if(is_array($admin->get_post('template_permissions'))) { |
|
226 |
foreach($admin->get_post('template_permissions') AS $selected_name) { |
|
227 |
if($file == $selected_name) { |
|
228 |
$count = $count+1; |
|
229 |
} |
|
230 |
} |
|
231 |
} |
|
232 |
if($count == 0) { |
|
233 |
// Add unselected modules to list |
|
234 |
if($template_permissions == '') { |
|
235 |
$template_permissions = $file; |
|
236 |
} else { |
|
237 |
$template_permissions .= ','.$file; |
|
238 |
} |
|
239 |
} |
|
240 |
} |
|
241 |
} |
|
242 |
} |
|
243 |
|
|
244 |
?> |
|
220 |
if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) { |
|
221 |
// Include the modules info file |
|
222 |
require(WB_PATH.'/templates/'.$file.'/info.php'); |
|
223 |
// Check if it was selected to be used or not |
|
224 |
$count = 0; |
|
225 |
if(is_array($admin->get_post('template_permissions'))) { |
|
226 |
foreach($admin->get_post('template_permissions') AS $selected_name) { |
|
227 |
if($file == $selected_name) { |
|
228 |
$count = $count+1; |
|
229 |
} |
|
230 |
} |
|
231 |
} |
|
232 |
if($count == 0) { |
|
233 |
// Add unselected modules to list |
|
234 |
if($template_permissions == '') { |
|
235 |
$template_permissions = $file; |
|
236 |
} else { |
|
237 |
$template_permissions .= ','.$file; |
|
238 |
} |
|
239 |
} |
|
240 |
} |
|
241 |
} |
|
242 |
} |
|
243 |
|
|
244 |
?> |
trunk/wb/admin/groups/groups.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id: groups.php,v 1.4 2005/04/02 06:25:37 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 |
// Include config file and admin class file |
|
27 |
require('../../config.php'); |
|
28 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
29 |
|
|
30 |
// Create new database object |
|
31 |
$database = new database(); |
|
32 |
|
|
33 |
if(!isset($_POST['action']) OR $_POST['action'] != "modify" AND $_POST['action'] != "delete") { |
|
34 |
header("Location: index.php"); |
|
35 |
} |
|
36 |
|
|
37 |
// Check if group group_id is a valid number and doesnt equal 1 |
|
38 |
if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) { |
|
39 |
header("Location: index.php"); |
|
40 |
} |
|
41 |
|
|
42 |
if($_POST['action'] == 'modify') { |
|
43 |
// Create new admin object |
|
44 |
$admin = new admin('Access', 'groups_modify', false); |
|
45 |
// Print header |
|
46 |
$admin->print_header(); |
|
47 |
// Get existing values |
|
48 |
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."'"); |
|
49 |
$group = $results->fetchRow(); |
|
50 |
// Setup template object |
|
51 |
$template = new Template(ADMIN_PATH.'/groups'); |
|
52 |
$template->set_file('page', 'group_form.html'); |
|
53 |
$template->set_block('page', 'main_block', 'main'); |
|
54 |
$template->set_var( array( |
|
55 |
'ACTION_URL' => ADMIN_URL.'/groups/save.php', |
|
56 |
'SUBMIT_TITLE' => $TEXT['SAVE'], |
|
57 |
'GROUP_ID' => $group['group_id'], |
|
58 |
'GROUP_NAME' => $group['name'], |
|
59 |
'ADVANCED_ACTION' => 'groups.php' |
|
60 |
) |
|
61 |
); |
|
62 |
// Tell the browser whether or not to show advanced options |
|
63 |
if(isset($_POST['advanced']) AND $_POST['advanced'] == $TEXT['SHOW_ADVANCED'].' >>') { |
|
64 |
$template->set_var('DISPLAY_ADVANCED', ''); |
|
65 |
$template->set_var('DISPLAY_BASIC', 'none'); |
|
66 |
$template->set_var('ADVANCED', 'yes'); |
|
67 |
$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']); |
|
68 |
} else { |
|
69 |
$template->set_var('DISPLAY_ADVANCED', 'none'); |
|
70 |
$template->set_var('DISPLAY_BASIC', ''); |
|
71 |
$template->set_var('ADVANCED', 'no'); |
|
72 |
$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>'); |
|
73 |
} |
|
74 |
|
|
75 |
// Explode system permissions |
|
76 |
$system_permissions = explode(',', $group['system_permissions']); |
|
77 |
// Check system permissions boxes |
|
78 |
foreach($system_permissions AS $name) { |
|
79 |
$template->set_var($name.'_checked', 'checked'); |
|
80 |
} |
|
81 |
// Explode module permissions |
|
82 |
$module_permissions = explode(',', $group['module_permissions']); |
|
83 |
// Explode template permissions |
|
84 |
$template_permissions = explode(',', $group['template_permissions']); |
|
85 |
|
|
86 |
// Insert values into module list |
|
87 |
$template->set_block('main_block', 'module_list_block', 'module_list'); |
|
1 |
<?php
|
|
2 |
|
|
3 |
// $Id$
|
|
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 |
// Include config file and admin class file
|
|
27 |
require('../../config.php');
|
|
28 |
require_once(WB_PATH.'/framework/class.admin.php');
|
|
29 |
|
|
30 |
// Create new database object
|
|
31 |
$database = new database();
|
|
32 |
|
|
33 |
if(!isset($_POST['action']) OR $_POST['action'] != "modify" AND $_POST['action'] != "delete") {
|
|
34 |
header("Location: index.php");
|
|
35 |
}
|
|
36 |
|
|
37 |
// Check if group group_id is a valid number and doesnt equal 1
|
|
38 |
if(!isset($_POST['group_id']) OR !is_numeric($_POST['group_id']) OR $_POST['group_id'] == 1) {
|
|
39 |
header("Location: index.php");
|
|
40 |
}
|
|
41 |
|
|
42 |
if($_POST['action'] == 'modify') {
|
|
43 |
// Create new admin object
|
|
44 |
$admin = new admin('Access', 'groups_modify', false);
|
|
45 |
// Print header
|
|
46 |
$admin->print_header();
|
|
47 |
// Get existing values
|
|
48 |
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."'");
|
|
49 |
$group = $results->fetchRow();
|
|
50 |
// Setup template object
|
|
51 |
$template = new Template(ADMIN_PATH.'/groups');
|
|
52 |
$template->set_file('page', 'group_form.html');
|
|
53 |
$template->set_block('page', 'main_block', 'main');
|
|
54 |
$template->set_var( array(
|
|
55 |
'ACTION_URL' => ADMIN_URL.'/groups/save.php',
|
|
56 |
'SUBMIT_TITLE' => $TEXT['SAVE'],
|
|
57 |
'GROUP_ID' => $group['group_id'],
|
|
58 |
'GROUP_NAME' => $group['name'],
|
|
59 |
'ADVANCED_ACTION' => 'groups.php'
|
|
60 |
)
|
|
61 |
);
|
|
62 |
// Tell the browser whether or not to show advanced options
|
|
63 |
if(isset($_POST['advanced']) AND $_POST['advanced'] == $TEXT['SHOW_ADVANCED'].' >>') {
|
|
64 |
$template->set_var('DISPLAY_ADVANCED', '');
|
|
65 |
$template->set_var('DISPLAY_BASIC', 'none');
|
|
66 |
$template->set_var('ADVANCED', 'yes');
|
|
67 |
$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
|
|
68 |
} else {
|
|
69 |
$template->set_var('DISPLAY_ADVANCED', 'none');
|
|
70 |
$template->set_var('DISPLAY_BASIC', '');
|
|
71 |
$template->set_var('ADVANCED', 'no');
|
|
72 |
$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
|
|
73 |
}
|
|
74 |
|
|
75 |
// Explode system permissions
|
|
76 |
$system_permissions = explode(',', $group['system_permissions']);
|
|
77 |
// Check system permissions boxes
|
|
78 |
foreach($system_permissions AS $name) {
|
|
79 |
$template->set_var($name.'_checked', 'checked');
|
|
80 |
}
|
|
81 |
// Explode module permissions
|
|
82 |
$module_permissions = explode(',', $group['module_permissions']);
|
|
83 |
// Explode template permissions
|
|
84 |
$template_permissions = explode(',', $group['template_permissions']);
|
|
85 |
|
|
86 |
// Insert values into module list
|
|
87 |
$template->set_block('main_block', 'module_list_block', 'module_list');
|
|
88 | 88 |
if ($handle = opendir(WB_PATH.'/modules/')) { |
89 | 89 |
while (false !== ($file = readdir($handle))) { |
90 |
if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
|
|
91 |
// Include the modules info file |
|
92 |
require(WB_PATH.'/modules/'.$file.'/info.php'); |
|
93 |
$template->set_var('VALUE', $file); |
|
94 |
$template->set_var('NAME', $module_name); |
|
95 |
if(!is_numeric(array_search($file, $module_permissions))) { |
|
96 |
$template->set_var('CHECKED', 'checked'); |
|
97 |
} else { |
|
98 |
$template->set_var('CHECKED', ''); |
|
99 |
} |
|
100 |
$template->parse('module_list', 'module_list_block', true); |
|
101 |
} |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
// Insert values into template list |
|
106 |
$template->set_block('main_block', 'template_list_block', 'template_list'); |
|
90 |
if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
|
|
91 |
// Include the modules info file
|
|
92 |
require(WB_PATH.'/modules/'.$file.'/info.php');
|
|
93 |
$template->set_var('VALUE', $file);
|
|
94 |
$template->set_var('NAME', $module_name);
|
|
95 |
if(!is_numeric(array_search($file, $module_permissions))) {
|
|
96 |
$template->set_var('CHECKED', 'checked');
|
|
97 |
} else {
|
|
98 |
$template->set_var('CHECKED', '');
|
|
99 |
}
|
|
100 |
$template->parse('module_list', 'module_list_block', true);
|
|
101 |
}
|
|
102 |
}
|
|
103 |
}
|
|
104 |
|
|
105 |
// Insert values into template list
|
|
106 |
$template->set_block('main_block', 'template_list_block', 'template_list');
|
|
107 | 107 |
if ($handle = opendir(WB_PATH.'/templates/')) { |
108 | 108 |
while (false !== ($file = readdir($handle))) { |
109 |
if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) { |
|
110 |
// Include the modules info file |
|
111 |
require(WB_PATH.'/templates/'.$file.'/info.php'); |
|
112 |
$template->set_var('VALUE', $file); |
|
113 |
$template->set_var('NAME', $template_name); |
|
114 |
if(!is_numeric(array_search($file, $template_permissions))) { |
|
115 |
$template->set_var('CHECKED', 'checked'); |
|
116 |
} else { |
|
117 |
$template->set_var('CHECKED', ''); |
|
118 |
} |
|
119 |
$template->parse('template_list', 'template_list_block', true); |
|
120 |
} |
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
// Insert language text and messages |
|
125 |
$template->set_var(array( |
|
126 |
'TEXT_RESET' => $TEXT['RESET'], |
|
127 |
'TEXT_ACTIVE' => $TEXT['ACTIVE'], |
|
128 |
'TEXT_DISABLED' => $TEXT['DISABLED'], |
|
129 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'], |
|
130 |
'TEXT_USERNAME' => $TEXT['USERNAME'], |
|
131 |
'TEXT_PASSWORD' => $TEXT['PASSWORD'], |
|
132 |
'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'], |
|
133 |
'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'], |
|
134 |
'TEXT_EMAIL' => $TEXT['EMAIL'], |
|
135 |
'TEXT_GROUP' => $TEXT['GROUP'], |
|
136 |
'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'], |
|
137 |
'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'], |
|
138 |
'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'], |
|
139 |
'TEXT_NAME' => $TEXT['NAME'], |
|
140 |
'SECTION_PAGES' => $MENU['PAGES'], |
|
141 |
'SECTION_MEDIA' => $MENU['MEDIA'], |
|
142 |
'SECTION_MODULES' => $MENU['MODULES'], |
|
143 |
'SECTION_TEMPLATES' => $MENU['TEMPLATES'], |
|
144 |
'SECTION_LANGUAGES' => $MENU['LANGUAGES'], |
|
145 |
'SECTION_SETTINGS' => $MENU['SETTINGS'], |
|
146 |
'SECTION_USERS' => $MENU['USERS'], |
|
147 |
'SECTION_GROUPS' => $MENU['GROUPS'], |
|
148 |
'TEXT_VIEW' => $TEXT['VIEW'], |
|
149 |
'TEXT_ADD' => $TEXT['ADD'], |
|
150 |
'TEXT_LEVEL' => $TEXT['LEVEL'], |
|
151 |
'TEXT_MODIFY' => $TEXT['MODIFY'], |
|
152 |
'TEXT_DELETE' => $TEXT['DELETE'], |
|
153 |
'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'], |
|
154 |
'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'], |
|
155 |
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'], |
|
156 |
'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'], |
|
157 |
'TEXT_RENAME' => $TEXT['RENAME'], |
|
158 |
'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'], |
|
159 |
'TEXT_BASIC' => $TEXT['BASIC'], |
|
160 |
'TEXT_ADVANCED' => $TEXT['ADVANCED'], |
|
161 |
'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'] |
|
162 |
) |
|
163 |
); |
|
164 |
|
|
165 |
// Parse template object |
|
166 |
$template->parse('main', 'main_block', false); |
|
167 |
$template->pparse('output', 'page'); |
|
168 |
} elseif($_POST['action'] == 'delete') { |
|
169 |
// Create new admin object |
|
170 |
$admin = new admin('Access', 'groups_delete', false); |
|
171 |
// Print header |
|
172 |
$admin->print_header(); |
|
173 |
// Delete the group |
|
174 |
$database->query("DELETE FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."' LIMIT 1"); |
|
175 |
if($database->is_error()) { |
|
176 |
$admin->print_error($database->get_error()); |
|
177 |
} else { |
|
178 |
// Delete users in the group |
|
179 |
$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE group_id = '".$_POST['group_id']."'"); |
|
180 |
if($database->is_error()) { |
|
181 |
$admin->print_error($database->get_error()); |
|
182 |
} else { |
|
183 |
$admin->print_success($MESSAGE['GROUPS']['DELETED']); |
|
184 |
} |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
// Print admin footer |
|
189 |
$admin->print_footer(); |
|
190 |
|
|
191 |
?> |
|
109 |
if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) { |
|
110 |
// Include the modules info file |
|
111 |
require(WB_PATH.'/templates/'.$file.'/info.php'); |
|
112 |
$template->set_var('VALUE', $file); |
|
113 |
$template->set_var('NAME', $template_name); |
|
114 |
if(!is_numeric(array_search($file, $template_permissions))) { |
|
115 |
$template->set_var('CHECKED', 'checked'); |
|
116 |
} else { |
|
117 |
$template->set_var('CHECKED', ''); |
|
118 |
} |
|
119 |
$template->parse('template_list', 'template_list_block', true); |
|
120 |
} |
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
// Insert language text and messages |
|
125 |
$template->set_var(array( |
|
126 |
'TEXT_RESET' => $TEXT['RESET'], |
|
127 |
'TEXT_ACTIVE' => $TEXT['ACTIVE'], |
|
128 |
'TEXT_DISABLED' => $TEXT['DISABLED'], |
|
129 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'], |
|
130 |
'TEXT_USERNAME' => $TEXT['USERNAME'], |
|
131 |
'TEXT_PASSWORD' => $TEXT['PASSWORD'], |
|
132 |
'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'], |
|
133 |
'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'], |
|
134 |
'TEXT_EMAIL' => $TEXT['EMAIL'], |
|
135 |
'TEXT_GROUP' => $TEXT['GROUP'], |
|
136 |
'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'], |
|
137 |
'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'], |
|
138 |
'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'], |
|
139 |
'TEXT_NAME' => $TEXT['NAME'], |
|
140 |
'SECTION_PAGES' => $MENU['PAGES'], |
|
141 |
'SECTION_MEDIA' => $MENU['MEDIA'], |
|
142 |
'SECTION_MODULES' => $MENU['MODULES'], |
|
143 |
'SECTION_TEMPLATES' => $MENU['TEMPLATES'], |
|
144 |
'SECTION_LANGUAGES' => $MENU['LANGUAGES'], |
|
145 |
'SECTION_SETTINGS' => $MENU['SETTINGS'], |
|
146 |
'SECTION_USERS' => $MENU['USERS'], |
|
147 |
'SECTION_GROUPS' => $MENU['GROUPS'], |
|
148 |
'TEXT_VIEW' => $TEXT['VIEW'], |
|
149 |
'TEXT_ADD' => $TEXT['ADD'], |
|
150 |
'TEXT_LEVEL' => $TEXT['LEVEL'], |
|
151 |
'TEXT_MODIFY' => $TEXT['MODIFY'], |
|
152 |
'TEXT_DELETE' => $TEXT['DELETE'], |
|
153 |
'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'], |
|
154 |
'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'], |
|
155 |
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'], |
|
156 |
'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'], |
|
157 |
'TEXT_RENAME' => $TEXT['RENAME'], |
|
158 |
'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'], |
|
159 |
'TEXT_BASIC' => $TEXT['BASIC'], |
|
160 |
'TEXT_ADVANCED' => $TEXT['ADVANCED'], |
|
161 |
'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'] |
|
162 |
) |
|
163 |
); |
|
164 |
|
|
165 |
// Parse template object |
|
166 |
$template->parse('main', 'main_block', false); |
|
167 |
$template->pparse('output', 'page'); |
|
168 |
} elseif($_POST['action'] == 'delete') { |
|
169 |
// Create new admin object |
|
170 |
$admin = new admin('Access', 'groups_delete', false); |
|
171 |
// Print header |
|
172 |
$admin->print_header(); |
|
173 |
// Delete the group |
|
174 |
$database->query("DELETE FROM ".TABLE_PREFIX."groups WHERE group_id = '".$_POST['group_id']."' LIMIT 1"); |
|
175 |
if($database->is_error()) { |
|
176 |
$admin->print_error($database->get_error()); |
|
177 |
} else { |
|
178 |
// Delete users in the group |
|
179 |
$database->query("DELETE FROM ".TABLE_PREFIX."users WHERE group_id = '".$_POST['group_id']."'"); |
|
180 |
if($database->is_error()) { |
|
181 |
$admin->print_error($database->get_error()); |
|
182 |
} else { |
|
183 |
$admin->print_success($MESSAGE['GROUPS']['DELETED']); |
|
184 |
} |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
// Print admin footer |
|
189 |
$admin->print_footer(); |
|
190 |
|
|
191 |
?> |
trunk/wb/admin/groups/index.php | ||
---|---|---|
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'); |
|
1 |
<?php
|
|
2 |
|
|
3 |
// $Id$
|
|
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 | 123 |
if($handle = opendir(WB_PATH.'/modules/')) { |
124 | 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'); |
|
125 |
if($file != '.' AND $file != '..' AND $file != '.svn' 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 | 137 |
if($handle = opendir(WB_PATH.'/templates/')) { |
138 | 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 |
?> |
|
139 |
if($file != '.' AND $file != '..' AND $file != '.svn' 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 |
?> |
trunk/wb/admin/languages/index.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id: index.php,v 1.2 2005/04/02 06:25:37 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('Addons', 'languages'); |
|
30 |
|
|
31 |
// Setup template object |
|
32 |
$template = new Template(ADMIN_PATH.'/languages'); |
|
33 |
$template->set_file('page', 'template.html'); |
|
34 |
$template->set_block('page', 'main_block', 'main'); |
|
35 |
|
|
36 |
// Insert values into language list |
|
37 |
$template->set_block('main_block', 'language_list_block', 'language_list'); |
|
1 |
<?php
|
|
2 |
|
|
3 |
// $Id$
|
|
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('Addons', 'languages');
|
|
30 |
|
|
31 |
// Setup template object
|
|
32 |
$template = new Template(ADMIN_PATH.'/languages');
|
|
33 |
$template->set_file('page', 'template.html');
|
|
34 |
$template->set_block('page', 'main_block', 'main');
|
|
35 |
|
|
36 |
// Insert values into language list
|
|
37 |
$template->set_block('main_block', 'language_list_block', 'language_list');
|
|
38 | 38 |
if ($handle = opendir(WB_PATH.'/languages/')) { |
39 | 39 |
while (false !== ($file = readdir($handle))) { |
40 |
if($file != '.' AND $file != '..' AND $file != 'CVS' AND $file != 'index.php') { |
|
41 |
// Include the languages info file |
|
42 |
require(WB_PATH.'/languages/'.$file); |
|
43 |
$template->set_var('VALUE', $language_code); |
|
44 |
$template->set_var('NAME', $language_name.' ('.$language_code.')'); |
|
45 |
$template->parse('language_list', 'language_list_block', true); |
|
46 |
} |
|
47 |
} |
|
48 |
// Restore language to original file |
|
49 |
require(WB_PATH.'/languages/'.LANGUAGE.'.php'); |
|
50 |
} |
|
51 |
|
|
52 |
// Insert permissions values |
|
53 |
if($admin->get_permission('languages_install') != true) { |
|
54 |
$template->set_var('DISPLAY_INSTALL', 'hide'); |
|
55 |
} |
|
56 |
if($admin->get_permission('languages_uninstall') != true) { |
|
57 |
$template->set_var('DISPLAY_UNINSTALL', 'hide'); |
|
58 |
} |
|
59 |
if($admin->get_permission('languages_view') != true) { |
|
60 |
$template->set_var('DISPLAY_LIST', 'hide'); |
|
61 |
} |
|
62 |
|
|
63 |
// Insert language headings |
|
64 |
$template->set_var(array( |
|
65 |
'HEADING_INSTALL_LANGUAGE' => $HEADING['INSTALL_LANGUAGE'], |
|
66 |
'HEADING_UNINSTALL_LANGUAGE' => $HEADING['UNINSTALL_LANGUAGE'], |
|
67 |
'HEADING_LANGUAGE_DETAILS' => $HEADING['LANGUAGE_DETAILS'] |
|
68 |
) |
|
69 |
); |
|
70 |
// Insert language text and messages |
|
71 |
$template->set_var(array( |
|
72 |
'TEXT_INSTALL' => $TEXT['INSTALL'], |
|
73 |
'TEXT_UNINSTALL' => $TEXT['UNINSTALL'], |
|
74 |
'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'], |
|
75 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'] |
|
76 |
) |
|
77 |
); |
|
78 |
|
|
79 |
// Parse template object |
|
80 |
$template->parse('main', 'main_block', false); |
|
81 |
$template->pparse('output', 'page'); |
|
82 |
|
|
83 |
// Print admin footer |
|
84 |
$admin->print_footer(); |
|
85 |
|
|
86 |
?> |
|
40 |
if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'index.php') { |
|
41 |
// Include the languages info file |
|
42 |
require(WB_PATH.'/languages/'.$file); |
|
43 |
$template->set_var('VALUE', $language_code); |
|
44 |
$template->set_var('NAME', $language_name.' ('.$language_code.')'); |
|
45 |
$template->parse('language_list', 'language_list_block', true); |
|
46 |
} |
|
47 |
} |
|
48 |
// Restore language to original file |
|
49 |
require(WB_PATH.'/languages/'.LANGUAGE.'.php'); |
|
50 |
} |
|
51 |
|
|
52 |
// Insert permissions values |
|
53 |
if($admin->get_permission('languages_install') != true) { |
|
54 |
$template->set_var('DISPLAY_INSTALL', 'hide'); |
|
55 |
} |
|
56 |
if($admin->get_permission('languages_uninstall') != true) { |
|
57 |
$template->set_var('DISPLAY_UNINSTALL', 'hide'); |
|
58 |
} |
|
59 |
if($admin->get_permission('languages_view') != true) { |
|
60 |
$template->set_var('DISPLAY_LIST', 'hide'); |
|
61 |
} |
|
62 |
|
|
63 |
// Insert language headings |
|
64 |
$template->set_var(array( |
|
65 |
'HEADING_INSTALL_LANGUAGE' => $HEADING['INSTALL_LANGUAGE'], |
|
66 |
'HEADING_UNINSTALL_LANGUAGE' => $HEADING['UNINSTALL_LANGUAGE'], |
|
67 |
'HEADING_LANGUAGE_DETAILS' => $HEADING['LANGUAGE_DETAILS'] |
|
68 |
) |
|
69 |
); |
|
70 |
// Insert language text and messages |
|
71 |
$template->set_var(array( |
|
72 |
'TEXT_INSTALL' => $TEXT['INSTALL'], |
|
73 |
'TEXT_UNINSTALL' => $TEXT['UNINSTALL'], |
|
74 |
'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'], |
|
75 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'] |
|
76 |
) |
|
77 |
); |
|
78 |
|
|
79 |
// Parse template object |
|
80 |
$template->parse('main', 'main_block', false); |
|
81 |
$template->pparse('output', 'page'); |
|
82 |
|
|
83 |
// Print admin footer |
|
84 |
$admin->print_footer(); |
|
85 |
|
|
86 |
?> |
trunk/wb/account/forgot.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 |
// $Id: forgot.php,v 1.4 2005/04/02 06:25:37 rdjurovich Exp $
|
|
3 |
// $Id$ |
|
4 | 4 |
|
5 | 5 |
/* |
6 | 6 |
|
... | ... | |
25 | 25 |
|
26 | 26 |
require('../config.php'); |
27 | 27 |
|
28 |
// Start a session |
|
29 |
if(!defined('SESSION_STARTED')) { |
|
30 |
session_name(APP_NAME.'_session_id'); |
|
31 |
session_start(); |
|
32 |
define('SESSION_STARTED', true); |
|
33 |
} |
|
34 |
|
|
35 |
// Get users language if it is not already set |
|
36 |
if(!defined('LANGUAGE')) { |
|
37 |
if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') { |
|
38 |
define('LANGUAGE', $_SESSION['LANGUAGE']); |
|
39 |
} else { |
|
40 |
define('LANGUAGE', DEFAULT_LANGUAGE); |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
// Load the language file |
|
45 |
if(!defined('LANGUAGE_LOADED')) { |
|
46 |
if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) { |
|
47 |
exit('Error loading language file '.LANGUAGE.', please check configuration'); |
|
48 |
} else { |
|
49 |
require_once(WB_PATH.'/languages/'.LANGUAGE.'.php'); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 | 28 |
// Required page details |
54 | 29 |
$page_id = 0; |
55 | 30 |
$page_description = ''; |
... | ... | |
75 | 50 |
// Include the index (wrapper) file |
76 | 51 |
require(WB_PATH.'/index.php'); |
77 | 52 |
|
78 |
?> |
|
53 |
?> |
trunk/wb/account/preferences.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 |
// $Id: preferences.php,v 1.4 2005/04/02 06:25:37 rdjurovich Exp $
|
|
3 |
// $Id$ |
|
4 | 4 |
|
5 | 5 |
/* |
6 | 6 |
|
... | ... | |
25 | 25 |
|
26 | 26 |
require('../config.php'); |
27 | 27 |
|
28 |
// Start a session |
|
29 |
if(!defined('SESSION_STARTED')) { |
|
30 |
session_name(APP_NAME.'_session_id'); |
|
31 |
session_start(); |
|
32 |
define('SESSION_STARTED', true); |
|
33 |
} |
|
34 |
|
|
35 |
// Get users language if it is not already set |
|
36 |
if(!defined('LANGUAGE')) { |
|
37 |
if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') { |
|
38 |
define('LANGUAGE', $_SESSION['LANGUAGE']); |
|
39 |
} else { |
|
40 |
define('LANGUAGE', DEFAULT_LANGUAGE); |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
// Load the language file |
|
45 |
if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) { |
|
46 |
exit('Error loading language file '.LANGUAGE.', please check configuration'); |
|
47 |
} else { |
|
48 |
require_once(WB_PATH.'/languages/'.LANGUAGE.'.php'); |
|
49 |
} |
|
50 |
|
|
51 | 28 |
// Required page details |
52 | 29 |
$page_id = 0; |
53 | 30 |
$page_description = ''; |
Also available in: Unified diff
Reduced redundant initialization code, removed further 'CVS' occurrences. Made $admin accessible in page_content function.