Issues (733)

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
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    {@link https://xoops.org/ XOOPS Project}
14
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package      extcal
16
 * @since
17
 * @author       XOOPS Development Team,
18
 */
19
20
use XoopsModules\Extcal\{Helper,
21
    Utility,
22
    Common
23
};
24
25
if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)
26
    || !$GLOBALS['xoopsUser']->isAdmin()) {
27
    exit('Restricted access' . PHP_EOL);
28
}
29
30
31
32
/**
33
 * Prepares system prior to attempting to install module
34
 * @param \XoopsModule $module {@link XoopsModule}
35
 *
36
 * @return bool true if ready to install, false if not
37
 */
38
function xoops_module_pre_update_extcal(\XoopsModule $module)
39
{
40
    $utility = new Utility();
41
42
    $xoopsSuccess = $utility::checkVerXoops($module);
43
    $phpSuccess   = $utility::checkVerPhp($module);
44
45
    return $xoopsSuccess && $phpSuccess;
46
47
    /*
48
49
    //    XoopsLoad::load('migrate', 'extcal');
50
    $configurator = new Common\Configurator();
51
52
    //create upload folders
53
    $uploadFolders = $configurator->uploadFolders;
54
    foreach ($uploadFolders as $value) {
55
        $utility::prepareFolder($value);
56
    }
57
58
    $migrator = new Common\Migrate($configurator);
59
    $migrator->synchronizeSchema();
60
61
    return true;
62
    */
63
}
64
65
/**
66
 * Performs tasks required during update of the module
67
 * @param \XoopsModule $module {@link XoopsModule}
68
 * @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...
69
 *
70
 * @return bool true if update successful, false if not
71
 */
72
function xoops_module_update_extcal(\XoopsModule $module, $previousVersion = null)
73
{
74
    //    global $xoopsDB;
75
    $moduleDirName = basename(dirname(__DIR__));
76
77
    $newVersion = $module->getVar('version') * 100;
78
    if ($newVersion == $previousVersion) {
79
        return true;
80
    }
81
82
    $fld = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/versions/';
83
    $cls = 'Extcal_%1$s';
84
85
    $version = [
86
        '2_04' => 204,
87
        '2_15' => 215,
88
        '2_21' => 221,
89
        '2_28' => 228,
90
        '2_29' => 229,
91
        '2_33' => 233,
92
        '2_34' => 234,
93
        '2_35' => 235,
94
        '2_37' => 237,
95
    ];
96
97
    //    while (list($key, $val) = each($version)) {
98
    foreach ($version as $key => $val) {
99
        if ($previousVersion < $val) {
100
            $name = sprintf($cls, $key);
101
            $f    = $fld . $name . '.php';
102
            //ext_echo ("<hr>{$f}<hr>");
103
            if (is_readable($f)) {
104
                echo "update version: {$key} = {$val}<br>";
105
                require_once $f;
106
                $cl = new $name($module, ['previousVersion' => $previousVersion]);
0 ignored issues
show
The assignment to $cl is dead and can be removed.
Loading history...
107
            }
108
        }
109
    }
110
111
    $moduleDirNameUpper = mb_strtoupper($moduleDirName);
0 ignored issues
show
The assignment to $moduleDirNameUpper is dead and can be removed.
Loading history...
112
113
    /** @var Utility $utility */
114
    /** @var Common\Configurator $configurator */
115
    $utility      = new Utility();
116
    $configurator = new Common\Configurator();
117
118
    $migrator = new Common\Migrate($configurator);
0 ignored issues
show
The call to XoopsModules\Extcal\Common\Migrate::__construct() has too many arguments starting with $configurator. ( Ignorable by Annotation )

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

118
    $migrator = /** @scrutinizer ignore-call */ new Common\Migrate($configurator);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
119
    $migrator->synchronizeSchema();
120
121
    if ($previousVersion < 241) {
122
        //delete old HTML templates
123
        if (count($configurator->templateFolders) > 0) {
124
            foreach ($configurator->templateFolders as $folder) {
125
                $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder);
126
                if (is_dir($templateFolder)) {
127
                    $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']);
128
                    foreach ($templateList as $k => $v) {
129
                        $fileInfo = new \SplFileInfo($templateFolder . $v);
130
                        if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) {
131
                            if (is_file($templateFolder . $v)) {
132
                                unlink($templateFolder . $v);
133
                            }
134
                        }
135
                    }
136
                }
137
            }
138
        }
139
140
        //  ---  COPY blank.png FILES ---------------
141
        if (count($configurator->copyBlankFiles) > 0) {
142
            $file = dirname(__DIR__) . '/assets/images/blank.png';
143
            foreach (array_keys($configurator->copyBlankFiles) as $i) {
144
                $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
145
                $utility::copyFile($file, $dest);
146
            }
147
        }
148
149
        //  ---  DELETE OLD FILES ---------------
150
        if (count($configurator->oldFiles) > 0) {
151
            //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
152
            foreach (array_keys($configurator->oldFiles) as $i) {
153
                $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]);
154
                if (is_file($tempFile)) {
155
                    unlink($tempFile);
156
                }
157
            }
158
        }
159
160
        //---------------------
161
162
        //delete .html entries from the tpl table
163
        $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
164
        $GLOBALS['xoopsDB']->queryF($sql);
165
166
        // Load class XoopsFile ====================
167
        xoops_load('XoopsFile');
168
169
        //delete /images directory ============
170
        $imagesDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/images/');
171
        $folderHandler   = \XoopsFile::getHandler('folder', $imagesDirectory);
172
        $folderHandler->delete($imagesDirectory);
173
    }
174
    /** @var \XoopsGroupPermHandler $grouppermHandler */
175
    $grouppermHandler = xoops_getHandler('groupperm');
176
177
    return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read');
178
}
179