Issues (314)

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.

Files/Templates/Admin/TemplatesAdminBroken.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace XoopsModules\Modulebuilder\Files\Templates\Admin;
4
5
use XoopsModules\Modulebuilder;
6
use XoopsModules\Modulebuilder\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
 * modulebuilder module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops https://xoops.org 
26
 *                  Goffy https://myxoops.org
27
 *
28
 */
29
30
/**
31
 * Class TemplatesAdminBroken.
32
 */
33
class TemplatesAdminBroken extends Files\CreateFile
34
{
35
    /**
36
     * @var mixed
37
     */
38
    private $hc = null;
39
    /**
40
     * @var mixed
41
     */
42
    private $sc = null;
43
44
    /**
45
     * @public function constructor
46
     * @param null
47
     */
48
    public function __construct()
49
    {
50
        parent::__construct();
51
        $this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance();
52
        $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance();
53
    }
54
55
    /**
56
     * @static function getInstance
57
     * @param null
58
     * @return TemplatesAdminBroken
59
     */
60
    public static function getInstance()
61
    {
62
        static $instance = false;
63
        if (!$instance) {
64
            $instance = new self();
65
        }
66
67
        return $instance;
68
    }
69
70
    /**
71
     * @public function write
72
     * @param string $module
73
     * @param        $tables
74
     * @param        $filename
75
     */
76
    public function write($module, $tables, $filename)
77
    {
78
        $this->setModule($module);
79
        $this->setTables($tables);
80
        $this->setFileName($filename);
81
    }
82
83
    /**
84
     * @private function getTemplatesAdminBrokenHeader
85
     * @param string $moduleDirname
86
     * @return string
87
     */
88
    private function getTemplatesAdminBrokenHeader($moduleDirname)
89
    {
90
        $ret = $this->hc->getHtmlComment('Header', '', "\n");
91
        $ret .= $this->sc->getSmartyIncludeFile($moduleDirname, 'header', true, '', '', "\n\n");
92
93
        return $ret;
94
    }
95
96
    /**
97
     * @private  function getTemplatesAdminBrokenTableThead
98
     * @param string $language
99
     * @param        $t
100
     * @return string
101
     */
102
    private function getTemplatesAdminBrokenTableThead($language, $t)
103
    {
104
        $th   = '';
105
        $lang = $this->sc->getSmartyConst($language, 'BROKEN_TABLE');
106
        $th   .= $this->hc->getHtmlTableHead($lang, 'center', '', $t . "\t\t");
107
        $lang = $this->sc->getSmartyConst($language, 'BROKEN_MAIN');
108
        $th   .= $this->hc->getHtmlTableHead($lang, 'center', '', $t . "\t\t");
109
        $lang = $this->sc->getSmartyConst($language, 'FORM_ACTION');
110
        $th   .= $this->hc->getHtmlTableHead($lang, 'center width5', '', $t . "\t\t");
111
        $tr   = $this->hc->getHtmlTableRow($th, 'head', $t . "\t");
112
        $ret  = $this->hc->getHtmlTableThead($tr, '', $t);
113
114
        return $ret;
115
    }
116
117
    /**
118
     * @private  function getTemplatesAdminBrokenTableTBody
119
     * @param string $tableName
120
     * @param        $tableSoleName
121
     * @param        $t
122
     * @return string
123
     * @internal param string $language
124
     */
125
    private function getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, $t)
126
    {
127
        $td        = '';
128
        $doubleKey = $this->sc->getSmartyDoubleVar($tableSoleName, 'key');
129
        $doubleVal = $this->sc->getSmartyDoubleVar($tableSoleName, 'keyval');
130
131
        $double  = $this->sc->getSmartyDoubleVar($tableSoleName, 'table');
132
        $td      .= $this->hc->getHtmlTableData($double, 'center', '', $t . "\t\t");
133
        $double  = $this->sc->getSmartyDoubleVar($tableSoleName, 'main');
134
        $td      .= $this->hc->getHtmlTableData($double, 'center', '', $t . "\t\t");
135
        $lang    = $this->sc->getSmartyConst('', '_EDIT');
136
        $src     = $this->sc->getSmartyNoSimbol('xoModuleIcons16 edit.png');
137
        $img     = $this->hc->getHtmlImage($src, $tableName, '', '', '');
138
        $anchor  = $this->hc->getHtmlAnchor($tableName . ".php?op=edit&amp;{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', $t . "\t\t\t", "\n");
139
        $lang    = $this->sc->getSmartyConst('', '_DELETE');
140
        $src     = $this->sc->getSmartyNoSimbol('xoModuleIcons16 delete.png');
141
        $img     = $this->hc->getHtmlImage($src, $tableName, '', '', '');
142
        $anchor  .= $this->hc->getHtmlAnchor($tableName . ".php?op=delete&amp;{$doubleKey}=" . $doubleVal, $img, $lang, '', '', '', $t . "\t\t\t", "\n");
143
        $td      .= $this->hc->getHtmlTableData($anchor, 'center width5', '', $t . "\t\t", "\n", true);
144
        $cycle   = $this->sc->getSmartyNoSimbol('cycle values=\'odd, even\'');
145
        $tr      = $this->hc->getHtmlTableRow($td, $cycle, $t . "\t");
146
        $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName . '_list', $tr, '', '', $t . "\t");
147
        $tbody   = $this->hc->getHtmlTableTbody($foreach, '', $t);
148
149
        return $tbody;
150
    }
151
152
    /**
153
     * @private function getTemplatesAdminBrokenTable
154
     * @param string $tableName
155
     * @param        $tableSoleName
156
     * @param string $language
157
     * @return string
158
     */
159
    private function getTemplatesAdminBrokenTable($tableName, $tableSoleName, $language)
160
    {
161
        $tbody = $this->getTemplatesAdminBrokenTableThead($language, "\t\t");
162
        $tbody .= $this->getTemplatesAdminBrokenTableTBody($tableName, $tableSoleName, "\t\t");
163
        $ret   = $this->hc->getHtmlTable($tbody, 'table table-bordered', "\t");
164
165
        return $ret;
166
    }
167
168
    /**
169
     * @private function getTemplatesAdminBrokenList
170
     * @param        $table
171
     * @param string $language
172
     * @param string $t
173
     * @return string
174
     */
175
    private function getTemplatesAdminBrokenList($table, $language, $t = '')
176
    {
177
        $tableName     = $table->getVar('table_name');
178
        $tableSoleName = $table->getVar('table_solename');
179
        $ucfTableName  = \ucfirst($tableName);
180
        $double        = $this->sc->getSmartySingleVar($tableName . '_result');
181
        $ret           = $this->hc->getHtmlHNumb($double, 3, '');
182
        $htmlTable     = $this->getTemplatesAdminBrokenTable($tableName, $tableSoleName, $language);
183
        $htmlTable     .= $this->hc->getHtmlDiv('&nbsp;', 'clear', $t, "\n", false);
184
        $single        = $this->sc->getSmartySingleVar('pagenav');
185
        $div           = $this->hc->getHtmlDiv($single, 'xo-pagenav floatright', $t . "\t", "\n", false);
186
        $div           .= $this->hc->getHtmlDiv('', 'clear spacer', $t . "\t", "\n", false);
187
        $htmlTable     .= $this->sc->getSmartyConditions('pagenav', '', '', $div, '', '', '', $t);
188
        $noData        = $this->sc->getSmartySingleVar('nodata' . $ucfTableName, $t . "\t\t");
189
        $src           = $this->sc->getSmartyNoSimbol('xoModuleIcons32 button_ok.png');
190
        $noData        .= $this->hc->getHtmlImage($src, $tableName, '', '', "\n");
191
        $div           = $this->hc->getHtmlDiv($noData, '', $t . "\t", "\n", true);
192
        $div           .= $this->hc->getHtmlDiv('', 'clear spacer', $t . "\t", "\n", false);
193
        $div           .= $this->hc->getHtmlBr('2', '', $t . "\t");
194
        $contElse      = $this->sc->getSmartyConditions('nodata' . $ucfTableName, '', '', $div, false, '', '', $t);
195
        $ret           .= $this->sc->getSmartyConditions($tableName . '_count', '', '', $htmlTable, $contElse);
196
        $ret           .= $this->hc->getHtmlBr('3');
197
198
        return $ret;
199
    }
200
201
    /**
202
     * @private function getTemplatesAdminBrokenFooter
203
     * @param string $moduleDirname
204
     * @return string
205
     */
206
    private function getTemplatesAdminBrokenFooter($moduleDirname)
207
    {
208
        $single = $this->sc->getSmartySingleVar('error');
209
        $strong = $this->hc->getHtmlTag('strong', [], $single, false, '', '');
210
        $div    = $this->hc->getHtmlDiv($strong, 'errorMsg', "\t", "\n");
211
        $ret    = $this->sc->getSmartyConditions('error', '', '', $div);
212
        $ret    .= $this->hc->getHtmlEmpty('', '', "\n");
213
        $ret    .= $this->hc->getHtmlComment('Footer', '', "\n");
214
        $ret    .= $this->sc->getSmartyIncludeFile($moduleDirname, 'footer', true);
215
216
        return $ret;
217
    }
218
219
    /**
220
     * @public function render
221
     * @param null
222
     * @return bool|string
223
     */
224
    public function render()
225
    {
226
        $module        = $this->getModule();
227
        $tables        = $this->getTables();
228
        $filename      = $this->getFileName();
229
        $moduleDirname = $module->getVar('mod_dirname');
230
        $language      = $this->getLanguage($moduleDirname, 'AM', '', false);
0 ignored issues
show
false of type false is incompatible with the type string expected by parameter $addFq of XoopsModules\Modulebuild...eateFile::getLanguage(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

230
        $language      = $this->getLanguage($moduleDirname, 'AM', '', /** @scrutinizer ignore-type */ false);
Loading history...
231
        $content       = $this->getTemplatesAdminBrokenHeader($moduleDirname);
232
        foreach ($tables as $table) {
233
            if (1 === (int)$table->getVar('table_broken')) {
234
                $content .= $this->getTemplatesAdminBrokenList($table, $language, "\t");
235
            }
236
        }
237
        $content .= $this->getTemplatesAdminBrokenFooter($moduleDirname);
238
239
        $this->create($moduleDirname, 'templates/admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED);
240
241
        return $this->renderFile();
242
    }
243
}
244