1 |
238
|
stefan
|
<?php
|
2 |
|
|
|
3 |
|
|
// $Id$
|
4 |
|
|
|
5 |
|
|
/*
|
6 |
|
|
|
7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
8 |
519
|
Ruebenwurz
|
Copyright (C) 2004-2008, Ryan Djurovich
|
9 |
238
|
stefan
|
|
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 |
|
|
if(!defined('WB_PATH')) { exit('Direct access to this file is not allowed'); }
|
27 |
|
|
|
28 |
|
|
// Get system permissions
|
29 |
|
|
if($admin->get_post('advanced') != 'yes') {
|
30 |
|
|
$system_permissions['pages'] = $admin->get_post('pages');
|
31 |
|
|
$system_permissions['pages_view'] = $system_permissions['pages'];
|
32 |
|
|
$system_permissions['pages_add'] = $system_permissions['pages'];
|
33 |
|
|
$system_permissions['pages_add_l0'] = $system_permissions['pages'];
|
34 |
|
|
$system_permissions['pages_settings'] = $system_permissions['pages'];
|
35 |
|
|
$system_permissions['pages_modify'] = $system_permissions['pages'];
|
36 |
|
|
$system_permissions['pages_intro'] = $system_permissions['pages'];
|
37 |
|
|
$system_permissions['pages_delete'] = $system_permissions['pages'];
|
38 |
|
|
$system_permissions['media'] = $admin->get_post('media');
|
39 |
|
|
$system_permissions['media_view'] = $system_permissions['media'];
|
40 |
|
|
$system_permissions['media_upload'] = $system_permissions['media'];
|
41 |
|
|
$system_permissions['media_rename'] = $system_permissions['media'];
|
42 |
|
|
$system_permissions['media_delete'] = $system_permissions['media'];
|
43 |
|
|
$system_permissions['media_create'] = $system_permissions['media'];
|
44 |
|
|
if($admin->get_post('modules') != '' OR $admin->get_post('templates') != '' OR $admin->get_post('languages') != '') {
|
45 |
|
|
$system_permissions['addons'] = 1;
|
46 |
|
|
} else {
|
47 |
|
|
$system_permissions['addons'] = 0;
|
48 |
|
|
}
|
49 |
|
|
$system_permissions['modules'] = $admin->get_post('modules');
|
50 |
|
|
$system_permissions['modules_view'] = $system_permissions['modules'];
|
51 |
|
|
$system_permissions['modules_install'] = $system_permissions['modules'];
|
52 |
|
|
$system_permissions['modules_uninstall'] = $system_permissions['modules'];
|
53 |
|
|
$system_permissions['templates'] = $admin->get_post('templates');
|
54 |
|
|
$system_permissions['templates_view'] = $system_permissions['templates'];
|
55 |
|
|
$system_permissions['templates_install'] = $system_permissions['templates'];
|
56 |
|
|
$system_permissions['templates_uninstall'] = $system_permissions['templates'];
|
57 |
|
|
$system_permissions['languages'] = $admin->get_post('languages');
|
58 |
|
|
$system_permissions['languages_view'] = $system_permissions['languages'];
|
59 |
|
|
$system_permissions['languages_install'] = $system_permissions['languages'];
|
60 |
|
|
$system_permissions['languages_uninstall'] = $system_permissions['languages'];
|
61 |
|
|
$system_permissions['settings'] = $admin->get_post('settings');
|
62 |
|
|
$system_permissions['settings_basic'] = $system_permissions['settings'];
|
63 |
|
|
$system_permissions['settings_advanced'] = $system_permissions['settings'];
|
64 |
|
|
if($admin->get_post('users') != '' AND $admin->get_post('groups') != '') {
|
65 |
|
|
$system_permissions['access'] = 1;
|
66 |
|
|
} else {
|
67 |
|
|
$system_permissions['access'] = 0;
|
68 |
|
|
}
|
69 |
|
|
$system_permissions['users'] = $admin->get_post('users');
|
70 |
|
|
$system_permissions['users_view'] = $system_permissions['users'];
|
71 |
|
|
$system_permissions['users_add'] = $system_permissions['users'];
|
72 |
|
|
$system_permissions['users_modify'] = $system_permissions['users'];
|
73 |
|
|
$system_permissions['users_delete'] = $system_permissions['users'];
|
74 |
|
|
$system_permissions['groups'] = $admin->get_post('groups');
|
75 |
|
|
$system_permissions['groups_view'] = $system_permissions['groups'];
|
76 |
|
|
$system_permissions['groups_add'] = $system_permissions['groups'];
|
77 |
|
|
$system_permissions['groups_modify'] = $system_permissions['groups'];
|
78 |
|
|
$system_permissions['groups_delete'] = $system_permissions['groups'];
|
79 |
|
|
} else {
|
80 |
|
|
// Pages
|
81 |
|
|
$system_permissions['pages_view'] = $admin->get_post('pages_view');
|
82 |
|
|
$system_permissions['pages_add'] = $admin->get_post('pages_add');
|
83 |
|
|
if($admin->get_post('pages_add') != 1 AND $admin->get_post('pages_add_l0') == 1) {
|
84 |
|
|
$system_permissions['pages_add'] = $admin->get_post('pages_add_l0');
|
85 |
|
|
}
|
86 |
|
|
$system_permissions['pages_add_l0'] = $admin->get_post('pages_add_l0');
|
87 |
|
|
$system_permissions['pages_settings'] = $admin->get_post('pages_settings');
|
88 |
|
|
$system_permissions['pages_modify'] = $admin->get_post('pages_modify');
|
89 |
|
|
$system_permissions['pages_intro'] = $admin->get_post('pages_intro');
|
90 |
|
|
$system_permissions['pages_delete'] = $admin->get_post('pages_delete');
|
91 |
|
|
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) {
|
92 |
|
|
$system_permissions['pages'] = 1;
|
93 |
|
|
} else {
|
94 |
|
|
$system_permissions['pages'] = '';
|
95 |
|
|
}
|
96 |
|
|
// Media
|
97 |
|
|
$system_permissions['media_view'] = $admin->get_post('media_view');
|
98 |
|
|
$system_permissions['media_upload'] = $admin->get_post('media_upload');
|
99 |
|
|
$system_permissions['media_rename'] = $admin->get_post('media_rename');
|
100 |
|
|
$system_permissions['media_delete'] = $admin->get_post('media_delete');
|
101 |
|
|
$system_permissions['media_create'] = $admin->get_post('media_create');
|
102 |
|
|
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) {
|
103 |
|
|
$system_permissions['media'] = 1;
|
104 |
|
|
} else {
|
105 |
|
|
$system_permissions['media'] = '';
|
106 |
|
|
}
|
107 |
|
|
// Add-ons
|
108 |
|
|
// Modules
|
109 |
|
|
$system_permissions['modules_view'] = $admin->get_post('modules_view');
|
110 |
|
|
$system_permissions['modules_install'] = $admin->get_post('modules_install');
|
111 |
|
|
$system_permissions['modules_uninstall'] = $admin->get_post('modules_uninstall');
|
112 |
|
|
if($system_permissions['modules_view'] == 1 OR $system_permissions['modules_install'] == 1 OR $system_permissions['modules_uninstall'] == 1) {
|
113 |
|
|
$system_permissions['modules'] = 1;
|
114 |
|
|
} else {
|
115 |
|
|
$system_permissions['modules'] = '';
|
116 |
|
|
}
|
117 |
|
|
// Templates
|
118 |
|
|
$system_permissions['templates_view'] = $admin->get_post('templates_view');
|
119 |
|
|
$system_permissions['templates_install'] = $admin->get_post('templates_install');
|
120 |
|
|
$system_permissions['templates_uninstall'] = $admin->get_post('templates_uninstall');
|
121 |
|
|
if($system_permissions['templates_view'] == 1 OR $system_permissions['templates_install'] == 1 OR $system_permissions['templates_uninstall'] == 1) {
|
122 |
|
|
$system_permissions['templates'] = 1;
|
123 |
|
|
} else {
|
124 |
|
|
$system_permissions['templates'] = '';
|
125 |
|
|
}
|
126 |
|
|
// Languages
|
127 |
|
|
$system_permissions['languages_view'] = $admin->get_post('languages_view');
|
128 |
|
|
$system_permissions['languages_install'] = $admin->get_post('languages_install');
|
129 |
|
|
$system_permissions['languages_uninstall'] = $admin->get_post('languages_uninstall');
|
130 |
|
|
if($system_permissions['languages_install'] == 1 OR $system_permissions['languages_uninstall'] == 1) {
|
131 |
|
|
$system_permissions['languages'] = 1;
|
132 |
|
|
} else {
|
133 |
|
|
$system_permissions['languages'] = '';
|
134 |
|
|
}
|
135 |
|
|
if($system_permissions['modules'] == 1 OR $system_permissions['templates'] == 1 OR $system_permissions['languages'] == 1) {
|
136 |
|
|
$system_permissions['addons'] = 1;
|
137 |
|
|
} else {
|
138 |
|
|
$system_permissions['addons'] = '';
|
139 |
|
|
}
|
140 |
|
|
// Settings
|
141 |
|
|
$system_permissions['settings_basic'] = $admin->get_post('settings_basic');
|
142 |
|
|
$system_permissions['settings_advanced'] = $admin->get_post('settings_advanced');
|
143 |
|
|
if($system_permissions['settings_basic'] == 1 OR $system_permissions['settings_advanced'] == 1) {
|
144 |
|
|
$system_permissions['settings'] = 1;
|
145 |
|
|
} else {
|
146 |
|
|
$system_permissions['settings'] = '';
|
147 |
|
|
}
|
148 |
|
|
// Access
|
149 |
|
|
// Users
|
150 |
|
|
$system_permissions['users_view'] = $admin->get_post('users_view');
|
151 |
|
|
$system_permissions['users_add'] = $admin->get_post('users_add');
|
152 |
|
|
$system_permissions['users_modify'] = $admin->get_post('users_modify');
|
153 |
|
|
$system_permissions['users_delete'] = $admin->get_post('users_delete');
|
154 |
|
|
if($system_permissions['users_view'] == 1 OR $system_permissions['users_add'] == 1 OR $system_permissions['users_modify'] == 1 OR $system_permissions['users_delete'] == 1) {
|
155 |
|
|
$system_permissions['users'] = 1;
|
156 |
|
|
} else {
|
157 |
|
|
$system_permissions['users'] = '';
|
158 |
|
|
}
|
159 |
|
|
// Groups
|
160 |
|
|
$system_permissions['groups_view'] = $admin->get_post('groups_view');
|
161 |
|
|
$system_permissions['groups_add'] = $admin->get_post('groups_add');
|
162 |
|
|
$system_permissions['groups_modify'] = $admin->get_post('groups_modify');
|
163 |
|
|
$system_permissions['groups_delete'] = $admin->get_post('groups_delete');
|
164 |
|
|
if($system_permissions['groups_view'] == 1 OR $system_permissions['groups_add'] == 1 OR $system_permissions['groups_modify'] == 1 OR $system_permissions['groups_delete'] == 1) {
|
165 |
|
|
$system_permissions['groups'] = 1;
|
166 |
|
|
} else {
|
167 |
|
|
$system_permissions['groups'] = '';
|
168 |
|
|
}
|
169 |
|
|
if($system_permissions['users'] == 1 OR $system_permissions['groups'] == 1) {
|
170 |
|
|
$system_permissions['access'] = 1;
|
171 |
|
|
} else {
|
172 |
|
|
$system_permissions['access'] = '';
|
173 |
|
|
}
|
174 |
|
|
}
|
175 |
|
|
|
176 |
|
|
// Implode system permissions
|
177 |
|
|
$imploded_system_permissions = '';
|
178 |
|
|
foreach($system_permissions AS $name => $value) {
|
179 |
|
|
if($value == true) {
|
180 |
|
|
if($imploded_system_permissions == '') {
|
181 |
|
|
$imploded_system_permissions = $name;
|
182 |
|
|
} else {
|
183 |
|
|
$imploded_system_permissions .= ','.$name;
|
184 |
|
|
}
|
185 |
|
|
}
|
186 |
|
|
}
|
187 |
|
|
|
188 |
|
|
$system_permissions = $imploded_system_permissions;
|
189 |
|
|
|
190 |
|
|
// Get module permissions
|
191 |
|
|
$module_permissions = '';
|
192 |
|
|
if($handle = opendir(WB_PATH.'/modules/')) {
|
193 |
|
|
while (false !== ($file = readdir($handle))) {
|
194 |
|
|
if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
|
195 |
|
|
// Include the modules info file
|
196 |
|
|
require(WB_PATH.'/modules/'.$file.'/info.php');
|
197 |
|
|
// Check if it was selected to be used or not
|
198 |
|
|
$count = 0;
|
199 |
|
|
if(is_array($admin->get_post('module_permissions'))) {
|
200 |
|
|
foreach($admin->get_post('module_permissions') AS $selected_name) {
|
201 |
|
|
if($file == $selected_name) {
|
202 |
|
|
$count = $count+1;
|
203 |
|
|
}
|
204 |
|
|
}
|
205 |
|
|
}
|
206 |
|
|
if($count == 0) {
|
207 |
|
|
// Add unselected modules to list
|
208 |
|
|
if($module_permissions == '') {
|
209 |
|
|
$module_permissions = $file;
|
210 |
|
|
} else {
|
211 |
|
|
$module_permissions .= ','.$file;
|
212 |
|
|
}
|
213 |
|
|
}
|
214 |
|
|
}
|
215 |
|
|
}
|
216 |
|
|
}
|
217 |
|
|
|
218 |
|
|
// Get template permissions
|
219 |
|
|
$template_permissions = '';
|
220 |
|
|
if($handle = opendir(WB_PATH.'/templates/')) {
|
221 |
|
|
while (false !== ($file = readdir($handle))) {
|
222 |
|
|
if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
|
223 |
|
|
// Include the modules info file
|
224 |
|
|
require(WB_PATH.'/templates/'.$file.'/info.php');
|
225 |
|
|
// Check if it was selected to be used or not
|
226 |
|
|
$count = 0;
|
227 |
|
|
if(is_array($admin->get_post('template_permissions'))) {
|
228 |
|
|
foreach($admin->get_post('template_permissions') AS $selected_name) {
|
229 |
|
|
if($file == $selected_name) {
|
230 |
|
|
$count = $count+1;
|
231 |
|
|
}
|
232 |
|
|
}
|
233 |
|
|
}
|
234 |
|
|
if($count == 0) {
|
235 |
|
|
// Add unselected modules to list
|
236 |
|
|
if($template_permissions == '') {
|
237 |
|
|
$template_permissions = $file;
|
238 |
|
|
} else {
|
239 |
|
|
$template_permissions .= ','.$file;
|
240 |
|
|
}
|
241 |
|
|
}
|
242 |
|
|
}
|
243 |
|
|
}
|
244 |
|
|
}
|
245 |
|
|
|
246 |
239
|
stefan
|
?>
|