Issues (964)

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.

commonfiles/include/update.php (5 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
 * Tdmcreate module for xoops
14
 *
15
 * @param mixed      $module
16
 * @param null|mixed $prev_version
17
 * @package        Tdmcreate
18
 * @since          1.0
19
 * @min_xoops      2.5.9
20
 * @author         Wedega - Email:<[email protected]> - Website:<https://wedega.com>
21
 * @version        $Id: 1.0 update.php 1 Mon 2018-03-19 10:04:53Z XOOPS Project (www.xoops.org) $
22
 * @copyright      module for xoops
23
 * @license        GPL 2.0 or later
24
 */
25
26
/**
27
 * @param      $module
28
 * @param null $prev_version
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $prev_version is correct as it would always require null to be passed?
Loading history...
29
 *
30
 * @return bool|null
31
 */
32
function xoops_module_update_tdmcreate(&$module, $prev_version = null)
33
{
34
    $ret = null;
35
    if ($prev_version < 10) {
36
        $ret = update_tdmcreate_v10($module);
0 ignored issues
show
The assignment to $ret is dead and can be removed.
Loading history...
37
    }
38
39
    $ret = tdmcreate_check_db($module);
40
41
    //check upload directory
42
	include_once __DIR__ . '/install.php';
43
    $ret = xoops_module_install_tdmcreate($module);
44
45
    $errors = $module->getErrors();
46
    if (!empty($errors)) {
47
        print_r($errors);
48
    }
49
50
    return $ret;
51
52
}
53
54
// irmtfan bug fix: solve templates duplicate issue
55
/**
56
 * @param $module
57
 *
58
 * @return bool
59
 */
60
function update_tdmcreate_v10($module)
61
{
62
    global $xoopsDB;
63
    $result = $xoopsDB->query(
64
        'SELECT t1.tpl_id FROM ' . $xoopsDB->prefix('tplfile') . ' t1, ' . $xoopsDB->prefix('tplfile') . ' t2 WHERE t1.tpl_refid = t2.tpl_refid AND t1.tpl_module = t2.tpl_module AND t1.tpl_tplset=t2.tpl_tplset AND t1.tpl_file = t2.tpl_file AND t1.tpl_type = t2.tpl_type AND t1.tpl_id > t2.tpl_id'
65
    );
66
    $tplids = [];
67
    while (false !== (list($tplid) = $xoopsDB->fetchRow($result))) {
68
        $tplids[] = $tplid;
69
    }
70
    if (count($tplids) > 0) {
71
        $tplfileHandler  = xoops_getHandler('tplfile');
72
        $duplicate_files = $tplfileHandler->getObjects(new \Criteria('tpl_id', '(' . implode(',', $tplids) . ')', 'IN'));
0 ignored issues
show
The method getObjects() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of said class. However, the method does not exist in XoopsRankHandler or XoUserHandler. Are you sure you never get one of those? ( Ignorable by Annotation )

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

72
        /** @scrutinizer ignore-call */ 
73
        $duplicate_files = $tplfileHandler->getObjects(new \Criteria('tpl_id', '(' . implode(',', $tplids) . ')', 'IN'));
Loading history...
73
74
        if (count($duplicate_files) > 0) {
75
            foreach (array_keys($duplicate_files) as $i) {
76
                $tplfileHandler->delete($duplicate_files[$i]);
77
            }
78
        }
79
    }
80
    $sql = 'SHOW INDEX FROM ' . $xoopsDB->prefix('tplfile') . " WHERE KEY_NAME = 'tpl_refid_module_set_file_type'";
81
    if (!$result = $xoopsDB->queryF($sql)) {
82
        xoops_error($xoopsDB->error() . '<br>' . $sql);
83
84
        return false;
85
    }
86
    $ret = [];
87
    while (false !== ($myrow = $xoopsDB->fetchArray($result))) {
88
        $ret[] = $myrow;
89
    }
90
    if (!empty($ret)) {
91
        $module->setErrors("'tpl_refid_module_set_file_type' unique index is exist. Note: check 'tplfile' table to be sure this index is UNIQUE because XOOPS CORE need it.");
92
93
        return true;
94
    }
95
    $sql = 'ALTER TABLE ' . $xoopsDB->prefix('tplfile') . ' ADD UNIQUE tpl_refid_module_set_file_type ( tpl_refid, tpl_module, tpl_tplset, tpl_file, tpl_type )';
96
    if (!$result = $xoopsDB->queryF($sql)) {
0 ignored issues
show
The assignment to $result is dead and can be removed.
Loading history...
97
        xoops_error($xoopsDB->error() . '<br>' . $sql);
98
        $module->setErrors("'tpl_refid_module_set_file_type' unique index is not added to 'tplfile' table. Warning: do not use XOOPS until you add this unique index.");
99
100
        return false;
101
    }
102
103
    return true;
104
}
105
106
// irmtfan bug fix: solve templates duplicate issue
107
108
/**
109
 * @param $module
110
 *
111
 * @return bool
112
 */
113
function tdmcreate_check_db($module)
0 ignored issues
show
The parameter $module is not used and could be removed. ( Ignorable by Annotation )

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

113
function tdmcreate_check_db(/** @scrutinizer ignore-unused */ $module)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
114
{
115
    $ret = true;
116
	//insert here code for database check
117
118
    /*
119
    // Example: update table (add new field)
120
    $table   = $GLOBALS['xoopsDB']->prefix('tdmcreate_images');
121
    $field   = 'img_exif';
122
    $check   = $GLOBALS['xoopsDB']->queryF('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $field . "'");
123
    $numRows = $GLOBALS['xoopsDB']->getRowsNum($check);
124
    if (!$numRows) {
125
        $sql = "ALTER TABLE `$table` ADD `$field` TEXT NULL AFTER `img_state`;";
126
        if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
127
            xoops_error($GLOBALS['xoopsDB']->error() . '<br>' . $sql);
128
            $module->setErrors("Error when adding '$field' to table '$table'.");
129
            $ret = false;
130
        }
131
    }
132
133
    // Example: create new table
134
    $table   = $GLOBALS['xoopsDB']->prefix('tdmcreate_categories');
135
    $check   = $GLOBALS['xoopsDB']->queryF("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='$table'");
136
    $numRows = $GLOBALS['xoopsDB']->getRowsNum($check);
137
    if (!$numRows) {
138
        // create new table 'tdmcreate_categories'
139
        $sql = "CREATE TABLE `$table` (
140
                  `cat_id`        INT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
141
                  `cat_text`      VARCHAR(100)    NOT NULL DEFAULT '',
142
                  `cat_date`      INT(8)          NOT NULL DEFAULT '0',
143
                  `cat_submitter` INT(8)          NOT NULL DEFAULT '0',
144
                  PRIMARY KEY (`cat_id`)
145
                ) ENGINE=InnoDB;";
146
        if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
147
            xoops_error($GLOBALS['xoopsDB']->error() . '<br>' . $sql);
148
            $module->setErrors("Error when creating table '$table'.");
149
            $ret = false;
150
        }
151
    }
152
    */
153
    return $ret;
154
}
155