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.

class/Files/User/UserRate.php (12 issues)

1
<?php
2
3
namespace XoopsModules\Tdmcreate\Files\User;
4
5
use XoopsModules\Tdmcreate;
6
use XoopsModules\Tdmcreate\Files;
7
8
/*
9
 You may not change or alter any portion of this comment or credits
10
 of supporting developers from this source code or any supporting source code
11
 which is considered copyrighted (c) material of the original comment or credit authors.
12
13
 This program is distributed in the hope that it will be useful,
14
 but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
/**
18
 * tdmcreate module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops http://www.txmodxoops.org
26
 *
27
 */
28
29
/**
30
 * Class UserRate.
31
 */
32
class UserRate extends Files\CreateFile
33
{
34
    /**
35
     * @var string
36
     */
37
    private $xc = null;
38
	
39
	/**
40
     * @var string
41
     */
42
    private $pc = null;
43
	
44
	/**
45
     * @var string
46
     */
47
    private $uxc = null;
48
	
49
	
50
	/**
51
     * @public function constructor
52
     *
53
     * @param null
54
     */
55
    public function __construct()
56
    {
57
        parent::__construct();
58
        $this->xc      = Tdmcreate\Files\CreateXoopsCode::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like XoopsModules\Tdmcreate\F...oopsCode::getInstance() of type XoopsModules\Tdmcreate\Files\CreateXoopsCode is incompatible with the declared type string of property $xc.

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...
59
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like XoopsModules\Tdmcreate\F...ePhpCode::getInstance() of type XoopsModules\Tdmcreate\Files\CreatePhpCode is incompatible with the declared type string of property $pc.

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...
60
        $this->uxc      = UserXoopsCode::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like XoopsModules\Tdmcreate\F...oopsCode::getInstance() of type XoopsModules\Tdmcreate\Files\User\UserXoopsCode is incompatible with the declared type string of property $uxc.

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...
61
    }
62
63
    /**
64
     * @static function getInstance
65
     *
66
     * @param null
67
     *
68
     * @return UserRate
69
     */
70
    public static function getInstance()
71
    {
72
        static $instance = false;
73
        if (!$instance) {
74
            $instance = new self();
75
        }
76
77
        return $instance;
78
    }
79
80
    /**
81
     * @public function write
82
     * @param string $module
83
     * @param mixed  $table
84
     * @param string $filename
85
     */
86
    public function write($module, $table, $filename)
87
    {
88
        $this->setModule($module);
89
        $this->setTable($table);
90
        $this->setFileName($filename);
91
    }
92
93
    /**
94
     * @private function getUserRateHeader
95
     *
96
     * @param $moduleDirname
97
     * @param $tableName
98
     *
99
     * @return string
100
     */
101
    public function getUserRateHeader($moduleDirname, $tableName)
102
    {
103
        $pc  = Tdmcreate\Files\CreatePhpCode::getInstance();
104
        $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request'], '', '');
105
        $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', '');
106
        $ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']);
107
        $ret .= $this->getInclude();
108
        $ret .= $this->xc->getXcXoopsRequest('op', 'op', 'form');
109
        $ret .= $this->xc->getXcXoopsRequest('lid', 'lid', '', 'Int');
110
        $ret .= $this->uxc->getUserTplMain($moduleDirname, $tableName);
111
        $ret .= $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true);
112
        $ret .= $this->pc->getPhpCodeCommentLine('Define Stylesheet');
113
        $ret .= $this->xc->getXcXoThemeAddStylesheet();
114
115
        return $ret;
116
    }
117
118
    /**
119
     * @private function getUserRateSwitch
120
     * @param $moduleDirname
121
     * @param $tableId
122
     * @param $tableMid
123
     * @param $tableName
124
     * @param $tableSoleName
125
     * @param $tableAutoincrement
126
     * @param $language
127
     * @return string
128
     */
129
    private function getUserRateSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language)
0 ignored issues
show
The method getUserRateSwitch() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
130
    {
131
        $fields = $this->getTableFields($tableMid, $tableId);
132
        $cases  = [
133
            'form' => [$this->getUserRateForm($tableName, $language)],
134
            'save' => [$this->getUserRateSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableAutoincrement, $language)],
135
        ];
136
137
        return $this->xc->getXcSwitch('op', $cases, true, false, "\t");
138
    }
139
140
    /**
141
     * @public function getAdminPagesList
142
     * @param $tableName
143
     * @param $language
144
     *
145
     * @return string
146
     */
147
    public function getUserRateForm($tableName, $language)
148
    {
149
        $ret = $this->pc->getPhpCodeCommentLine('Navigation');
150
        $ret .= $this->xc->getXcEqualsOperator('$navigation', "{$language}RATE", null, "\t\t");
151
        $ret .= $this->xc->getXcXoopsTplAssign('navigation', '$navigation', true, "\t\t");
152
        $ret .= $this->pc->getPhpCodeCommentLine('Title of page', null, "\t\t");
153
        $ret .= $this->xc->getXcEqualsOperator('$title', "{$language}RATE . '&nbsp;-&nbsp;'", null, "\t\t");
154
        $ret .= $this->xc->getXcEqualsOperator('$title', "\$GLOBALS['xoopsModule']->name()", '.', "\t\t");
155
        $ret .= $this->xc->getXcXoopsTplAssign('xoops_pagetitle', '$title', true, "\t\t");
156
        $ret .= $this->pc->getPhpCodeCommentLine('Description', null, "\t\t");
157
        $ret .= $this->uxc->getUserAddMeta('description', $language, 'RATE', "\t\t");
158
        $ret .= $this->pc->getPhpCodeCommentLine('Form Create', null, "\t\t");
159
        $ret .= $this->xc->getXcHandlerCreateObj($tableName, "\t\t");
160
        $ret .= $this->xc->getXcGetForm('form', $tableName, 'Obj', "\t\t");
161
        $ret .= $this->xc->getXcXoopsTplAssign('form', '$form->render()', true, "\t\t");
162
163
        return $ret;
164
    }
165
166
    /**
167
     * @public function getUserRateSave
168
     * @param $moduleDirname
169
     * @param $fields
170
     * @param $tableName
171
     * @param $tableSoleName
172
     * @param $tableAutoincrement
173
     * @param $language
174
     * @return string
175
     */
176
    public function getUserRateSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableAutoincrement, $language)
0 ignored issues
show
The parameter $tableAutoincrement 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

176
    public function getUserRateSave($moduleDirname, $fields, $tableName, $tableSoleName, /** @scrutinizer ignore-unused */ $tableAutoincrement, $language)

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...
177
    {
178
        $ret                = $this->pc->getPhpCodeCommentLine('Security Check');
179
        $xoopsSecurityCheck = $this->xc->getXcXoopsSecurityCheck();
180
        $securityError      = $this->xc->getXcXoopsSecurityErrors();
181
        $implode            = $this->pc->getPhpCodeImplode(',', $securityError);
182
        $redirectError      = $this->xc->getXcRedirectHeader($tableName, '', '3', $implode, true, "\t\t\t");
183
        $ret                .= $this->pc->getPhpCodeConditions($xoopsSecurityCheck, '', '', $redirectError, false, "\t\t");
184
        $ret                .= $this->xc->getXcHandlerCreateObj($tableName, "\t\t");
185
186
        $ret .= $this->xc->getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $fields, "\t\t");
187
188
        $ret       .= $this->pc->getPhpCodeCommentLine('Insert Data', null, "\t\t");
189
        $insert    = $this->xc->getXcHandlerInsert($tableName, $tableName, 'Obj', true);
190
        $confirmOk = $this->xc->getXcRedirectHeader('index', '', '2', "{$language}FORM_OK", true, "\t\t\t");
191
        $ret       .= $this->pc->getPhpCodeConditions($insert, '', '', $confirmOk, false, "\t\t");
192
193
        $ret .= $this->pc->getPhpCodeCommentLine('Get Form Error', null, "\t\t");
194
        $ret .= $this->xc->getXcXoopsTplAssign('error', "\${$tableName}Obj->getHtmlErrors()", true, "\t\t");
195
        $ret .= $this->xc->getXcGetForm('form', $tableName, 'Obj', "\t\t");
196
        $ret .= $this->xc->getXcXoopsTplAssign('form', '$form->display()', true, "\t\t");
197
198
        return $ret;
199
    }
200
201
    /**
202
     * @public function getUserRateFooter
203
     * @param $moduleDirname
204
     * @param $language
205
     * @return string
206
     */
207
    public function getUserRateFooter($moduleDirname, $language)
0 ignored issues
show
The parameter $moduleDirname 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

207
    public function getUserRateFooter(/** @scrutinizer ignore-unused */ $moduleDirname, $language)

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...
208
    {
209
        $ret              = $this->pc->getPhpCodeCommentLine('Breadcrumbs');
210
        $ret              .= $this->uxc->getUserBreadcrumbs('RATE', $language);
211
        $ret              .= $this->getInclude('footer');
212
213
        return $ret;
214
    }
215
216
    /**
217
     * @public function render
218
     * @param null
219
     * @return bool|string
220
     */
221
    public function render()
222
    {
223
        $module             = $this->getModule();
224
        $table              = $this->getTable();
225
        $filename           = $this->getFileName();
226
        $moduleDirname      = $module->getVar('mod_dirname');
227
        $tableId            = $table->getVar('table_id');
0 ignored issues
show
The assignment to $tableId is dead and can be removed.
Loading history...
228
        $tableMid           = $table->getVar('table_mid');
0 ignored issues
show
The assignment to $tableMid is dead and can be removed.
Loading history...
229
        $tableName          = $table->getVar('table_name');
0 ignored issues
show
The assignment to $tableName is dead and can be removed.
Loading history...
230
        $tableSoleName      = $table->getVar('table_solename');
0 ignored issues
show
The assignment to $tableSoleName is dead and can be removed.
Loading history...
231
        $tableAutoincrement = $table->getVar('table_autoincrement');
0 ignored issues
show
The assignment to $tableAutoincrement is dead and can be removed.
Loading history...
232
        $language           = $this->getLanguage($moduleDirname, 'MA');
0 ignored issues
show
The assignment to $language is dead and can be removed.
Loading history...
233
        $content            = $this->getHeaderFilesComments($module);
234
        //$content            .= $this->getUserRateHeader($moduleDirname, $tableName);
235
        //$content            .= $this->getUserRateSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language);
236
        //$content            .= $this->getUserRateFooter($moduleDirname, $language);
237
238
        $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
239
240
        return $this->renderFile();
241
    }
242
}
243