Issues (432)

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 (4 issues)

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
 * @category        Module
14
 * @copyright       {@link https://xoops.org/ XOOPS Project}
15
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
16
 * @author          Marcello Brandão aka  Suico, Mamba, LioMJ  <https://xoops.org>
17
 */
18
19
use XoopsModules\Suico\{
20
    Common\Configurator,
21
    Common\Migrate,
22
    Helper,
23
    Utility
24
};
25
/** @var Helper $helper */
26
/** @var Utility $utility */
27
/** @var Configurator $configurator */
28
/** @var Migrate $migrator */
29
if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)
30
    || !$GLOBALS['xoopsUser']->isAdmin()) {
31
    exit('Restricted access' . PHP_EOL);
32
}
33
include \dirname(__DIR__) . '/preloads/autoloader.php';
34
35
/**
36
 * Prepares system prior to attempting to install module
37
 * @param \XoopsModule $module {@link \XoopsModule}
38
 * @return bool true if ready to install, false if not
39
 */
40
function xoops_module_pre_update_suico(
41
    \XoopsModule $module
42
) {
43
    $moduleDirName = \basename(\dirname(__DIR__));
0 ignored issues
show
The assignment to $moduleDirName is dead and can be removed.
Loading history...
44
    $helper        = Helper::getInstance();
0 ignored issues
show
The assignment to $helper is dead and can be removed.
Loading history...
45
    $utility       = new Utility();
46
    $xoopsSuccess  = $utility::checkVerXoops($module);
47
    $phpSuccess    = $utility::checkVerPhp($module);
48
    $configurator  = new Configurator();
49
    $migrator      = new Migrate($configurator);
50
    $migrator->synchronizeSchema();
51
52
    return $xoopsSuccess && $phpSuccess;
53
}
54
55
/**
56
 * Performs tasks required during update of the module
57
 * @param \XoopsModule $module {@link XoopsModule}
58
 * @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...
59
 *
60
 * @return bool true if update successful, false if not
61
 */
62
function xoops_module_update_suico(
63
    XoopsModule $module,
64
    $previousVersion = null
65
) {
66
    $moduleDirName      = \basename(\dirname(__DIR__));
67
    $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
0 ignored issues
show
The assignment to $moduleDirNameUpper is dead and can be removed.
Loading history...
68
69
    $helper       = Helper::getInstance();
70
    $utility      = new Utility();
71
    $configurator = new Configurator();
72
    $helper->loadLanguage('common');
73
    $migrator = new Migrate($configurator);
74
    $migrator->synchronizeSchema();
75
    if ($previousVersion < 360) {
76
        //rename column EXAMPLE
77
        //        $tables = new Tables();
78
        //        $table = 'xxxx_categories';
79
        //        $column = 'order';
80
        //        $newName = 'order';
81
        //        $attributes = "INT(5) NOT NULL DEFAULT '0'";
82
        //        if ($tables->useTable($table)) {
83
        //            $tables->alterColumn($table, $column, $attributes, $newName);
84
        //            if (!$tables->executeQueue()) {
85
        //                echo '<br>' . constant('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0') . ' ' . $migrate->getLastError();
86
        //            }
87
        //        }
88
        //delete old HTML templates
89
        if (count($configurator->templateFolders) > 0) {
90
            foreach ($configurator->templateFolders as $folder) {
91
                $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder);
92
                if (is_dir($templateFolder)) {
93
                    $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']);
94
                    foreach ($templateList as $k => $v) {
95
                        $fileInfo = new SplFileInfo($templateFolder . $v);
96
                        if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) {
97
                            if (is_file($templateFolder . $v)) {
98
                                if (false === @\unlink($templateFolder . $v)) {
99
                                    throw new \RuntimeException('The file ' . $templateFolder . $v . ' could not be deleted.');
100
                                }
101
                            }
102
                        }
103
                    }
104
                }
105
            }
106
        }
107
        //  ---  DELETE OLD FILES ---------------
108
        if (count($configurator->oldFiles) > 0) {
109
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
110
            foreach (
111
                array_keys(
112
                    $configurator->oldFiles
113
                ) as $i
114
            ) {
115
                $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]);
116
                if (is_file($tempFile)) {
117
                    if (false === @\unlink($tempFile)) {
118
                        throw new \RuntimeException('The file ' . $tempFile . ' could not be deleted.');
119
                    }
120
                }
121
            }
122
        }
123
        //  ---  DELETE OLD FOLDERS ---------------
124
        xoops_load('XoopsFile');
125
        if (count($configurator->oldFolders) > 0) {
126
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
127
            foreach (
128
                array_keys(
129
                    $configurator->oldFolders
130
                ) as $i
131
            ) {
132
                $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]);
133
                /** @var XoopsObjectHandler $folderHandler */
134
                $folderHandler = XoopsFile::getHandler(
135
                    'folder',
136
                    $tempFolder
137
                );
138
                $folderHandler->delete($tempFolder);
139
            }
140
        }
141
        //  ---  CREATE UPLOAD FOLDERS ---------------
142
        if (count($configurator->uploadFolders) > 0) {
143
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
144
            foreach (
145
                array_keys(
146
                    $configurator->uploadFolders
147
                ) as $i
148
            ) {
149
                $utility::createFolder($configurator->uploadFolders[$i]);
150
            }
151
        }
152
        //  ---  COPY blank.png FILES ---------------
153
        if (count($configurator->copyBlankFiles) > 0) {
154
            $file = \dirname(__DIR__) . '/assets/images/blank.png';
155
            foreach (array_keys($configurator->copyBlankFiles) as $i) {
156
                $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
157
                $utility::copyFile($file, $dest);
158
            }
159
        }
160
        //delete .html entries from the tpl table
161
        $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix(
162
                'tplfile'
163
            ) . " WHERE `tpl_module` = '" . $module->getVar(
164
                'dirname',
165
                'n'
166
            ) . "' AND `tpl_file` LIKE '%.html%'";
167
        $GLOBALS['xoopsDB']->queryF($sql);
168
        /** @var XoopsGroupPermHandler $grouppermHandler */
169
        $grouppermHandler = xoops_getHandler('groupperm');
170
171
        return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read');
172
    }
173
    $profileHandler = $helper->getHandler('Profile');
174
    $profileHandler->cleanOrphan($GLOBALS['xoopsDB']->prefix('users'), 'uid', 'profile_id');
175
    $fieldHandler = $helper->getHandler('Field');
176
    $user_fields  = $fieldHandler->getUserVars();
177
    $criteria     = new Criteria('field_name', "('" . implode("', '", $user_fields) . "')", 'IN');
178
    $fieldHandler->updateAll('field_config', 0, $criteria);
179
180
    return true;
181
}
182