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 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
15
|
|
|
* @author XOOPS Development Team, Kazumi Ono (AKA onokazu) |
16
|
|
|
*/ |
17
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
18
|
|
|
|
19
|
|
|
$fct = empty($_POST['fct']) ? '' : trim($_POST['fct']); |
20
|
|
|
$fct = empty($_GET['fct']) ? $fct : trim($_GET['fct']); |
21
|
|
|
if (empty($fct)) { |
22
|
|
|
$fct = 'preferences'; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
require \dirname(__DIR__, 3) . '/mainfile.php'; |
26
|
|
|
|
27
|
|
|
require XOOPS_ROOT_PATH . '/include/cp_functions.php'; |
28
|
|
|
|
29
|
|
|
require_once XOOPS_ROOT_PATH . '/kernel/module.php'; |
30
|
|
|
//require_once \dirname(__DIR__) . '/include/gtickets.php';// GIJ |
31
|
|
|
|
32
|
|
|
$admintest = 0; |
33
|
|
|
|
34
|
|
|
if (is_object($xoopsUser)) { |
35
|
|
|
$xoopsModule = XoopsModule::getByDirname('system'); |
36
|
|
|
if (!$xoopsUser->isAdmin($xoopsModule->mid())) { |
37
|
|
|
redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM); |
38
|
|
|
} |
39
|
|
|
$admintest = 1; |
40
|
|
|
} else { |
41
|
|
|
redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
// include system category definitions |
45
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/system/constants.php'; |
46
|
|
|
$error = false; |
47
|
|
|
if (0 != $admintest) { |
|
|
|
|
48
|
|
|
if (isset($fct) && '' != $fct) { |
49
|
|
|
if (file_exists(XOOPS_ROOT_PATH . '/modules/system/admin/' . $fct . '/xoops_version.php')) { |
50
|
|
|
xoops_loadLanguage('admin', 'system'); |
51
|
|
|
xoops_loadLanguage('admin/' . $fct, 'system'); |
52
|
|
|
|
53
|
|
|
require XOOPS_ROOT_PATH . '/modules/system/admin/' . $fct . '/xoops_version.php'; |
54
|
|
|
/** @var \XoopsGroupPermHandler $grouppermHandler */ |
55
|
|
|
$grouppermHandler = xoops_getHandler('groupperm'); |
56
|
|
|
$category = !empty($modversion['category']) ? (int)$modversion['category'] : 0; |
57
|
|
|
unset($modversion); |
58
|
|
|
if ($category > 0) { |
59
|
|
|
$groups = $xoopsUser->getGroups(); |
60
|
|
|
if (in_array(XOOPS_GROUP_ADMIN, $groups) |
61
|
|
|
|| false !== $grouppermHandler->checkRight('system_admin', $category, $groups, $xoopsModule->getVar('mid'))) { |
62
|
|
|
if (file_exists(__DIR__ . "/../include/{$fct}.inc.php")) { |
63
|
|
|
require_once __DIR__ . "/../include/{$fct}.inc.php"; |
64
|
|
|
} else { |
65
|
|
|
$error = true; |
66
|
|
|
} |
67
|
|
|
} else { |
68
|
|
|
$error = true; |
69
|
|
|
} |
70
|
|
|
} elseif ('version' === $fct) { |
71
|
|
|
if (file_exists(XOOPS_ROOT_PATH . '/modules/system/admin/version/main.php')) { |
72
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/system/admin/version/main.php'; |
73
|
|
|
} else { |
74
|
|
|
$error = true; |
75
|
|
|
} |
76
|
|
|
} else { |
77
|
|
|
$error = true; |
78
|
|
|
} |
79
|
|
|
} else { |
80
|
|
|
$error = true; |
81
|
|
|
} |
82
|
|
|
} else { |
83
|
|
|
$error = true; |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
if (false !== $error) { |
88
|
|
|
xoops_cp_header(); |
89
|
|
|
echo '<h4>' . _AM_SYSTEM_CONFIG . '</h4>'; |
90
|
|
|
echo '<table class="outer" cellpadding="4" cellspacing="1">'; |
91
|
|
|
echo '<tr>'; |
92
|
|
|
$groups = $xoopsUser->getGroups(); |
93
|
|
|
$all_ok = false; |
94
|
|
|
if (!in_array(XOOPS_GROUP_ADMIN, $groups)) { |
95
|
|
|
/** @var \XoopsGroupPermHandler $grouppermHandler */ |
96
|
|
|
$grouppermHandler = xoops_getHandler('groupperm'); |
97
|
|
|
$ok_syscats = $grouppermHandler->getItemIds('system_admin', $groups); |
98
|
|
|
} else { |
99
|
|
|
$all_ok = true; |
100
|
|
|
} |
101
|
|
|
$admin_dir = XOOPS_ROOT_PATH . '/modules/system/admin'; |
102
|
|
|
$handle = opendir($admin_dir); |
103
|
|
|
$counter = 0; |
104
|
|
|
$class = 'even'; |
105
|
|
|
while ($file = readdir($handle)) { |
106
|
|
|
if ('cvs' !== mb_strtolower($file) && !preg_match('/[.]/', $file) && is_dir($admin_dir . '/' . $file)) { |
107
|
|
|
require_once $admin_dir . '/' . $file . '/xoops_version.php'; |
108
|
|
|
if ($modversion['hasAdmin']) { |
109
|
|
|
$category = isset($modversion['category']) ? (int)$modversion['category'] : 0; |
110
|
|
|
if (false !== $all_ok || in_array($modversion['category'], $ok_syscats)) { |
111
|
|
|
echo "<td class='$class' align='center' valign='bottom' width='19%'>"; |
112
|
|
|
echo "<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=' . $file . "'><b>" . trim($modversion['name']) . "</b></a>\n"; |
113
|
|
|
echo '</td>'; |
114
|
|
|
++$counter; |
115
|
|
|
$class = ('even' === $class) ? 'odd' : 'even'; |
116
|
|
|
} |
117
|
|
|
if ($counter > 4) { |
118
|
|
|
$counter = 0; |
119
|
|
|
echo '</tr>'; |
120
|
|
|
echo '<tr>'; |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
unset($modversion); |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
while ($counter < 5) { |
127
|
|
|
echo '<td class="' . $class . '"> </td>'; |
128
|
|
|
$class = ('even' === $class) ? 'odd' : 'even'; |
129
|
|
|
++$counter; |
130
|
|
|
} |
131
|
|
|
echo '</tr></table>'; |
132
|
|
|
xoops_cp_footer(); |
133
|
|
|
} |
134
|
|
|
|