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/Files/User/UserRate.php (6 issues)

1
<?php namespace XoopsModules\Tdmcreate\Files\User;
2
3
use XoopsModules\Tdmcreate;
4
use XoopsModules\Tdmcreate\Files;
5
6
/*
7
 You may not change or alter any portion of this comment or credits
8
 of supporting developers from this source code or any supporting source code
9
 which is considered copyrighted (c) material of the original comment or credit authors.
10
11
 This program is distributed in the hope that it will be useful,
12
 but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 */
15
/**
16
 * tdmcreate module.
17
 *
18
 * @copyright       XOOPS Project (https://xoops.org)
19
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
20
 *
21
 * @since           2.5.0
22
 *
23
 * @author          Txmod Xoops http://www.txmodxoops.org
24
 *
25
 * @version         $Id: UserRate.php 12258 2014-01-02 09:33:29Z timgno $
26
 */
27
28
/**
29
 * Class UserRate.
30
 */
31
class UserRate extends Files\CreateFile
32
{
33
    /**
34
     *  @public function constructor
35
     *
36
     *  @param null
37
     */
38
    public function __construct()
39
    {
40
        parent::__construct();
41
        $this->xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property xc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
42
        $this->phpcode = 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 $phpcode.

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...
43
        $this->uc = UserXoopsCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property uc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
44
    }
45
46
    /**
47
     *  @static function getInstance
48
     *
49
     *  @param null
50
     *
51
     * @return UserRate
52
     */
53
    public static function getInstance()
54
    {
55
        static $instance = false;
56
        if (!$instance) {
57
            $instance = new self();
58
        }
59
60
        return $instance;
61
    }
62
63
    /**
64
     *  @public function write
65
     *  @param string $module
66
     *  @param mixed $table
67
     *  @param string $filename
68
     */
69
    public function write($module, $table, $filename)
70
    {
71
        $this->setModule($module);
72
        $this->setTable($table);
73
        $this->setFileName($filename);
74
    }
75
76
    /**
77
     * @private function getUserRateHeader
78
     *
79
     * @param $moduleDirname
80
     * @param $tableName
81
     *
82
     * @return string
83
     */
84
    public function getUserRateHeader($moduleDirname, $tableName)
85
    {
86
        $ret = $this->getInclude();
87
        $ret .= $this->xc->getXcXoopsRequest('op', 'op', 'form');
88
        $ret .= $this->xc->getXcXoopsRequest('lid', 'lid', '', 'Int');
89
        $ret .= $this->uc->getUserTplMain($moduleDirname, $tableName);
90
        $ret .= $this->phpcode->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true);
91
        $ret .= $this->phpcode->getPhpCodeCommentLine('Define Stylesheet');
92
        $ret .= $this->xc->getXcAddStylesheet();
93
94
        return $ret;
95
    }
96
97
    /**
98
     * @private function getUserRateSwitch
99
     * @param $moduleDirname
100
     * @param $tableId
101
     * @param $tableMid
102
     * @param $tableName
103
     * @param $tableSoleName
104
     * @param $tableAutoincrement
105
     * @param $language
106
     * @return string
107
     */
108
    private function getUserRateSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language)
109
    {
110
        $fields = $this->getTableFields($tableMid, $tableId);
111
        $cases = [
112
            'form' => [$this->getUserRateForm($tableName, $language)],
113
            'save' => [$this->getUserRateSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableAutoincrement, $language)],
114
        ];
115
116
        return $this->xc->getXcSwitch('op', $cases, true, false, "\t");
117
    }
118
119
    /**
120
     * @public function getAdminPagesList
121
     * @param $tableName
122
     * @param $language
123
     *
124
     * @return string
125
     */
126
    public function getUserRateForm($tableName, $language)
127
    {
128
        $ret = $this->phpcode->getPhpCodeCommentLine('Navigation');
129
        $ret .= $this->xc->getXcEqualsOperator('$navigation', "{$language}RATE", null, false, "\t\t");
130
        $ret .= $this->xc->getXcTplAssign('navigation', '$navigation', true, "\t\t");
131
        $ret .= $this->phpcode->getPhpCodeCommentLine('Title of page', null, "\t\t");
132
        $ret .= $this->xc->getXcEqualsOperator('$title', "{$language}RATE . '&nbsp;-&nbsp;'", null, false, "\t\t");
133
        $ret .= $this->xc->getXcEqualsOperator('$title', "\$GLOBALS['xoopsModule']->name()", '.', false, "\t\t");
134
        $ret .= $this->xc->getXcTplAssign('xoops_pagetitle', '$title', true, "\t\t");
135
        $ret .= $this->phpcode->getPhpCodeCommentLine('Description', null, "\t\t");
136
        $ret .= $this->uc->getUserAddMeta('description', $language, 'RATE', "\t\t");
137
        $ret .= $this->phpcode->getPhpCodeCommentLine('Form Create', null, "\t\t");
138
        $ret .= $this->xc->getXcObjHandlerCreate($tableName, "\t\t");
139
        $ret .= $this->xc->getXcGetForm('form', $tableName, 'Obj', "\t\t");
140
        $ret .= $this->xc->getXcTplAssign('form', '$form->render()', true, "\t\t");
141
142
        return $ret;
143
    }
144
145
    /**
146
     *  @public function getUserRateSave
147
     * @param $moduleDirname
148
     * @param $fields
149
     * @param $tableName
150
     * @param $tableSoleName
151
     * @param $tableAutoincrement
152
     * @param $language
153
     * @return string
154
     */
155
    public function getUserRateSave($moduleDirname, $fields, $tableName, $tableSoleName, $tableAutoincrement, $language)
156
    {
157
        $ucfTableName = ucfirst($tableName);
0 ignored issues
show
The assignment to $ucfTableName is dead and can be removed.
Loading history...
158
        $ret = $this->phpcode->getPhpCodeCommentLine('Security Check');
159
        $xoopsSecurityCheck = $this->xc->getXcSecurityCheck();
160
        $securityError = $this->xc->getXcSecurityErrors();
161
        $implode = $this->phpcode->getPhpCodeImplode(',', $securityError);
162
        $redirectError = $this->xc->getXcRedirectHeader($tableName, '', '3', $implode, true, "\t\t\t");
163
        $ret .= $this->phpcode->getPhpCodeConditions($xoopsSecurityCheck, '', '', $redirectError, false, "\t\t");
164
        $ret .= $this->xc->getXcObjHandlerCreate($tableName, "\t\t");
165
166
        $ret .= $this->xc->getXcSaveElements($moduleDirname, $tableName, $tableSoleName, $tableAutoincrement, $fields, "\t\t");
167
168
        $ret .= $this->phpcode->getPhpCodeCommentLine('Insert Data', null, "\t\t");
169
        $insert = $this->xc->getXcInsert($tableName, $tableName, 'Obj', true);
170
        $confirmOk = $this->xc->getXcRedirectHeader('index', '', '2', "{$language}FORM_OK", true, "\t\t\t");
171
        $ret .= $this->phpcode->getPhpCodeConditions($insert, '', '', $confirmOk, false, "\t\t");
172
173
        $ret .= $this->phpcode->getPhpCodeCommentLine('Get Form Error', null, "\t\t");
174
        $ret .= $this->xc->getXcTplAssign('error', "\${$tableName}Obj->getHtmlErrors()", true, "\t\t");
175
        $ret .= $this->xc->getXcGetForm('form', $tableName, 'Obj', "\t\t");
176
        $ret .= $this->xc->getXcTplAssign('form', '$form->display()', true, "\t\t");
177
178
        return $ret;
179
    }
180
181
    /**
182
     *  @public function getUserRateFooter
183
     * @param $moduleDirname
184
     * @param $language
185
     * @return string
186
     */
187
    public function getUserRateFooter($moduleDirname, $language)
188
    {
189
        $stuModuleDirname = mb_strtoupper($moduleDirname);
0 ignored issues
show
The assignment to $stuModuleDirname is dead and can be removed.
Loading history...
190
        $ret = $this->phpcode->getPhpCodeCommentLine('Breadcrumbs');
191
        $ret .= $this->uc->getUserBreadcrumbs('RATE', $language);
192
        $ret .= $this->getInclude('footer');
193
194
        return $ret;
195
    }
196
197
    /**
198
     *  @public function render
199
     *  @param null
200
     * @return bool|string
201
     */
202
    public function render()
203
    {
204
        $module = $this->getModule();
205
        $table = $this->getTable();
206
        $filename = $this->getFileName();
207
        $moduleDirname = $module->getVar('mod_dirname');
208
        $tableId = $table->getVar('table_id');
209
        $tableMid = $table->getVar('table_mid');
210
        $tableName = $table->getVar('table_name');
211
        $tableSoleName = $table->getVar('table_solename');
212
        $tableAutoincrement = $table->getVar('table_autoincrement');
213
        $fields = $this->getTableFields($tableMid, $tableId);
0 ignored issues
show
The assignment to $fields is dead and can be removed.
Loading history...
214
        $language = $this->getLanguage($moduleDirname, 'MA');
215
        $content = $this->getHeaderFilesComments($module, $filename);
216
        $content .= $this->getUserRateHeader($moduleDirname, $tableName);
217
        $content .= $this->getUserRateSwitch($moduleDirname, $tableId, $tableMid, $tableName, $tableSoleName, $tableAutoincrement, $language);
218
        $content .= $this->getUserRateFooter($moduleDirname, $language);
219
220
        $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
221
222
        return $this->renderFile();
223
    }
224
}
225