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