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/UserPages.php (3 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: pages.php 12258 2014-01-02 09:33:29Z timgno $
26
 */
27
28
/**
29
 * Class UserPages.
30
 */
31
class UserPages extends Files\CreateFile
32
{
33
    /**
34
     *  @public function constructor
35
     *  @param null
36
     */
37
    public function __construct()
38
    {
39
        parent::__construct();
40
    }
41
42
    /**
43
     *  @static function getInstance
44
     *  @param null
45
     * @return UserPages
46
     */
47
    public static function getInstance()
48
    {
49
        static $instance = false;
50
        if (!$instance) {
51
            $instance = new self();
52
        }
53
54
        return $instance;
55
    }
56
57
    /**
58
     * @public function write
59
     * @param $module
60
     * @param $table
61
     * @param $filename
62
     */
63
    public function write($module, $table, $filename)
64
    {
65
        $this->setModule($module);
66
        $this->setTable($table);
67
        $this->setFileName($filename);
68
    }
69
70
    /**
71
     * @private function getUserPagesHeader
72
     * @param $moduleDirname
73
     * @param $tableName
74
     * @return string
75
     */
76
    private function getUserPagesHeader($moduleDirname, $tableName)
77
    {
78
        $pc = Tdmcreate\Files\CreatePhpCode::getInstance();
79
        $xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
80
        $uc = UserXoopsCode::getInstance();
81
        $ret = $this->getInclude();
82
        $ret .= $uc->getUserTplMain($moduleDirname, $tableName);
83
        $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true);
84
        $ret .= $xc->getXcXoopsRequest('start', 'start', '0', 'Int');
85
        $userpager = $xc->getXcGetConfig($moduleDirname, 'userpager');
86
        $ret .= $xc->getXcXoopsRequest('limit', 'limit', $userpager, 'Int');
87
        $ret .= $pc->getPhpCodeCommentLine('Define Stylesheet');
88
        $ret .= $xc->getXcAddStylesheet();
89
90
        return $ret;
91
    }
92
93
    /**
94
     * @private function getUserPages
95
     * @param $moduleDirname
96
     * @param $tableName
97
     * @param $tableSoleName
98
     * @return string
99
     */
100
    private function getUserPages($moduleDirname, $tableName, $tableSoleName)
0 ignored issues
show
The parameter $tableSoleName 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

100
    private function getUserPages($moduleDirname, $tableName, /** @scrutinizer ignore-unused */ $tableSoleName)

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...
101
    {
102
        $pc = Tdmcreate\Files\CreatePhpCode::getInstance();
103
        $xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
104
        $stuModuleDirname = mb_strtoupper($moduleDirname);
105
        $ucfTableName = ucfirst($tableName);
106
        $t = "\t";
107
        $ret = $pc->getPhpCodeCommentLine();
108
        $ret .= $xc->getXcTplAssign('xoops_icons32_url', 'XOOPS_ICONS32_URL');
109
        $ret .= $xc->getXcTplAssign("{$moduleDirname}_url", "{$stuModuleDirname}_URL");
110
        $ret .= $pc->getPhpCodeCommentLine();
111
        $ret .= $xc->getXcObjHandlerCount($tableName);
112
        $ret .= $xc->getXcObjHandlerAll($tableName, '', '$start', '$limit');
113
        $ret .= $pc->getPhpCodeArray('keywords', null, false, '');
114
        $condIf = $pc->getPhpCodeArray($tableName, null, false, $t);
115
        $condIf .= $pc->getPhpCodeCommentLine('Get All', $ucfTableName, $t);
116
        $foreach = $xc->getXcGetValues($tableName, $tableName . '[]', 'i', false, $t);
117
118
        $table = $this->getTable();
119
        // Fields
120
        $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'));
121
        foreach (array_keys($fields) as $f) {
122
            $fieldName = $fields[$f]->getVar('field_name');
123
            if (1 == $fields[$f]->getVar('field_main')) {
124
                $fieldMain = $fieldName; // fieldMain = fields parameters main field
125
            }
126
        }
127
        $foreach .= $xc->getXcGetVar('keywords[]', "{$tableName}All[\$i]", $fieldMain, false, $t . "\t");
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $fieldMain does not seem to be defined for all execution paths leading up to this point.
Loading history...
128
        $condIf .= $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach, $t);
129
        $condIf .= $xc->getXcTplAssign($tableName, "\${$tableName}", true, $t);
130
        $condIf .= $pc->getPhpCodeUnset($tableName, $t);
131
        $condIf .= $xc->getXcPageNav($tableName, $t);
132
        $tableType = $xc->getXcGetConfig($moduleDirname, 'table_type');
133
        $condIf .= $xc->getXcTplAssign('type', $tableType, true, $t);
134
        $divideby = $xc->getXcGetConfig($moduleDirname, 'divideby');
135
        $condIf .= $xc->getXcTplAssign('divideby', $divideby, true, $t);
136
        $numbCol = $xc->getXcGetConfig($moduleDirname, 'numb_col');
137
        $condIf .= $xc->getXcTplAssign('numb_col', $numbCol, true, $t);
138
139
        $ret .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $condIf);
140
141
        return $ret;
142
    }
143
144
    /**
145
     * @private function getUserPagesFooter
146
     * @param $moduleDirname
147
     * @param $tableName
148
     * @param $tableSoleName
149
     * @param $language
150
     *
151
     * @return string
152
     */
153
    private function getUserPagesFooter($moduleDirname, $tableName, $tableSoleName, $language)
154
    {
155
        $pc = Tdmcreate\Files\CreatePhpCode::getInstance();
156
        $xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
157
        $uc = UserXoopsCode::getInstance();
158
        $stuModuleDirname = mb_strtoupper($moduleDirname);
159
        $stuTableName = mb_strtoupper($tableName);
160
        $stuTableSoleName = mb_strtoupper($tableSoleName);
0 ignored issues
show
The assignment to $stuTableSoleName is dead and can be removed.
Loading history...
161
        $ret = $pc->getPhpCodeCommentLine('Breadcrumbs');
162
        $ret .= $uc->getUserBreadcrumbs($language, $stuTableName);
163
        $ret .= $pc->getPhpCodeCommentLine('Keywords');
164
        $ret .= $uc->getUserMetaKeywords($moduleDirname);
165
        $ret .= $pc->getPhpCodeUnset('keywords');
166
        $ret .= $pc->getPhpCodeCommentLine('Description');
167
        $ret .= $uc->getUserMetaDesc($moduleDirname, $language, $stuTableName);
168
        $ret .= $xc->getXcTplAssign('xoops_mpageurl', "{$stuModuleDirname}_URL.'/{$tableName}.php'");
169
        $ret .= $xc->getXcTplAssign("{$moduleDirname}_upload_url", "{$stuModuleDirname}_UPLOAD_URL");
170
        $ret .= $this->getInclude('footer');
171
172
        return $ret;
173
    }
174
175
    /**
176
     *  @public function render
177
     *  @param null
178
     * @return bool|string
179
     */
180
    public function render()
181
    {
182
        $module = $this->getModule();
183
        $table = $this->getTable();
184
        $tableName = $table->getVar('table_name');
185
        $tableSoleName = $table->getVar('table_solename');
186
        $filename = $this->getFileName();
187
        $moduleDirname = $module->getVar('mod_dirname');
188
        $language = $this->getLanguage($moduleDirname, 'MA');
189
        $content = $this->getHeaderFilesComments($module, $filename);
190
        $content .= $this->getUserPagesHeader($moduleDirname, $tableName);
191
        $content .= $this->getUserPages($moduleDirname, $tableName, $tableSoleName);
192
        $content .= $this->getUserPagesFooter($moduleDirname, $tableName, $tableSoleName, $language);
193
194
        $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
195
196
        return $this->renderFile();
197
    }
198
}
199