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/Includes/IncludeInstall.php (16 issues)

1
<?php namespace XoopsModules\Tdmcreate\Files\Includes;
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: IncludeInstall.php 12258 2014-01-02 09:33:29Z timgno $
26
 */
27
28
/**
29
 * Class IncludeInstall.
30
 */
31
class IncludeInstall extends Files\CreateFile
32
{
33
    /**
34
    *  @public function constructor
35
    *  @param null
36
    */
37
38
    public function __construct()
39
    {
40
        parent::__construct();
41
    }
42
43
    /**
44
    *  @static function getInstance
45
    *  @param null
46
     * @return IncludeInstall
47
     */
48
    public static function getInstance()
49
    {
50
        static $instance = false;
51
        if (!$instance) {
52
            $instance = new self();
53
        }
54
55
        return $instance;
56
    }
57
58
    /**
59
     * @public function write
60
     * @param string $module
61
     * @param        $table
62
     * @param mixed  $tables
63
     * @param string $filename
64
     */
65
    public function write($module, $table, $tables, $filename)
66
    {
67
        $this->setModule($module);
68
        $this->setTable($table);
69
        $this->setTables($tables);
70
        $this->setFileName($filename);
71
    }
72
73
    /**
74
     * @private function getInstallDirectory
75
     *
76
     * @param $dirname
77
     *
78
     * @return string
79
     */
80
    private function getInstallDirectory($dirname)
81
    {
82
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property pc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
83
        $contentIf = $this->pc->getPhpCodeMkdir((string)$dirname, '0777', "\t");
84
        $contentIf .= $this->pc->getPhpCodeChmod((string)$dirname, '0777', "\t");
85
        $ret = $this->pc->getPhpCodeConditions("!is_dir(\${$dirname})", '', '', $contentIf);
86
        $ret .= $this->pc->getPhpCodeCopy('$indexFile', "\${$dirname}.'/index.html'");
87
88
        return $ret;
89
    }
90
91
    /**
92
     *  @private function getInstallModuleFolder
93
     *
94
     *  @param $moduleDirname
95
     *
96
     * @return string
97
     */
98
    private function getInstallModuleFolder($moduleDirname)
99
    {
100
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property pc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
101
        $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...
102
        $ret = $this->pc->getPhpCodeCommentLine('Copy base file');
103
        $ret .= $this->xc->getXcEqualsOperator('$indexFile', "XOOPS_UPLOAD_PATH.'/index.html'");
104
        $ret .= $this->xc->getXcEqualsOperator('$blankFile', "XOOPS_UPLOAD_PATH.'/blank.gif'");
105
        $ret .= $this->pc->getPhpCodeCommentLine("Making of uploads/{$moduleDirname} folder");
106
        $ret .= $this->xc->getXcEqualsOperator("\${$moduleDirname}", "XOOPS_UPLOAD_PATH.'/{$moduleDirname}'");
107
        $ret .= $this->getInstallDirectory($moduleDirname);
108
109
        return $ret;
110
    }
111
112
    /**
113
     *  @private function getHeaderTableFolder
114
     *
115
     *  @param $moduleDirname
116
     *  @param $tableName
117
     *
118
     * @return string
119
     */
120
    private function getInstallTableFolder($moduleDirname, $tableName)
121
    {
122
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property pc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
123
        $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...
124
        $ret = $this->pc->getPhpCodeCommentLine("Making of {$tableName} uploads folder");
125
        $ret .= $this->xc->getXcEqualsOperator("\${$tableName}", "\${$moduleDirname}.'/{$tableName}'");
126
        $ret .= $this->getInstallDirectory($tableName);
127
128
        return $ret;
129
    }
130
131
    /**
132
    *  @private function getInstallImagesFolder
133
    *  @param string $moduleDirname
134
     *
135
     * @return string
136
     */
137
    private function getInstallImagesFolder($moduleDirname)
138
    {
139
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property pc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
140
        $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...
141
        $ret = $this->pc->getPhpCodeCommentLine('Making of images folder');
142
        $ret .= $this->xc->getXcEqualsOperator('$images', "\${$moduleDirname}.'/images'");
143
        $ret .= $this->getInstallDirectory('images');
144
        $ret .= $this->pc->getPhpCodeCopy('$blankFile', "\$images.'/blank.gif'");
145
146
        return $ret;
147
    }
148
149
    /**
150
     * @private function getInstallImagesShotsFolder
151
     *
152
     * @param $moduleDirname
153
     *
154
     * @return string
155
     */
156
    private function getInstallImagesShotsFolder($moduleDirname)
157
    {
158
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property pc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
159
        $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...
160
        $ret = $this->pc->getPhpCodeCommentLine('Making of shots folder');
161
        $ret .= $this->xc->getXcEqualsOperator('$shots', "\${$moduleDirname}.'/shots'");
162
        $ret .= $this->getInstallDirectory('shots');
163
        $ret .= $this->pc->getPhpCodeCopy('$blankFile', "\$shots.'/blank.gif'");
164
165
        return $ret;
166
    }
167
168
    /**
169
     *  @private function getInstallTableImagesFolder
170
     *
171
     *  @param $tableName
172
     *
173
     * @return string
174
     */
175
    private function getInstallTableImagesFolder($tableName)
176
    {
177
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property pc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
178
        $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...
179
        $ret = $this->pc->getPhpCodeCommentLine("Making of images/{$tableName} folder");
180
        $ret .= $this->xc->getXcEqualsOperator("\${$tableName}", "\$images.'/{$tableName}'");
181
        $ret .= $this->getInstallDirectory($tableName);
182
        $ret .= $this->pc->getPhpCodeCopy('$blankFile', "\${$tableName}.'/blank.gif'");
183
184
        return $ret;
185
    }
186
187
    /**
188
     *  @private function getInstallFilesFolder
189
     *
190
     *  @param $moduleDirname
191
     *
192
     * @return string
193
     */
194
    private function getInstallFilesFolder($moduleDirname)
195
    {
196
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property pc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
197
        $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...
198
        $ret = $this->pc->getPhpCodeCommentLine('Making of files folder');
199
        $ret .= $this->xc->getXcEqualsOperator('$files', "\${$moduleDirname}.'/files'");
200
        $ret .= $this->getInstallDirectory('files');
201
202
        return $ret;
203
    }
204
205
    /**
206
    *  @private function getInstallTableFilesFolder
207
    *  @param string $tableName
208
     *
209
     * @return string
210
     */
211
    private function getInstallTableFilesFolder($tableName)
212
    {
213
        $this->pc = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Bug Best Practice introduced by
The property pc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
214
        $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...
215
        $ret = $this->pc->getPhpCodeCommentLine("Making of {$tableName} files folder");
216
        $ret .= $this->xc->getXcEqualsOperator("\${$tableName}", "\$files.'/{$tableName}'");
217
        $ret .= $this->getInstallDirectory($tableName);
218
219
        return $ret;
220
    }
221
222
    /**
223
    *  @private function getInstallFooter
224
    *  @param null
225
     * @return string
226
     */
227
    private function getInstallFooter()
228
    {
229
        return $this->getDashComment('Install Footer');
230
    }
231
232
    /**
233
    *  @public function render
234
    *  @param null
235
     * @return bool|string
236
     */
237
    public function render()
238
    {
239
        $module = $this->getModule();
240
        $moduleDirname = $module->getVar('mod_dirname');
241
        $table = $this->getTable();
0 ignored issues
show
The assignment to $table is dead and can be removed.
Loading history...
242
        $tables = $this->getTables();
243
        $filename = $this->getFileName();
244
        $content = $this->getHeaderFilesComments($module, $filename);
245
        $content .= $this->getInstallModuleFolder($moduleDirname);
246
        foreach (array_keys($tables) as $t) {
247
            $tableId = $tables[$t]->getVar('table_id');
248
            $tableMid = $tables[$t]->getVar('table_mid');
249
            $tableName = $tables[$t]->getVar('table_name');
250
            $tableInstall = $tables[$t]->getVar('table_install');
251
            if (1 == $tableInstall) {
252
                $content .= $this->getInstallTableFolder($moduleDirname, $tableName);
253
                $fields = $this->getTableFields($tableMid, $tableId);
254
                foreach (array_keys($fields) as $f) {
255
                    $fieldElement = $fields[$f]->getVar('field_element');
256
                    // All fields elements selected
257
                    switch ($fieldElement) {
258
                        case 13:
259
                            $content .= $this->getInstallImagesFolder($moduleDirname);
260
                            $content .= $this->getInstallTableImagesFolder($tableName);
261
                            break;
262
                        case 11:
263
                            $content .= $this->getInstallImagesShotsFolder($moduleDirname);
264
                            break;
265
                        case 12:
266
                        case 14:
267
                            $content .= $this->getInstallFilesFolder($moduleDirname);
268
                            $content .= $this->getInstallTableFilesFolder($tableName);
269
                            break;
270
                    }
271
                }
272
            }
273
        }
274
        $content .= $this->getInstallFooter();
275
276
        $this->create($moduleDirname, 'include', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
277
278
        return $this->renderFile();
279
    }
280
}
281