Issues (519)

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.

class/helper0.php (8 issues)

1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       XOOPS Project (https://xoops.org)
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          trabis <[email protected]>
21
 *
22
 * @version         $Id: helper.php 12258 2014-04-12 23:45:12Z timgno $
23
 */
24
25
/**
26
 * Class TDMCreateHelper.
27
 */
28
class TDMCreateHelper
29
{
30
    /**
31
     * @var string
32
     */
33
    private $dirname;
34
    /**
35
     * @var string
36
     */
37
    private $module;
38
    /**
39
     * @var string
40
     */
41
    private $handler;
42
    /**
43
     * @var string
44
     */
45
    private $config;
46
    /**
47
     * @var string
48
     */
49
    private $debug;
50
    /*
51
    *  @protected function constructor class
52
    *  @param mixed $debug
53
    */
54
    /**
55
     * @param $debug
56
     */
57
    public function __construct($debug)
58
    {
59
        $this->debug = $debug;
60
        $this->dirname = basename(dirname(__DIR__));
61
    }
62
63
    /*
64
    *  @static function getInstance
65
    *  @param mixed $debug
66
    */
67
    /**
68
     * @param bool $debug
69
     *
70
     * @return Tdmcreate\Helper
0 ignored issues
show
The type Tdmcreate\Helper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
71
     */
72
    public static function getInstance($debug = false)
73
    {
74
        static $instance = false;
75
        if (!$instance) {
76
            $instance = new self($debug);
77
        }
78
79
        return $instance;
80
    }
81
82
    /*
83
    *  @static function getModule
84
    *  @param null
85
    */
86
    /**
87
     * @return string
88
     */
89
    public function &getModule()
90
    {
91
        if (null === $this->module) {
92
            $this->initModule();
93
        }
94
95
        return $this->module;
96
    }
97
98
    /*
99
    *  @static function getConfig
100
    *  @param string $name
101
    */
102
    /**
103
     * @param null $name
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $name is correct as it would always require null to be passed?
Loading history...
104
     *
105
     * @return null|string
106
     */
107
    public function getConfig($name = null)
108
    {
109
        if (null === $this->config) {
110
            $this->initConfig();
111
        }
112
        if (!$name) {
0 ignored issues
show
$name is of type null, thus it always evaluated to false.
Loading history...
113
            $this->addLog('Getting all config');
114
115
            return $this->config;
116
        }
117
        if (!isset($this->config[$name])) {
118
            $this->addLog("ERROR :: CONFIG '{$name}' does not exist");
119
120
            return false;
121
        }
122
        $this->addLog("Getting config '{$name}' : ".$this->config[$name]);
123
124
        return $this->config[$name];
125
    }
126
127
    /*
128
    *  @static function setConfig
129
    *  @param string $name
130
    *  @param mixed $value
131
    */
132
    /**
133
     * @param null $name
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $name is correct as it would always require null to be passed?
Loading history...
134
     * @param null $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
135
     *
136
     * @return mixed
137
     */
138
    public function setConfig($name = null, $value = null)
139
    {
140
        if (null === $this->config) {
141
            $this->initConfig();
142
        }
143
        $this->config[$name] = $value;
144
        $this->addLog("Setting config '{$name}' : ".$this->config[$name]);
145
146
        return $this->config[$name];
147
    }
148
149
    /*
150
    *  @static function getHandler
151
    *  @param string $name
152
    */
153
    /**
154
     * @param $name
155
     *
156
     * @return mixed
157
     */
158
    public function &getHandler($name)
159
    {
160
        if (!isset($this->handler[$name.'Handler'])) {
161
            $this->initHandler($name);
162
        }
163
        $this->addLog("Getting handler '{$name}'");
164
165
        return $this->handler[$name.'Handler'];
166
    }
167
168
    /*
169
    *  @static function initModule
170
    *  @param null
171
    */
172
    public function initModule()
173
    {
174
        global $xoopsModule;
175
        if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $this->dirname) {
176
            $this->module = $xoopsModule;
0 ignored issues
show
Documentation Bug introduced by
It seems like $xoopsModule of type object is incompatible with the declared type string of property $module.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
177
        } else {
178
            $hModule = xoops_getHandler('module');
179
            $this->module = $hModule->getByDirname($this->dirname);
0 ignored issues
show
The method getByDirname() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsModuleHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

179
            /** @scrutinizer ignore-call */ 
180
            $this->module = $hModule->getByDirname($this->dirname);
Loading history...
180
        }
181
        $this->addLog('INIT MODULE');
182
    }
183
184
    /*
185
    *  @static function initConfig
186
    *  @param null
187
    */
188
    public function initConfig()
189
    {
190
        $this->addLog('INIT CONFIG');
191
        $hModConfig = xoops_getHandler('config');
192
        $this->config = $hModConfig->getConfigsByCat(0, $this->getModule()->getVar('mid'));
0 ignored issues
show
The method getConfigsByCat() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

192
        /** @scrutinizer ignore-call */ 
193
        $this->config = $hModConfig->getConfigsByCat(0, $this->getModule()->getVar('mid'));
Loading history...
193
    }
194
195
    /*
196
    *  @static function initHandler
197
    *  @param string $name
198
    */
199
    /**
200
     * @param $name
201
     */
202
    public function initHandler($name)
203
    {
204
        $this->addLog('INIT '.$name.' HANDLER');
205
        $this->handler[$name.'Handler'] = xoops_getModuleHandler($name, $this->dirname);
206
    }
207
208
    /*
209
    *  @static function addLog
210
    *  @param string $log
211
    */
212
    /**
213
     * @param $log
214
     */
215
    public function addLog($log)
216
    {
217
        if ($this->debug && is_object($GLOBALS['xoopsLogger'])) {
218
            $GLOBALS['xoopsLogger']->addExtra($this->module->name(), $log);
219
        }
220
    }
221
}
222