Issues (330)

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.

include/onupdate.php (1 issue)

1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
13
/**
14
 * Module: lexikon
15
 *
16
 * @category        Module
17
 * @package         lexikon
18
 * @author          XOOPS Development Team <https://xoops.org>
19
 * @copyright       {@link https://xoops.org/ XOOPS Project}
20
 * @license         GPL 2.0 or later
21
 * @link            https://xoops.org/
22
 * @since           1.0.0
23
 */
24
25
use XoopsModules\Lexikon\{
26
    Common\Configurator,
27
    Helper,
28
    Utility
29
};
30
/** @var Helper $helper */
31
/** @var Utility $utility */
32
/** @var Configurator $configurator */
33
34
if ((!defined('XOOPS_ROOT_PATH')) || !$GLOBALS['xoopsUser'] instanceof \XoopsUser
35
    || !$GLOBALS['xoopsUser']->isAdmin()) {
36
    exit('Restricted access' . PHP_EOL);
37
}
38
39
require \dirname(__DIR__) . '/preloads/autoloader.php';
40
41
42
43
/**
44
 * Prepares system prior to attempting to install module
45
 * @param \XoopsModule $module {@link XoopsModule}
46
 *
47
 * @return bool true if ready to install, false if not
48
 */
49
function xoops_module_pre_update_lexikon(\XoopsModule $module)
50
{
51
52
    $helper  = Helper::getInstance();
53
    $utility = new Utility();
54
55
    $xoopsSuccess = $utility::checkVerXoops($module);
56
    $phpSuccess   = $utility::checkVerPhp($module);
57
58
    return $xoopsSuccess && $phpSuccess;
59
}
60
61
/**
62
 * Performs tasks required during update of the module
63
 * @param \XoopsModule $module {@link XoopsModule}
64
 * @param null         $previousVersion
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $previousVersion is correct as it would always require null to be passed?
Loading history...
65
 *
66
 * @return bool true if update successful, false if not
67
 */
68
function xoops_module_update_lexikon(\XoopsModule $module, $previousVersion = null)
69
{
70
    $moduleDirName      = \basename(\dirname(__DIR__));
71
    $moduleDirNameUpper = mb_strtoupper($moduleDirName);
72
73
    $helper       = Helper::getInstance();
74
    $utility      = new Utility();
75
    $configurator = new Configurator();
76
    $helper->loadLanguage('common');
77
78
    if ($previousVersion < 240) {
79
        //delete old HTML templates
80
        if (count($configurator->templateFolders) > 0) {
81
            foreach ($configurator->templateFolders as $folder) {
82
                $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder);
83
                if (is_dir($templateFolder)) {
84
                    $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']);
85
                    foreach ($templateList as $k => $v) {
86
                        $fileInfo = new \SplFileInfo($templateFolder . $v);
87
                        if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) {
88
                            if (is_file($templateFolder . $v)) {
89
                                unlink($templateFolder . $v);
90
                            }
91
                        }
92
                    }
93
                }
94
            }
95
        }
96
97
        //  ---  DELETE OLD FILES ---------------
98
        if (count($configurator->oldFiles) > 0) {
99
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
100
            foreach (array_keys($configurator->oldFiles) as $i) {
101
                $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]);
102
                if (is_file($tempFile)) {
103
                    unlink($tempFile);
104
                }
105
            }
106
        }
107
108
        //  ---  DELETE OLD FOLDERS ---------------
109
        xoops_load('XoopsFile');
110
        if (count($configurator->oldFolders) > 0) {
111
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
112
            foreach (array_keys($configurator->oldFolders) as $i) {
113
                $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]);
114
                /** @var \XoopsObjectHandler $folderHandler */
115
                $folderHandler = \XoopsFile::getHandler('folder', $tempFolder);
116
                $folderHandler->delete($tempFolder);
117
            }
118
        }
119
120
        //  ---  CREATE FOLDERS ---------------
121
        if (count($configurator->uploadFolders) > 0) {
122
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
123
            foreach (array_keys($configurator->uploadFolders) as $i) {
124
                $utility::createFolder($configurator->uploadFolders[$i]);
125
            }
126
        }
127
128
        //  ---  COPY blank.png FILES ---------------
129
        if (count($configurator->copyBlankFiles) > 0) {
130
            $file = \dirname(__DIR__) . '/assets/images/blank.png';
131
            foreach (array_keys($configurator->copyBlankFiles) as $i) {
132
                $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
133
                $utility::copyFile($file, $dest);
134
            }
135
        }
136
137
        //delete .html entries from the tpl table
138
        $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
139
        $GLOBALS['xoopsDB']->queryF($sql);
140
141
        /** @var \XoopsGroupPermHandler $grouppermHandler */
142
        $grouppermHandler = xoops_getHandler('groupperm');
143
144
        return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read');
145
    }
146
147
    return true;
148
}
149