Issues (3083)

htdocs/modules/system/menu.php (1 issue)

Severity
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
 * @copyright    XOOPS Project https://xoops.org/
14
 * @license      GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
15
 * @package
16
 * @since
17
 * @author       XOOPS Development Team, Kazumi Ono (AKA onokazu)
18
 */
19
20
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
21
22
$groups = $GLOBALS['xoopsUser']->getGroups();
23
$all_ok = false;
24
if (!in_array(XOOPS_GROUP_ADMIN, $groups)) {
25
    /** @var XoopsGroupPermHandler $sysperm_handler */
26
    $sysperm_handler = xoops_getHandler('groupperm');
27
    $ok_syscats      = $sysperm_handler->getItemIds('system_admin', $groups);
28
} else {
29
    $all_ok = true;
30
}
31
require_once $GLOBALS['xoops']->path('/class/xoopslists.php');
32
// include system category definitions
33
include_once $GLOBALS['xoops']->path('/modules/system/constants.php');
34
35
$admin_dir = $GLOBALS['xoops']->path('/modules/system/admin');
36
$dirlist   = XoopsLists::getDirListAsArray($admin_dir);
37
$index     = 0;
38
foreach ($dirlist as $file) {
39
    if (file_exists($admin_dir . '/' . $file . '/xoops_version.php')) {
40
        include $admin_dir . '/' . $file . '/xoops_version.php';
41
        if ($modversion['hasAdmin']) {
42
            if (xoops_getModuleOption('active_' . $file, 'system')) {
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

42
            if (/** @scrutinizer ignore-deprecated */ xoops_getModuleOption('active_' . $file, 'system')) {
Loading history...
43
                $category = isset($modversion['category']) ? (int)$modversion['category'] : 0;
44
                if (false !== $all_ok || in_array($modversion['category'], $ok_syscats)) {
45
                    $adminmenu[$index]['title'] = trim($modversion['name']);
46
                    $adminmenu[$index]['link']  = 'admin.php?fct=' . $file;
47
                    $adminmenu[$index]['image'] = $modversion['image'];
48
                }
49
            }
50
        }
51
        unset($modversion);
52
    }
53
    ++$index;
54
}
55
unset($dirlist);
56