Issues (91)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

extras/main.php (3 issues)

Severity
1
<?php declare(strict_types=1);
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
 * @author       XOOPS Development Team, Kazumi Ono (AKA onokazu)
16
 */
17
18
// Check users rights
19
use Xmf\Request;
20
21
if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) {
22
    exit(_NOPERM);
23
}
24
25
require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
26
require_once XOOPS_ROOT_PATH . '/modules/system/admin/modulesadmin/modulesadmin.php';
27
28
if (isset($_POST)) {
29
    foreach ($_POST as $k => $v) {
30
        ${$k} = $v;
31
    }
32
}
33
34
// Get Action type
35
$op     = Request::getString('op', 'list');
36
$module = Request::getString('module', '');
37
38
if (in_array($op, ['confirm', 'submit', 'install_ok', 'update_ok', 'uninstall_ok'], true)) {
39
    if (!$GLOBALS['xoopsSecurity']->check()) {
40
        $op = 'list';
41
    }
42
}
43
$myts = \MyTextSanitizer::getInstance();
44
45
switch ($op) {
46
    case 'list':
47
        // Define main template
48
        $GLOBALS['xoopsOption']['template_main'] = 'system_modules.html';
49
        // Call Header
50
        xoops_cp_header();
51
        // Define Stylesheet
52
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
53
        //        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . $GLOBALS['xoopsModuleConfig']['jquery_theme'] . '/ui.all.css');
54
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css');
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

54
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . /** @scrutinizer ignore-deprecated */ xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css');
Loading history...
55
        // Define scripts
56
        $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
57
        $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
58
        $xoTheme->addScript('modules/system/js/admin.js');
59
        $xoTheme->addScript('modules/system/js/module.js');
60
        // Define Breadcrumb and tips
61
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
62
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help'));
63
        $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_TIPS);
64
        $xoBreadCrumb->render();
65
        // Get Module Handler
66
        /** @var \XoopsModuleHandler $moduleHandler */
67
        $moduleHandler = xoops_getHandler('module');
68
        $criteria      = new \CriteriaCompo();
69
        $criteria->setSort('weight');
70
        $criteria->setOrder('ASC');
71
        // Get all installed modules
72
        $installed_mods = $moduleHandler->getObjects($criteria);
73
        $listed_mods    = [];
74
        $i              = 0;
75
        $install_mods   = [];
76
        foreach ($installed_mods as $module) {
77
            $listed_mods[$i]                  = $module->toArray();
78
            $listed_mods[$i]['image']         = $module->getInfo('image');
79
            $listed_mods[$i]['adminindex']    = $module->getInfo('adminindex');
80
            $listed_mods[$i]['version']       = round($module->getVar('version') / 100, 2);
81
            $listed_mods[$i]['module_status'] = $module->getInfo('module_status');
82
            $listed_mods[$i]['last_update']   = formatTimestamp($module->getVar('last_update'), 'm');
83
            $listed_mods[$i]['author']        = $module->getInfo('author');
84
            $listed_mods[$i]['credits']       = $module->getInfo('credits');
85
            $listed_mods[$i]['license']       = $module->getInfo('license');
86
            $listed_mods[$i]['description']   = $module->getInfo('description');
87
            if ($module->getInfo('version') != $listed_mods[$i]['version']) {
88
                $listed_mods[$i]['warning_update'] = true;
89
            } else {
90
                $listed_mods[$i]['warning_update'] = false;
91
            }
92
            $install_mods[] = $module->getInfo('dirname');
93
            unset($module);
94
            ++$i;
95
        }
96
        // Get module to install
97
        $dirlist        = \XoopsLists::getModulesList();
98
        $toinstall_mods = [];
99
        $i              = 0;
100
        foreach ($dirlist as $file) {
101
            if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php')) {
102
                clearstatcache();
103
                $file = trim((string) $file);
104
                if (!in_array($file, $install_mods, true)) {
105
                    ++$i;
106
                }
107
            }
108
        }
109
        $xoopsTpl->assign('toinstall_nb', $i);
110
111
        $xoopsTpl->assign('install_mods', $listed_mods);
112
        $xoopsTpl->assign('mods_popup', $listed_mods);
113
114
        // Call Footer
115
        xoops_cp_footer();
116
        break;
117
    case 'installlist':
118
        // Define main template
119
        $GLOBALS['xoopsOption']['template_main'] = 'system_modules.html';
120
        // Call Header
121
        xoops_cp_header();
122
        // Define Stylesheet
123
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
124
        //        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . $GLOBALS['xoopsModuleConfig']['jquery_theme'] . '/ui.all.css');
125
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css');
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

125
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . /** @scrutinizer ignore-deprecated */ xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css');
Loading history...
126
        // Define scripts
127
        $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
128
        $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
129
        $xoTheme->addScript('modules/system/js/admin.js');
130
        // Define Breadcrumb and tips
131
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
132
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_TOINSTALL);
133
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install');
134
        $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_TIPS);
135
        $xoBreadCrumb->render();
136
        // Get Module Handler
137
        /** @var \XoopsModuleHandler $moduleHandler */
138
        $moduleHandler = xoops_getHandler('module');
139
        // Get all installed modules
140
        $installed_mods = $moduleHandler->getObjects();
141
        foreach ($installed_mods as $module) {
142
            $install_mods[] = $module->getInfo('dirname');
143
        }
144
        // Get module to install
145
        $dirlist        = \XoopsLists::getModulesList();
146
        $toinstall_mods = [];
147
        $i              = 0;
148
        foreach ($dirlist as $file) {
149
            if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php')) {
150
                clearstatcache();
151
                $file = trim((string) $file);
152
                if (!in_array($file, $install_mods, true)) {
153
                    $module = $moduleHandler->create();
154
                    $module->loadInfo($file);
155
                    $toinstall_mods[$i]['name']          = $module->getInfo('name');
156
                    $toinstall_mods[$i]['dirname']       = $module->getInfo('dirname');
157
                    $toinstall_mods[$i]['image']         = $module->getInfo('image');
158
                    $toinstall_mods[$i]['version']       = round($module->getInfo('version'), 2);
159
                    $toinstall_mods[$i]['module_status'] = $module->getInfo('module_status');
160
                    $toinstall_mods[$i]['author']        = $module->getInfo('author');
161
                    $toinstall_mods[$i]['credits']       = $module->getInfo('credits');
162
                    $toinstall_mods[$i]['license']       = $module->getInfo('license');
163
                    $toinstall_mods[$i]['description']   = $module->getInfo('description');
164
                    $toinstall_mods[$i]['mid']           = $i; // Use only for display popup
165
                    unset($module);
166
                    ++$i;
167
                }
168
            }
169
        }
170
        $xoopsTpl->assign('toinstall_mods', $toinstall_mods);
171
        $xoopsTpl->assign('mods_popup', $toinstall_mods);
172
        // Call Footer
173
        xoops_cp_footer();
174
        //xoops_module_list();
175
        break;
176
    case 'order':
177
        // Get Module Handler
178
        /** @var \XoopsModuleHandler $moduleHandler */
179
        $moduleHandler = xoops_getHandler('module');
180
        if (Request::hasVar('mod', 'POST')) {
181
            $i = 1;
182
            foreach ($_POST['mod'] as $order) {
183
                if ($order > 0) {
184
                    $module = $moduleHandler->get($order);
185
                    //Change order only for visible modules
186
                    if (0 != $module->getVar('weight')) {
187
                        $module->setVar('weight', $i);
188
                        if (!$moduleHandler->insert($module)) {
189
                            $error = true;
190
                        }
191
                        ++$i;
192
                    }
193
                }
194
            }
195
        }
196
        exit;
197
        break;
198
    case 'confirm':
199
        // Define main template
200
        $GLOBALS['xoopsOption']['template_main'] = 'system_modules_confirm.html';
201
        // Call Header
202
        xoops_cp_header();
203
        // Define Stylesheet
204
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
205
        // Define Breadcrumb and tips
206
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
207
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_VALIDATE);
208
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#confirm');
209
        $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_CONFIRM_TIPS);
210
        $xoBreadCrumb->render();
211
        $error = [];
212
        if (!is_writable(XOOPS_CACHE_PATH . '/')) {
213
            // attempt to chmod 666
214
            if (!chmod(XOOPS_CACHE_PATH . '/', 0777)) {
215
                $error[] = sprintf(_MUSTWABLE, '<strong>' . XOOPS_CACHE_PATH . '/</strong>');
216
            }
217
        }
218
        if (count($error) > 0) {
219
            // Display Error
220
            xoops_error($error);
221
            // Call Footer
222
            xoops_cp_footer();
223
            exit();
224
        }
225
        $i           = 0;
226
        $modifs_mods = [];
227
        $module      = Request::getArray('module', [], 'POST');
228
        foreach ($module as $mid) {
229
            $mid                          = (int)$mid;
230
            $modifs_mods[$i]['mid']       = $mid;
231
            $modifs_mods[$i]['oldname']   = htmlspecialchars(((string) $oldname[$mid]), ENT_QUOTES | ENT_HTML5);
232
            $modifs_mods[$i]['newname']   = htmlspecialchars(trim(((string) $newname[$mid])), ENT_QUOTES | ENT_HTML5);
233
            $modifs_mods[$i]['newstatus'] = isset($newstatus[$mid]) ? htmlspecialchars((string) $newstatus[$mid], ENT_QUOTES | ENT_HTML5) : 0;
234
            ++$i;
235
        }
236
        $xoopsTpl->assign('modifs_mods', $modifs_mods);
237
        $xoopsTpl->assign('input_security', $GLOBALS['xoopsSecurity']->getTokenHTML());
238
        // Call Footer
239
        xoops_cp_footer();
240
        break;
241
    case 'display':
242
        // Get module handler
243
        /** @var \XoopsModuleHandler $moduleHandler */
244
        $moduleHandler = xoops_getHandler('module');
245
        $module_id     = Request::getInt('mid', 0, 'POST');
246
        if ($module_id > 0) {
247
            $module = $moduleHandler->get($module_id);
248
            $old    = $module->getVar('isactive');
249
            // Set value
250
            $module->setVar('isactive', !$old);
251
            if (!$moduleHandler->insert($module)) {
252
                $error = true;
253
            }
254
            $blocks = \XoopsBlock::getByModule($module_id);
0 ignored issues
show
Deprecated Code introduced by
The function XoopsBlock::getByModule() has been deprecated: (This also appears, dead, in XoopsBlockHandler) ( Ignorable by Annotation )

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

254
            $blocks = /** @scrutinizer ignore-deprecated */ \XoopsBlock::getByModule($module_id);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
255
            $bcount = is_countable($blocks) ? count($blocks) : 0;
256
            foreach ($blocks as $iValue) {
257
                $iValue->setVar('isactive', !$old);
258
                $iValue->store();
259
            }
260
            //Set active modules in cache folder
261
            xoops_setActiveModules();
262
        }
263
        break;
264
    case 'display_in_menu':
265
        // Get module handler
266
        /** @var \XoopsModuleHandler $moduleHandler */
267
        $moduleHandler = xoops_getHandler('module');
268
        $module_id     = Request::getInt('mid', 0, 'POST');
269
        if ($module_id > 0) {
270
            $module = $moduleHandler->get($module_id);
271
            $old    = $module->getVar('weight');
272
            // Set value
273
            $module->setVar('weight', !$old);
274
            if (!$moduleHandler->insert($module)) {
275
                $error = true;
276
            }
277
        }
278
        break;
279
    case 'submit':
280
        $ret    = [];
281
        $write  = false;
282
        $module = Request::getArray('module', [], 'POST');
283
        foreach ($module as $mid) {
284
            if (isset($newstatus[$mid]) && 1 == $newstatus[$mid]) {
285
                if (0 == $oldstatus[$mid]) {
286
                    $ret[] = xoops_module_activate($mid);
287
                }
288
            } elseif (1 == $oldstatus[$mid]) {
289
                $ret[] = xoops_module_deactivate($mid);
290
            }
291
            $newname[$mid] = trim((string) $newname[$mid]);
292
            if ($oldname[$mid] != $newname[$mid]) {
293
                $ret[] = xoops_module_change($mid, $newname[$mid]);
294
                $write = true;
295
            }
296
        }
297
        if ($write) {
298
            // Flush cache files for cpanel GUIs
299
            xoops_load('cpanel', 'system');
300
            XoopsSystemCpanel::flush();
301
        }
302
303
        //Set active modules in cache folder
304
        xoops_setActiveModules();
305
        // Define main template
306
        $GLOBALS['xoopsOption']['template_main'] = 'system_modules_confirm.html';
307
        // Call Header
308
        xoops_cp_header();
309
        // Define Stylesheet
310
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
311
        // Define Breadcrumb and tips
312
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
313
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_SUBMITRES);
314
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#submit');
315
        $xoBreadCrumb->render();
316
        if (count($ret) > 0) {
317
            $xoopsTpl->assign('result', $ret);
318
        }
319
        // Call Footer
320
        xoops_cp_footer();
321
        break;
322
    case 'install':
323
        $module = htmlspecialchars((string) $module, ENT_QUOTES | ENT_HTML5);
324
        // Get module handler
325
        /** @var \XoopsModuleHandler $moduleHandler */
326
        $moduleHandler = xoops_getHandler('module');
327
        $mod           = $moduleHandler->create();
328
        $mod->loadInfoAsVar($module);
329
        // Construct message
330
        if (false !== $mod->getInfo('image') && '' != trim((string) $mod->getInfo('image'))) {
331
            $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim((string) $mod->getInfo('image')) . '" alt="">';
332
        }
333
        $msgs .= '<br><span style="font-size:smaller;">' . $mod->getVar('name', 's') . '</span><br><br>' . _AM_SYSTEM_MODULES_RUSUREINS;
334
        // Call Header
335
        xoops_cp_header();
336
        // Define Stylesheet
337
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
338
        // Define Breadcrumb and tips
339
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
340
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_INSTALL);
341
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install');
342
        $xoBreadCrumb->render();
343
        // Display question message
344
        xoops_confirm(['module' => $module, 'op' => 'install_ok', 'fct' => 'modulesadmin'], 'admin.php', $msgs, _AM_SYSTEM_MODULES_INSTALL);
345
        // Call Footer
346
        xoops_cp_footer();
347
        break;
348
    case 'install_ok':
349
        $ret   = [];
350
        $ret[] = xoops_module_install($module);
351
        // Flush cache files for cpanel GUIs
352
        xoops_load('cpanel', 'system');
353
        XoopsSystemCpanel::flush();
354
        //Set active modules in cache folder
355
        xoops_setActiveModules();
356
        // Define main template
357
        $GLOBALS['xoopsOption']['template_main'] = 'system_header.html';
358
        // Call Header
359
        xoops_cp_header();
360
        // Define Stylesheet
361
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
362
        // Define Breadcrumb and tips
363
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
364
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_INSTALL);
365
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install');
366
        $xoBreadCrumb->render();
367
        if (count($ret) > 0) {
368
            foreach ($ret as $msg) {
369
                if ('' != $msg) {
370
                    echo $msg;
371
                }
372
            }
373
        }
374
        // Call Footer
375
        xoops_cp_footer();
376
        break;
377
    case 'uninstall':
378
        $module = htmlspecialchars((string) $module, ENT_QUOTES | ENT_HTML5);
379
        // Get module handler
380
        /** @var \XoopsModuleHandler $moduleHandler */
381
        $moduleHandler = xoops_getHandler('module');
382
        $mod           = $moduleHandler->getByDirname($module);
383
        // Construct message
384
        if (false !== $mod->getInfo('image') && '' != trim((string) $mod->getInfo('image'))) {
385
            $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim((string) $mod->getInfo('image')) . '" alt="">';
386
        }
387
        $msgs .= '<br><span style="font-size:smaller;">' . $mod->getVar('name') . '</span><br><br>' . _AM_SYSTEM_MODULES_RUSUREUNINS;
388
        // Call Header
389
        xoops_cp_header();
390
        // Define Stylesheet
391
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
392
        // Define Breadcrumb and tips
393
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
394
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UNINSTALL);
395
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#delete');
396
        $xoBreadCrumb->render();
397
        // Display Question
398
        xoops_confirm(['module' => $module, 'op' => 'uninstall_ok', 'fct' => 'modulesadmin'], 'admin.php', $msgs, _AM_SYSTEM_MODULES_UNINSTALL);
399
        // Call Footer
400
        xoops_cp_footer();
401
        break;
402
    case 'uninstall_ok':
403
        $ret   = [];
404
        $ret[] = xoops_module_uninstall($module);
405
        // Flush cache files for cpanel GUIs
406
        xoops_load('cpanel', 'system');
407
        XoopsSystemCpanel::flush();
408
        //Set active modules in cache folder
409
        xoops_setActiveModules();
410
        // Define main template
411
        $GLOBALS['xoopsOption']['template_main'] = 'system_header.html';
412
        // Call Header
413
        xoops_cp_header();
414
        // Define Stylesheet
415
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
416
        // Define Breadcrumb and tips
417
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
418
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UNINSTALL);
419
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#delete');
420
        $xoBreadCrumb->render();
421
        if (count($ret) > 0) {
422
            foreach ($ret as $msg) {
423
                if ('' != $msg) {
424
                    echo $msg;
425
                }
426
            }
427
        }
428
        // Call Footer
429
        xoops_cp_footer();
430
        break;
431
    case 'update':
432
        $module = htmlspecialchars((string) $module, ENT_QUOTES | ENT_HTML5);
433
        // Get module handler
434
        /** @var \XoopsModuleHandler $moduleHandler */
435
        $moduleHandler = xoops_getHandler('module');
436
        $mod           = $moduleHandler->getByDirname($module);
437
        // Construct message
438
        if (false !== $mod->getInfo('image') && '' != trim((string) $mod->getInfo('image'))) {
439
            $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim((string) $mod->getInfo('image')) . '" alt="">';
440
        }
441
        $msgs .= '<br><span style="font-size:smaller;">' . $mod->getVar('name', 's') . '</span><br><br>' . _AM_SYSTEM_MODULES_RUSUREUPD;
442
        // Call Header
443
        xoops_cp_header();
444
        // Define Stylesheet
445
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
446
        // Define Breadcrumb and tips
447
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
448
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UPDATE);
449
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#update');
450
        $xoBreadCrumb->render();
451
        // Display message
452
        xoops_confirm(['module' => $module, 'op' => 'update_ok', 'fct' => 'modulesadmin'], 'admin.php', $msgs, _AM_SYSTEM_MODULES_UPDATE);
453
        // Call Footer
454
        xoops_cp_footer();
455
        break;
456
    case 'update_ok':
457
        //--------------------------
458
459
        $ret   = [];
460
        $ret[] = xoops_module_update($module);
461
        // Flush cache files for cpanel GUIs
462
        xoops_load('cpanel', 'system');
463
        XoopsSystemCpanel::flush();
464
        //Set active modules in cache folder
465
        xoops_setActiveModules();
466
        // Define main template
467
        $GLOBALS['xoopsOption']['template_main'] = 'system_header.html';
468
        // Call Header
469
        xoops_cp_header();
470
        // Define Stylesheet
471
        $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
472
        // Define Breadcrumb and tips
473
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
474
        $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UNINSTALL);
475
        $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#delete');
476
        $xoBreadCrumb->render();
477
        if (count($ret) > 0) {
478
            foreach ($ret as $msg) {
479
                if ('' != $msg) {
480
                    echo $msg;
481
                }
482
            }
483
        }
484
        // Call Footer
485
        xoops_cp_footer();
486
        break;
487
    //---------------------------------------
488
}
489