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/UserSingle.php (5 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: UserSingle.php 12258 2014-01-02 09:33:29Z timgno $
26
 */
27
28
/**
29
 * Class UserSingle.
30
 */
31
class UserSingle 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 UserSingle
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 string $module
60
     *  @param mixed $table
61
     *  @param string $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 getUserSingleHeader
72
     * @param $moduleDirname
73
     * @param $table
74
     * @param $fields
75
     * @return string
76
     */
77
    private function getUserSingleHeader($moduleDirname, $table, $fields)
78
    {
79
        $xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
80
        $pc = Tdmcreate\Files\CreatePhpCode::getInstance();
81
        $uc = UserXoopsCode::getInstance();
82
        $ret = $this->getInclude();
83
        foreach (array_keys($fields) as $f) {
84
            $fieldName = $fields[$f]->getVar('field_name');
85
            if (0 == $f) {
86
                $fieldId = $fieldName;
87
            }
88
            if (1 == $fields[$f]->getVar('field_parent')) {
89
                $fieldPid = $fieldName;
90
            }
91
        }
92
        if (1 == $table->getVar('table_category')) {
93
            $ccFieldPid = $this->getCamelCase($fieldPid, false, true);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $fieldPid does not seem to be defined for all execution paths leading up to this point.
Loading history...
94
            $ret .= $xc->getXcXoopsRequest($ccFieldPid, (string)$fieldPid, '0', 'Int');
95
        }
96
        $ccFieldId = $this->getCamelCase($fieldId, false, true);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $fieldId does not seem to be defined for all execution paths leading up to this point.
Loading history...
97
        $ret .= $xc->getXcXoopsRequest($ccFieldId, (string)$fieldId, '0', 'Int');
98
        $ret .= $uc->getUserTplMain($moduleDirname, 'single');
99
        $ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true);
100
        $ret .= $pc->getPhpCodeCommentLine('Define Stylesheet');
101
        $ret .= $xc->getXcAddStylesheet();
102
103
        return $ret;
104
    }
105
106
    /**
107
     * @public function getUserSingleBody
108
     * @param $moduleDirname
109
     * @param $tableName
110
     * @param $language
111
     *
112
     * @return string
113
     */
114
    public function getUserSingleBody($moduleDirname, $tableName, $language)
0 ignored issues
show
The parameter $tableName 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

114
    public function getUserSingleBody($moduleDirname, /** @scrutinizer ignore-unused */ $tableName, $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...
The parameter $language 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

114
    public function getUserSingleBody($moduleDirname, $tableName, /** @scrutinizer ignore-unused */ $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...
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

114
    public function getUserSingleBody(/** @scrutinizer ignore-unused */ $moduleDirname, $tableName, $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...
115
    {
116
        $ret = <<<'EOT'
117
118
EOT;
119
        $ret .= $this->getSimpleString('$keywords = array();');
120
121
        return $ret;
122
    }
123
124
    /**
125
     * @private function getUserSingleFooter
126
     * @param $moduleDirname
127
     * @param $tableName
128
     * @param $language
129
     *
130
     * @return string
131
     */
132
    private function getUserSingleFooter($moduleDirname, $tableName, $language)
133
    {
134
        $xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
135
        $pc = Tdmcreate\Files\CreatePhpCode::getInstance();
136
        $uc = UserXoopsCode::getInstance();
137
        $stuModuleDirname = mb_strtoupper($moduleDirname);
138
        $stuTableName = mb_strtoupper($tableName);
139
        $ret = $pc->getPhpCodeCommentLine('Breadcrumbs');
140
        $ret .= $uc->getUserBreadcrumbs($language, $stuTableName);
141
        $ret .= $pc->getPhpCodeCommentLine('Keywords');
142
        $ret .= $uc->getUserMetaKeywords($moduleDirname);
143
        $ret .= $pc->getPhpCodeUnset('keywords');
144
        $ret .= $pc->getPhpCodeCommentLine('Description');
145
        $ret .= $uc->getUserMetaDesc($moduleDirname, $language, $stuTableName);
146
        $ret .= $xc->getXcTplAssign('xoops_mpageurl', "{$stuModuleDirname}_URL.'/index.php'");
147
        $ret .= $xc->getXcTplAssign('xoops_icons32_url', 'XOOPS_ICONS32_URL');
148
        $ret .= $xc->getXcTplAssign("{$moduleDirname}_upload_url", "{$stuModuleDirname}_UPLOAD_URL");
149
        $ret .= $this->getInclude('footer');
150
151
        return $ret;
152
    }
153
154
    /**
155
     *  @public function render
156
     *  @param null
157
     * @return bool|string
158
     */
159
    public function render()
160
    {
161
        $module = $this->getModule();
162
        $table = $this->getTable();
163
        $filename = $this->getFileName();
164
        $moduleDirname = $module->getVar('mod_dirname');
165
        $tableId = $table->getVar('table_id');
166
        $tableMid = $table->getVar('table_mid');
167
        $tableName = $table->getVar('table_name');
168
        $fields = $this->getTableFields($tableMid, $tableId);
169
        $language = $this->getLanguage($moduleDirname, 'MA');
170
        $content = $this->getHeaderFilesComments($module, $filename);
171
        $content .= $this->getUserSingleHeader($moduleDirname, $table, $fields);
172
        $content .= $this->getUserSingleBody($module, $tableName, $language);
173
        $content .= $this->getUserSingleFooter($moduleDirname, $tableName, $language);
174
        $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
175
176
        return $this->renderFile();
177
    }
178
}
179