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 http://xoops.org/
14 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15 * @package
16 * @since
17 * @author       XOOPS Development Team, Kazumi Ono (AKA onokazu)
18 */
19
20$groups = $GLOBALS['xoopsUser']->getGroups();
21$all_ok = false;
22if (!in_array(XOOPS_GROUP_ADMIN, $groups)) {
23    /* @var XoopsGroupPermHandler $sysperm_handler */
24    $sysperm_handler = xoops_getHandler('groupperm');
25    $ok_syscats      = $sysperm_handler->getItemIds('system_admin', $groups);
26} else {
27    $all_ok = true;
28}
29require_once $GLOBALS['xoops']->path('/class/xoopslists.php');
30// include system category definitions
31include_once $GLOBALS['xoops']->path('/modules/system/constants.php');
32
33$admin_dir = $GLOBALS['xoops']->path('/modules/system/admin');
34$dirlist   = XoopsLists::getDirListAsArray($admin_dir);
35$index     = 0;
36foreach ($dirlist as $file) {
37    if (file_exists($admin_dir . '/' . $file . '/xoops_version.php')) {
38        include $admin_dir . '/' . $file . '/xoops_version.php';
39        if ($modversion['hasAdmin']) {
40            if (xoops_getModuleOption('active_' . $file, 'system')) {
41                $category = isset($modversion['category']) ? (int)$modversion['category'] : 0;
42                if (false !== $all_ok || in_array($modversion['category'], $ok_syscats)) {
43                    $adminmenu[$index]['title'] = trim($modversion['name']);
44                    $adminmenu[$index]['desc']  = trim($modversion['description']);
45                    $adminmenu[$index]['link']  = 'admin.php?fct=' . $file;
46                    $adminmenu[$index]['icon']  = 'icons/' . $modversion['image'];
47                }
48            }
49        }
50        unset($modversion);
51    }
52    ++$index;
53}
54unset($dirlist);
55