Issues (57)

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