This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | You may not change or alter any portion of this comment or credits |
||
4 | of supporting developers from this source code or any supporting source code |
||
5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
6 | |||
7 | This program is distributed in the hope that it will be useful, |
||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
10 | */ |
||
11 | |||
12 | /** |
||
13 | * userlog module |
||
14 | * |
||
15 | * @copyright XOOPS Project (https://xoops.org) |
||
16 | * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
17 | * @package userlog |
||
18 | * @since 1 |
||
19 | * @author irmtfan ([email protected]) |
||
20 | * @author XOOPS Project <www.xoops.org> <www.xoops.ir> |
||
21 | */ |
||
22 | |||
23 | use Xmf\Request; |
||
24 | |||
25 | defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
||
26 | |||
27 | $moduleDirName = basename(__DIR__); |
||
28 | |||
29 | // ------------------- Informations ------------------- // |
||
30 | $modversion = [ |
||
31 | 'version' => 1.17, |
||
32 | 'module_status' => 'Beta 1', |
||
33 | 'release_date' => '2017/09/04', //yyyy/mm/dd |
||
34 | 'name' => _MI_USERLOG_NAME, |
||
35 | 'description' => _MI_USERLOG_DSC, |
||
36 | 'official' => 0, //1 indicates supported by XOOPS Dev Team, 0 means 3rd party supported |
||
37 | 'author' => 'xoops.org (irmtfan)', |
||
38 | 'nickname' => 'irmtfan', |
||
39 | 'author_mail' => 'author-email', |
||
40 | 'author_website_url' => 'https://xoops.org', |
||
41 | 'author_website_name' => 'XOOPS', |
||
42 | 'credits' => 'XOOPS Project Team, trabis, irmtfan, mamba, tatane, cesagonchu, zyspec, blackrx, timgno, chefry', |
||
43 | 'license' => 'GPL 2.0 or later', |
||
44 | 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', |
||
45 | 'help' => 'page=help', |
||
46 | // |
||
47 | 'release_info' => 'Changelog', |
||
48 | 'release_file' => XOOPS_URL . "/modules/{$moduleDirName}/docs/changelog file", |
||
49 | // |
||
50 | 'manual' => 'link to manual file', |
||
51 | 'manual_file' => XOOPS_URL . "/modules/{$moduleDirName}/docs/install.txt", |
||
52 | // images |
||
53 | 'image' => 'assets/images/logoModule.png', |
||
54 | 'iconsmall' => 'assets/images/iconsmall.png', |
||
55 | 'iconbig' => 'assets/images/iconbig.png', |
||
56 | 'dirname' => "{$moduleDirName}", |
||
57 | // Local path icons |
||
58 | 'modicons16' => 'assets/images/icons/16', |
||
59 | 'modicons32' => 'assets/images/icons/32', |
||
60 | //About |
||
61 | // 'release' => '2015-04-04', |
||
62 | 'demo_site_url' => 'https://xoops.org', |
||
63 | 'demo_site_name' => 'XOOPS Demo Site', |
||
64 | 'support_url' => 'https://xoops.org/modules/newbb/viewforum.php?forum=28/', |
||
65 | 'support_name' => 'Support Forum', |
||
66 | 'module_website_url' => 'www.xoops.org', |
||
67 | 'module_website_name' => 'XOOPS Project', |
||
68 | // ------------------- Min Requirements ------------------- |
||
69 | 'min_php' => '5.5', |
||
70 | 'min_xoops' => '2.5.9', |
||
71 | 'min_admin' => '1.2', |
||
72 | 'min_db' => ['mysql' => '5.5'], |
||
73 | // ------------------- Admin Menu ------------------- |
||
74 | 'system_menu' => 1, |
||
75 | 'hasAdmin' => 1, |
||
76 | 'adminindex' => 'admin/index.php', |
||
77 | 'adminmenu' => 'admin/menu.php', |
||
78 | // ------------------- Main Menu ------------------- |
||
79 | 'hasMain' => 1, |
||
80 | // ------------------- Search --------------------------- |
||
81 | 'hasSearch' => 0, |
||
82 | // 'search' => [ |
||
83 | // 'file' => 'include/search.inc.php', |
||
84 | // 'func' => 'XXXX_search'], |
||
85 | // ------------------- Comments ------------------------- |
||
86 | 'hasComments' => 0, |
||
87 | // 'comments' => array( |
||
88 | // 'pageName' => 'index.php', |
||
89 | // 'itemName' => 'id'), |
||
90 | |||
91 | // Install/Update |
||
92 | 'onInstall' => 'include/oninstall.php', |
||
93 | 'onUninstall' => 'include/onuninstall.php', |
||
94 | 'onUpdate' => 'include/onupdate.php', |
||
95 | // ------------------- Mysql ----------------------------- |
||
96 | 'sqlfile' => ['mysql' => 'sql/mysql.sql'], |
||
97 | // ------------------- Tables ---------------------------- |
||
98 | 'tables' => [ |
||
99 | $moduleDirName . '_log', |
||
100 | $moduleDirName . '_set', |
||
101 | $moduleDirName . '_stats' |
||
102 | ], |
||
103 | ]; |
||
104 | |||
105 | // ------------------- Help files ------------------- // |
||
106 | $modversion['helpsection'] = [ |
||
107 | ['name' => _MI_USERLOG_OVERVIEW, 'link' => 'page=help'], |
||
108 | ['name' => _MI_USERLOG_DISCLAIMER, 'link' => 'page=disclaimer'], |
||
109 | ['name' => _MI_USERLOG_LICENSE, 'link' => 'page=license'], |
||
110 | ['name' => _MI_USERLOG_SUPPORT, 'link' => 'page=support'], |
||
111 | ]; |
||
112 | |||
113 | // ------------------- Templates ------------------- // |
||
114 | |||
115 | xoops_loadLanguage('admin', $modversion['dirname']); |
||
116 | |||
117 | // Templates - if you don't define 'type' it will be 'module' | '' -> templates |
||
118 | $modversion['templates'] [] = [ |
||
119 | [ |
||
120 | 'file' => $modversion['dirname'] . '_admin_sets.tpl', |
||
121 | 'type' => 'admin', // $type = 'blocks' -> templates/blocks , 'admin' -> templates/admin , 'module' | '' -> templates |
||
122 | 'description' => 'list of userlog setting' |
||
123 | ], |
||
124 | ]; |
||
125 | |||
126 | $modversion['templates'] [] = [ |
||
127 | [ |
||
128 | 'file' => $modversion['dirname'] . '_admin_logs.tpl', |
||
129 | 'type' => 'admin', // $type = 'blocks' -> templates/blocks , 'admin' -> templates/admin , 'module' | '' -> templates |
||
130 | 'description' => 'list of userlog logs' |
||
131 | ], |
||
132 | |||
133 | ]; |
||
134 | |||
135 | $modversion['templates'] [] = [ |
||
136 | [ |
||
137 | 'file' => $modversion['dirname'] . '_admin_file.tpl', |
||
138 | 'type' => 'admin', // $type = 'blocks' -> templates/blocks , 'admin' -> templates/admin , 'module' | '' -> templates |
||
139 | 'description' => 'File manager' |
||
140 | ], |
||
141 | |||
142 | ]; |
||
143 | |||
144 | $modversion['templates'] [] = [ |
||
145 | [ |
||
146 | 'file' => $modversion['dirname'] . '_admin_stats.tpl', |
||
147 | 'type' => 'admin', // $type = 'blocks' -> templates/blocks , 'admin' -> templates/admin , 'module' | '' -> templates |
||
148 | 'description' => 'Logs Statistics' |
||
149 | ], |
||
150 | |||
151 | ]; |
||
152 | |||
153 | $modversion['templates'] [] = [ |
||
154 | [ |
||
155 | 'file' => $modversion['dirname'] . '_admin_stats_moduleadmin.tpl', |
||
156 | 'type' => 'admin', // $type = 'blocks' -> templates/blocks , 'admin' -> templates/admin , 'module' | '' -> templates |
||
157 | 'description' => 'module admin history' |
||
158 | ], |
||
159 | ]; |
||
160 | // ------------------- blocks ------------------- // |
||
161 | |||
162 | // options[0] - number of items to show in block. the default is 10 |
||
163 | // options[1] - items to select in Where claus |
||
164 | // options[2] - Time period - default: 1 day |
||
165 | // options[3] - Uid in WHERE claus: select some users to only count views by them -1 -> all (by default) |
||
166 | // options[4] - Gid in WHERE claus: select some groups to only count views by them 0 -> all (by default) |
||
167 | // options[5] - Sort - views, module dirname, module name, module views default: views |
||
168 | // options[6] - Order - DESC, ASC default: DESC |
||
169 | |||
170 | $modversion['blocks'][] = [ |
||
171 | 'file' => 'views.php', |
||
172 | 'name' => _MI_USERLOG_BLOCK_VIEWS, |
||
173 | 'description' => _MI_USERLOG_BLOCK_VIEWS_DSC, |
||
174 | 'show_func' => $modversion['dirname'] . '_views_show', |
||
175 | 'edit_func' => $modversion['dirname'] . '_views_edit', |
||
176 | 'options' => '10|0|1|-1|0|count|DESC', |
||
177 | 'template' => $modversion['dirname'] . '_block_views.tpl', |
||
178 | ]; |
||
179 | |||
180 | // options[0] - number of items to show in block. the default is 10 |
||
181 | // options[1] - login or register or both radio select |
||
182 | // options[2] - failed or successful or both radio select |
||
183 | // options[3] - inactive or active or both |
||
184 | // options[4] - never login before or login before or both |
||
185 | // options[5] - Order - DESC, ASC default: DESC |
||
186 | |||
187 | $modversion['blocks'][] = [ |
||
188 | 'file' => 'login_reg_history.php', |
||
189 | 'name' => _AM_USERLOG_LOGIN_REG_HISTORY, |
||
190 | 'description' => _AM_USERLOG_LOGIN_REG_HISTORY, |
||
191 | 'show_func' => $modversion['dirname'] . '_login_reg_history_show', |
||
192 | 'edit_func' => $modversion['dirname'] . '_login_reg_history_edit', |
||
193 | 'options' => '10|0|0|0|0|DESC', |
||
194 | 'template' => $modversion['dirname'] . '_block_login_reg_history.tpl', |
||
195 | ]; |
||
196 | |||
197 | // options[0] - number of items to show in block. the default is 10 |
||
198 | // options[1] - stats_type - referral (default), browser, OS |
||
199 | // options[2] - Sort - stats_link, stats_value (default), time_update |
||
200 | // options[3] - Order - DESC, ASC default: DESC |
||
201 | |||
202 | $modversion['blocks'][] = [ |
||
203 | 'file' => 'stats_type.php', |
||
204 | 'name' => _AM_USERLOG_STATS_TYPE, |
||
205 | 'description' => _AM_USERLOG_STATS_TYPE_DSC, |
||
206 | 'show_func' => $modversion['dirname'] . '_stats_type_show', |
||
207 | 'edit_func' => $modversion['dirname'] . '_stats_type_edit', |
||
208 | 'options' => '10|referral|stats_value|DESC', |
||
209 | 'template' => $modversion['dirname'] . '_block_stats_type.tpl', |
||
210 | ]; |
||
211 | |||
212 | // Config categories |
||
213 | $modversion['configcat']['logfile']['name'] = _MI_USERLOG_CONFCAT_LOGFILE; |
||
214 | $modversion['configcat']['logfile']['description'] = _MI_USERLOG_CONFCAT_LOGFILE_DSC; |
||
215 | $modversion['configcat']['format']['name'] = _MI_USERLOG_CONFCAT_FORMAT; |
||
216 | $modversion['configcat']['format']['description'] = _MI_USERLOG_CONFCAT_FORMAT_DSC; |
||
217 | $modversion['configcat']['pagenav']['name'] = _MI_USERLOG_CONFCAT_PAGENAV; |
||
218 | $modversion['configcat']['pagenav']['description'] = _MI_USERLOG_CONFCAT_PAGENAV_DSC; |
||
219 | $modversion['configcat']['logdb']['name'] = _MI_USERLOG_CONFCAT_LOGDB; |
||
220 | $modversion['configcat']['logdb']['description'] = _MI_USERLOG_CONFCAT_LOGDB_DSC; |
||
221 | $modversion['configcat']['prob']['name'] = _MI_USERLOG_CONFCAT_PROB; |
||
222 | $modversion['configcat']['prob']['description'] = _MI_USERLOG_CONFCAT_PROB_DSC; |
||
223 | |||
224 | // Config Settings (only for modules that need config settings generated automatically) |
||
225 | ################### Log file #################### |
||
226 | $modversion['log_paths'] = [ |
||
227 | 'XOOPS_VAR_PATH' => XOOPS_VAR_PATH, |
||
228 | 'XOOPS_UPLOAD_PATH' => XOOPS_UPLOAD_PATH |
||
229 | ]; |
||
230 | |||
231 | $modversion['config'][] = [ |
||
232 | 'name' => 'status', |
||
233 | 'title' => '_MI_USERLOG_STATUS', |
||
234 | 'description' => '_MI_USERLOG_STATUS_DSC', |
||
235 | 'formtype' => 'select', |
||
236 | 'valuetype' => 'int', |
||
237 | 'default' => 1, |
||
238 | 'options' => [ |
||
239 | _MI_USERLOG_ACTIVE => 1, |
||
240 | _MI_USERLOG_IDLE => 0 |
||
241 | ], |
||
242 | ]; |
||
243 | |||
244 | $modversion['config'][] = [ |
||
245 | 'name' => 'postlog', |
||
246 | 'title' => '_MI_USERLOG_POSTLOG', |
||
247 | 'description' => '_MI_USERLOG_POSTLOG_DSC', |
||
248 | 'formtype' => 'yesno', |
||
249 | 'valuetype' => 'int', |
||
250 | 'default' => 1, |
||
251 | 'options' => [], |
||
252 | ]; |
||
253 | |||
254 | $modversion['config'][] = [ |
||
255 | 'name' => 'logfile', |
||
256 | 'title' => '_MI_USERLOG_CONFCAT_LOGFILE_DSC', |
||
257 | 'description' => '', |
||
258 | 'formtype' => 'line_break', |
||
259 | 'valuetype' => 'textbox', |
||
260 | 'default' => 'odd', |
||
261 | 'category' => 'logfile', |
||
262 | ]; |
||
263 | |||
264 | $modversion['config'][] = [ |
||
265 | 'name' => 'maxlogfilesize', |
||
266 | 'title' => '_MI_USERLOG_MAXLOGFILESIZE', |
||
267 | 'description' => '_MI_USERLOG_MAXLOGFILESIZE_DSC', |
||
268 | 'formtype' => 'textbox', |
||
269 | 'valuetype' => 'int', |
||
270 | 'default' => 1000000, // bytes below 1MB because some servers have limitations |
||
271 | 'category' => 'logfile', |
||
272 | ]; |
||
273 | |||
274 | $modversion['config'][] = [ |
||
275 | 'name' => 'logfilepath', |
||
276 | 'title' => '_MI_USERLOG_LOGFILEPATH', |
||
277 | 'description' => '_MI_USERLOG_LOGFILEPATH_DSC', |
||
278 | 'formtype' => 'select', |
||
279 | 'valuetype' => 'text', |
||
280 | 'default' => XOOPS_VAR_PATH, |
||
281 | 'options' => $modversion['log_paths'], |
||
282 | 'category' => 'logfile', |
||
283 | ]; |
||
284 | |||
285 | $modversion['config'][] = [ |
||
286 | 'name' => 'logfilename', |
||
287 | 'title' => '_MI_USERLOG_LOGFILENAME', |
||
288 | 'description' => '_MI_USERLOG_LOGFILENAME_DSC', |
||
289 | 'formtype' => 'textbox', |
||
290 | 'valuetype' => 'text', |
||
291 | 'default' => 'userlognav', |
||
292 | 'category' => 'logfile', |
||
293 | ]; |
||
294 | |||
295 | $modversion['config'][] = [ |
||
296 | 'name' => 'format', |
||
297 | 'title' => '_MI_USERLOG_CONFCAT_FORMAT_DSC', |
||
298 | 'description' => '', |
||
299 | 'formtype' => 'line_break', |
||
300 | 'valuetype' => 'textbox', |
||
301 | 'default' => 'even', |
||
302 | 'category' => 'format', |
||
303 | ]; |
||
304 | |||
305 | $modversion['config'][] = [ |
||
306 | 'name' => 'format_date', |
||
307 | 'title' => '_MI_USERLOG_DATEFORMAT', |
||
308 | 'description' => '_MI_USERLOG_DATEFORMAT_DSC', |
||
309 | 'formtype' => 'textbox', |
||
310 | 'valuetype' => 'text', |
||
311 | 'default' => 'd-M-Y H:i', |
||
312 | 'category' => 'format', |
||
313 | ]; |
||
314 | |||
315 | $modversion['config'][] = [ |
||
316 | 'name' => 'format_date_history', |
||
317 | 'title' => '_MI_USERLOG_DATEFORMAT_HISTORY', |
||
318 | 'description' => '_MI_USERLOG_DATEFORMAT_DSC', |
||
319 | 'formtype' => 'textbox', |
||
320 | 'valuetype' => 'text', |
||
321 | 'default' => 'elapse', |
||
322 | 'category' => 'format', |
||
323 | |||
324 | ]; |
||
325 | |||
326 | $modversion['config'][] = [ |
||
327 | 'name' => 'pagenav', |
||
328 | 'title' => '_MI_USERLOG_CONFCAT_PAGENAV_DSC', |
||
329 | 'description' => '', |
||
330 | 'formtype' => 'line_break', |
||
331 | 'valuetype' => 'textbox', |
||
332 | 'default' => 'odd', |
||
333 | 'category' => 'pagenav', |
||
334 | ]; |
||
335 | |||
336 | $modversion['config'][] = [ |
||
337 | 'name' => 'sets_perpage', |
||
338 | 'title' => '_MI_USERLOG_SETS_PERPAGE', |
||
339 | 'description' => '_MI_USERLOG_SETS_PERPAGE_DSC', |
||
340 | 'formtype' => 'textbox', |
||
341 | 'valuetype' => 'int', |
||
342 | 'default' => 20, |
||
343 | 'category' => 'pagenav', |
||
344 | ]; |
||
345 | |||
346 | $modversion['config'][] = [ |
||
347 | 'name' => 'logs_perpage', |
||
348 | 'title' => '_MI_USERLOG_LOGS_PERPAGE', |
||
349 | 'description' => '_MI_USERLOG_LOGS_PERPAGE_DSC', |
||
350 | 'formtype' => 'textbox', |
||
351 | 'valuetype' => 'int', |
||
352 | 'default' => 100, |
||
353 | 'category' => 'pagenav', |
||
354 | ]; |
||
355 | |||
356 | $modversion['config'][] = [ |
||
357 | 'name' => 'engine', |
||
358 | 'title' => '_MI_USERLOG_ENGINE', |
||
359 | 'description' => '_MI_USERLOG_ENGINE_DSC', |
||
360 | 'formtype' => 'select', |
||
361 | 'valuetype' => 'text', |
||
362 | 'default' => 'db', |
||
363 | 'options' => [ |
||
364 | _AM_USERLOG_ENGINE_DB => 'db', |
||
365 | _AM_USERLOG_ENGINE_FILE => 'file' |
||
366 | ], |
||
367 | 'category' => 'pagenav', |
||
368 | ]; |
||
369 | |||
370 | $modversion['config'][] = [ |
||
371 | 'name' => 'file', |
||
372 | 'title' => '_MI_USERLOG_FILE', |
||
373 | 'description' => '_MI_USERLOG_FILE_DSC', |
||
374 | 'formtype' => 'select', |
||
375 | 'valuetype' => 'text', |
||
376 | 'default' => '0', |
||
377 | 'options' => [ |
||
378 | _AM_USERLOG_FILE_WORKING => '0', |
||
379 | _AM_USERLOG_STATS_FILEALL => 'all' |
||
380 | ], |
||
381 | 'category' => 'pagenav', |
||
382 | ]; |
||
383 | |||
384 | $modversion['config'][] = [ |
||
385 | 'name' => 'logdb', |
||
386 | 'title' => '_MI_USERLOG_CONFCAT_LOGDB_DSC', |
||
387 | 'description' => '', |
||
388 | 'formtype' => 'line_break', |
||
389 | 'valuetype' => 'textbox', |
||
390 | 'default' => 'even', |
||
391 | 'category' => 'logdb', |
||
392 | |||
393 | ]; |
||
394 | |||
395 | $modversion['config'][] = [ |
||
396 | 'name' => 'maxlogs', |
||
397 | 'title' => '_MI_USERLOG_MAXLOGS', |
||
398 | 'description' => '_MI_USERLOG_MAXLOGS_DSC', |
||
399 | 'formtype' => 'textbox', |
||
400 | 'valuetype' => 'int', |
||
401 | 'default' => 10000, |
||
402 | 'category' => 'logdb', |
||
403 | ]; |
||
404 | |||
405 | $modversion['config'][] = [ |
||
406 | 'name' => 'maxlogsperiod', |
||
407 | 'title' => '_MI_USERLOG_MAXLOGSPERIOD', |
||
408 | 'description' => '_MI_USERLOG_MAXLOGSPERIOD_DSC', |
||
409 | 'formtype' => 'textbox', |
||
410 | 'valuetype' => 'int', |
||
411 | 'default' => 0, |
||
412 | 'category' => 'logdb', |
||
413 | ]; |
||
414 | |||
415 | $modversion['config'][] = [ |
||
416 | 'name' => 'prob', |
||
417 | 'title' => '_MI_USERLOG_CONFCAT_PROB_DSC', |
||
418 | 'description' => '', |
||
419 | 'formtype' => 'line_break', |
||
420 | 'valuetype' => 'textbox', |
||
421 | 'default' => 'odd', |
||
422 | 'category' => 'prob', |
||
423 | ]; |
||
424 | |||
425 | $modversion['config'][] = [ |
||
426 | 'name' => 'probset', |
||
427 | 'title' => '_MI_USERLOG_PROBSET', |
||
428 | 'description' => '_MI_USERLOG_PROBSET_DSC', |
||
429 | 'formtype' => 'select', |
||
430 | 'valuetype' => 'text', |
||
431 | 'default' => 20, |
||
432 | 'options' => array_combine(range(1, 100), range(1, 100)), |
||
433 | 'category' => 'prob', |
||
434 | ]; |
||
435 | |||
436 | $modversion['config'][] = [ |
||
437 | 'name' => 'probstats', |
||
438 | 'title' => '_MI_USERLOG_PROBSTATS', |
||
439 | 'description' => '_MI_USERLOG_PROBSTATS_DSC', |
||
440 | 'formtype' => 'select', |
||
441 | 'valuetype' => 'text', |
||
442 | 'default' => 10, |
||
443 | 'options' => range(0, 100), |
||
444 | 'category' => 'prob', |
||
445 | ]; |
||
446 | |||
447 | $modversion['config'][] = [ |
||
448 | 'name' => 'probstatsallhit', |
||
449 | 'title' => '_MI_USERLOG_PROBSTATSALLHIT', |
||
450 | 'description' => '_MI_USERLOG_PROBSTATSALLHIT_DSC', |
||
451 | 'formtype' => 'select', |
||
452 | 'valuetype' => 'text', |
||
453 | 'default' => 1, |
||
454 | 'options' => range(0, 100), |
||
455 | 'category' => 'prob', |
||
456 | ]; |
||
457 | |||
458 | // START add webmaster permission from file to add additional permission check for all webmasters |
||
459 | global $xoopsOption, $xoopsModule; |
||
0 ignored issues
–
show
|
|||
460 | // effective only in admin side |
||
461 | if (isset($xoopsOption['pagetype']) && 'admin' === $xoopsOption['pagetype'] && is_object($xoopsModule)) { |
||
462 | // get dirname |
||
463 | $dirname = $xoopsModule->getVar('dirname'); |
||
464 | // START if dirname is system |
||
465 | if ('system' === $dirname && Request::hasVar('fct')) { |
||
466 | $hModule = xoops_getHandler('module'); |
||
467 | // if we are in preferences of modules |
||
468 | if ('preferences' === Request::getString('fct') && Request::hasVar('mod')) { |
||
469 | $mod = Request::getInt('mod'); |
||
470 | $module = $hModule->get($mod); |
||
471 | $dirname = $module->getVar('dirname'); |
||
472 | } |
||
473 | // if we are in modules admin - can be done with onuninstall and onupdate??? |
||
474 | if ('modulesadmin' === Request::getString('fct') && Request::hasVar('module')) { |
||
475 | $dirname = Request::getString('module'); |
||
476 | } |
||
477 | |||
478 | // if we are in maintenance - now all modules - how to do it for only one module? |
||
479 | if ('maintenance' === Request::getString('fct')) { |
||
480 | $dump_modules = Request::getBool('dump_modules', false); |
||
481 | $dump_tables = Request::getBool('dump_tables', false); |
||
482 | if (true === $dump_tables || true === $dump_modules) { |
||
483 | $dirname = $modversion['dirname']; |
||
484 | } |
||
485 | } |
||
486 | } |
||
487 | // END if dirname is system |
||
488 | |||
489 | // now check permission from file |
||
490 | if ($dirname == $modversion['dirname']) { |
||
491 | if (file_exists($permFile = XOOPS_ROOT_PATH . '/modules/' . $modversion['dirname'] . '/admin/addon/perm.php')) { |
||
492 | $perm = include $permFile; |
||
493 | if (count($perm['super']['uid']) > 0 || count($perm['super']['group']) > 0) { |
||
494 | global $xoopsUser; |
||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||
495 | if (is_object($xoopsUser) && !in_array($xoopsUser->getVar('uid'), $perm['super']['uid']) |
||
496 | && 0 == count(array_intersect($xoopsUser->getGroups(), $perm['super']['group']))) { |
||
497 | $modversion['hasAdmin'] = 0; |
||
498 | $modversion['system_menu'] = 0; |
||
499 | $modversion['tables'] = null; |
||
500 | redirect_header(XOOPS_URL . '/modules/system/help.php?mid=' |
||
501 | . (!empty($mod) ? $mod : $xoopsModule->getVar('mid', 's')) |
||
502 | . '&page=help', 1, sprintf(_MI_USERLOG_WEBMASTER_NOPERM, implode(',', $perm['super']['uid']), implode(',', $perm['super']['group']))); |
||
503 | } |
||
504 | } |
||
505 | } |
||
506 | } |
||
507 | } |
||
508 | // END add webmaster permission from file to add additional permission check for all webmasters |
||
509 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state