Issues (621)

Security Analysis    not enabled

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits of
4
 supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit
6
 authors.
7
8
 This program is distributed in the hope that it will be useful, but
9
 WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
13
/**
14
 * Module: xForms
15
 *
16
 * @package   \XoopsModules\Smallworld
17
 * @author    Richard Griffith <[email protected]>
18
 * @author    trabis <[email protected]>
19
 * @author    XOOPS Module Development Team
20
 * @copyright Copyright (c) 2001-2020 {@link https://xoops.org XOOPS Project}
21
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GNU Public License
22
 * @link      https://github.com/XoopsModules25x/smallworld
23
 */
24
25
use XoopsModules\Smallworld;
26
use XoopsModules\Smallworld\Helper;
27
use XoopsModules\Smallworld\Utility;
28
29
/**
30
 * @internal {Make sure you PROTECT THIS FILE}
31
 */
32
if ((!defined('XOOPS_ROOT_PATH'))
33
    || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)
0 ignored issues
show
The class XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
34
    || !($GLOBALS['xoopsUser']->isAdmin())) {
35
    exit('Restricted access' . PHP_EOL);
36
}
37
/**
38
 * Prepares system prior to attempting to update module
39
 *
40
 * @param \XoopsModule $module {@link \XoopsModule}
41
 * @return bool true if ready to install, false if not
42
 */
43
function xoops_module_pre_update_smallworld(\XoopsModule $module)
44
{
45
    /**
46
     * @var Smallworld\Helper  $helper
47
     * @var Smallworld\Utility $utility
48
     */
49
    $helper       = Smallworld\Helper::getInstance();
50
    $utility      = new Smallworld\Utility();
51
    $xoopsSuccess = $utility::checkVerXoops($module);
52
    $phpSuccess   = $utility::checkVerPhp($module);
53
54
    return $xoopsSuccess && $phpSuccess;
55
}
56
57
/**
58
 * Update Smallworld module
59
 *
60
 * @param \XoopsModule $module
61
 * @return bool true on succeess, false on failure
62
 */
63
function xoops_module_update_smallworld(\XoopsModule $module)
64
{
65
    $tables = new \Xmf\Database\Tables();
66
67
    $cTable   = 'config';
68
    $criteria = new \Criteria('conf_name', 'smallworldprivorpub', '=');
69
    if ($success = $tables->useTable($cTable)) {
70
        $success = $tables->update($cTable, ['conf_value' => 1], $criteria);
71
    }
72
73
    $msgTable = 'smallworld_messages';
74
    $column   = 'message';
75 View Code Duplication
    if ($successA = $tables->useTable($msgTable)) { // if this returns false, there is no table
76
        $attributes = $tables->getColumnAttributes($msgTable, $column);
77
        if (false === mb_strpos($attributes, ' TEXT')) { // assumes it's already been updated if TEXT found
78
            $successA = $tables->alterColumn($msgTable, $column, ' TEXT ');
79
        }
80
    }
81
82
    $comTable = 'smallworld_comments';
83
    $column   = 'comment';
84 View Code Duplication
    if ($successB = $tables->useTable($comTable)) { // if this returns false, there is no table
85
        $attributes = $tables->getColumnAttributes($comTable, $column);
86
        if (false === mb_strpos($attributes, ' TEXT')) { // assumes it's already been updated if 'TEXT' not found
87
            $successB = $tables->alterColumn($comTable, $column, ' TEXT ');
88
        }
89
    }
90
91
    // now create smallworld_settings table if it doesn't exist
92
    $sTable = 'smallworld_settings';
93
    if (false === ($successC = $tables->useTable($sTable))) { // if this returns true then the table exists already
94
        // Table does not exist -> create
95
        $successC = $tables->addTable($sTable);
96
        $successC = $successC && ($tables->setTableOptions($sTable, 'ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1'));
97
        $successC = $successC && ($tables->addColumn($sTable, 'id', 'INT(11) NOT NULL AUTO_INCREMENT'));
98
        $successC = $successC && ($tables->addColumn($sTable, 'userid', 'INT(11) NOT NULL'));
99
        $successC = $successC && ($tables->addColumn($sTable, 'value', 'TEXT'));
100
        $successC = $successC && ($tables->addPrimaryKey($sTable, 'id'));
101
    }
102
103
    $successD = $tables->executeQueue();  // change the tables
104
105
    // setup the criteria to update the avatar fields
106
    $criteria = new \CriteriaCompo();
107
    $criteria->add(new \Criteria('userimage', 'blank.gif', '='));
108
    $criteria->add(new \Criteria('userimage', '\.(jpe?g|gif|png|bmp)', 'NOT REGEXP'), 'OR');
109
110
    // update the admin avatar
111
    $aTable = 'smallworld_admin';
112
    if ($successE = $tables->useTable($aTable)) {
113
        $successE = $tables->update($aTable, ['userimage' => ''], $criteria);
114
    }
115
    // update user table avatar
116
    $uTable = 'smallworld_user';
117
    if ($successF = $tables->useTable($uTable)) {
118
        $successF = $tables->update($uTable, ['userimage' => ''], $criteria);
119
    }
120
121
    return $success && $successA && $successB && $successC && $successD && $successE && $successF;
122
}
123