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.

class/Files/Templates/User/Defstyle/Categories.php (7 issues)

1
<?php
2
3
namespace XoopsModules\Modulebuilder\Files\Templates\User\Defstyle;
4
5
use XoopsModules\Modulebuilder;
6
use XoopsModules\Modulebuilder\Files;
7
use XoopsModules\Modulebuilder\Files\Templates\User;
8
9
/*
10
 You may not change or alter any portion of this comment or credits
11
 of supporting developers from this source code or any supporting source code
12
 which is considered copyrighted (c) material of the original comment or credit authors.
13
14
 This program is distributed in the hope that it will be useful,
15
 but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
 */
18
/**
19
 * modulebuilder module.
20
 *
21
 * @copyright       XOOPS Project (https://xoops.org)
22
 * @license         GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
23
 *
24
 * @since           2.5.0
25
 *
26
 * @author          Txmod Xoops https://xoops.org 
27
 *                  Goffy https://myxoops.org
28
 *
29
 */
30
31
/**
32
 * Class Categories.
33
 */
34
class Categories extends Files\CreateFile
35
{
36
    /**
37
     * @var mixed
38
     */
39
    private $hc = null;
40
41
    /**
42
     * @var mixed
43
     */
44
    private $sc = null;
45
46
    /**
47
     * @public function constructor
48
     * @param null
49
     */
50
    public function __construct()
51
    {
52
        parent::__construct();
53
        $this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance();
54
        $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance();
55
    }
56
57
    /**
58
     * @static function getInstance
59
     * @return bool|Categories
60
     */
61
    public static function getInstance()
62
    {
63
        static $instance = false;
64
        if (!$instance) {
65
            $instance = new self();
66
        }
67
68
        return $instance;
69
    }
70
71
    /**
72
     * @public function write
73
     * @param        $module
74
     * @param        $table
75
     * @param string $filename
76
     */
77
    public function write($module, $table, $filename)
78
    {
79
        $this->setModule($module);
80
        $this->setTable($table);
81
        $this->setFileName($filename);
82
    }
83
84
    /**
85
     * @private function getTemplatesUserCategoriesHeader
86
     * @param string $moduleDirname
87
     * @return string
88
     */
89
    private function getTemplatesUserCategoriesHeader($moduleDirname)
90
    {
91
92
        return $this->sc->getSmartyIncludeFile($moduleDirname, 'header') . PHP_EOL;
93
    }
94
95
    /**
96
     * @private function getTemplatesUserCategoriesTable
97
     * @param string $language
98
     * @param        $moduleDirname
99
     * @param        $tableName
100
     * @param        $tableSoleName
101
     * @return string
102
     */
103
    private function getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language)
104
    {
105
        $single = $this->sc->getSmartySingleVar('table_type');
106
        $table  = $this->getTemplatesAdminPagesTableThead($tableName, $language);
0 ignored issues
show
The method getTemplatesAdminPagesTableThead() does not exist on XoopsModules\Modulebuild...ser\Defstyle\Categories. ( Ignorable by Annotation )

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

106
        /** @scrutinizer ignore-call */ 
107
        $table  = $this->getTemplatesAdminPagesTableThead($tableName, $language);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
107
        $table  .= $this->getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $language);
0 ignored issues
show
The method getTemplatesAdminPagesTableTBody() does not exist on XoopsModules\Modulebuild...ser\Defstyle\Categories. ( Ignorable by Annotation )

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

107
        $table  .= $this->/** @scrutinizer ignore-call */ getTemplatesAdminPagesTableTBody($moduleDirname, $tableName, $tableSoleName, $language);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
108
109
        return $this->hc->getHtmlTable($table, 'table table-' . $single) . PHP_EOL;
110
    }
111
112
    /**
113
     * @private function getTemplatesUserCategoriesThead
114
     * @param string $language
115
     * @param        $tableName
116
     * @return string
117
     */
118
    private function getTemplatesUserCategoriesThead($tableName, $language)
0 ignored issues
show
The method getTemplatesUserCategoriesThead() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
119
    {
120
        $stuTableName = \mb_strtoupper($tableName);
121
        $lang         = $this->sc->getSmartyConst($language, $stuTableName . '_TITLE');
122
        $single       = $this->sc->getSmartySingleVar('numb_col');
123
        $th           = $this->hc->getHtmlTableHead($lang, '', $single) . PHP_EOL;
124
        $tr           = $this->hc->getHtmlTableRow($th, 'head') . PHP_EOL;
125
126
        return $this->hc->getHtmlTableThead($tr) . PHP_EOL;
127
    }
128
129
    /**
130
     * @private function getTemplatesUserCategoriesTbody
131
     * @param string $moduleDirname
132
     * @param        $tableName
133
     * @param        $tableSoleName
134
     * @return string
135
     */
136
    private function getTemplatesUserCategoriesTbody($moduleDirname, $tableName, $tableSoleName)
0 ignored issues
show
The method getTemplatesUserCategoriesTbody() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
137
    {
138
        $single  = $this->sc->getSmartySingleVar('panel_type');
139
        $include = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName);
140
        $div     = $this->hc->getHtmlDiv($include, 'panel panel-' . $single);
141
        $cont    = $this->hc->getHtmlTableData($div) . PHP_EOL;
142
        $html    = $this->hc->getHtmlEmpty('</tr><tr>') . PHP_EOL;
143
        $cont    .= $this->sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$divideby', $html, false, false, false, '', "\n", true, false) . PHP_EOL;
144
        $foreach = $this->sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL;
145
        $tr      = $this->hc->getHtmlTableRow($foreach) . PHP_EOL;
146
147
        return $this->hc->getHtmlTableTbody($tr) . PHP_EOL;
148
    }
149
150
    /**
151
     * @private function getTemplatesUserCategoriesTfoot
152
     * @return string
153
     */
154
    private function getTemplatesUserCategoriesTfoot()
0 ignored issues
show
The method getTemplatesUserCategoriesTfoot() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
155
    {
156
        $td = $this->hc->getHtmlTableData('&nbsp;') . PHP_EOL;
157
        $tr = $this->hc->getHtmlTableRow($td) . PHP_EOL;
158
159
        return $this->hc->getHtmlTableTfoot($tr) . PHP_EOL;
160
    }
161
162
    /**
163
     * @private function getTemplatesUserCategories
164
     * @param $moduleDirname
165
     * @param $tableName
166
     * @param $tableSoleName
167
     * @param $language
168
     * @return string
169
     */
170
    private function getTemplatesUserCategories($moduleDirname, $tableName, $tableSoleName, $language)
0 ignored issues
show
The method getTemplatesUserCategories() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
171
    {
172
        $tab = $this->getTemplatesUserCategoriesTable($moduleDirname, $tableName, $tableSoleName, $language) . PHP_EOL;
173
        $div = $this->hc->getHtmlDiv($tab, 'table-responsive') . PHP_EOL;
174
175
        return $this->sc->getSmartyConditions($tableName, ' gt ', '0', $div, false, true, false, '', "\n", true, 'int') . PHP_EOL;
176
    }
177
178
    /**
179
     * @private function getTemplatesUserCategoriesPanel
180
     * @param string $moduleDirname
181
     * @param string $tableName
182
     * @param        $tableSoleName
183
     * @param        $language
184
     * @return string
185
     */
186
    private function getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language)
187
    {
188
        $stuTableName = \mb_strtoupper($tableName);
189
        $incl      = $this->sc->getSmartyIncludeFileListForeach($moduleDirname, $tableName, $tableSoleName) . PHP_EOL;
190
        $html      = $this->hc->getHtmlEmpty('<br>') . PHP_EOL;
191
        $incl      .= $this->sc->getSmartyConditions($tableSoleName . '.count', ' is div by ', '$numb_col', $html, false, false, false, '',"\n", true, false) . PHP_EOL;
192
        $const     = $this->sc->getSmartyConst($language, $stuTableName . '_TITLE');
193
        $div       = $this->hc->getHtmlDiv($const, 'panel-heading') . PHP_EOL;
194
        $cont      = $this->hc->getHtmlDiv($incl, 'panel panel-body') . PHP_EOL;
195
        $div       .= $this->sc->getSmartyForeach($tableSoleName, $tableName, $cont) . PHP_EOL;
196
        $panelType = $this->sc->getSmartySingleVar('panel_type');
197
198
        return $this->hc->getHtmlDiv($div, 'panel panel-' . $panelType) . PHP_EOL;
199
    }
200
201
    /**
202
     * @private function getTemplatesUserCategoriesFooter
203
     * @param string $moduleDirname
204
     *
205
     * @return string
206
     */
207
    private function getTemplatesUserCategoriesFooter($moduleDirname)
208
    {
209
210
        return $this->sc->getSmartyIncludeFile($moduleDirname, 'footer');
211
    }
212
213
    /**
214
     * @public function render
215
     * @return bool|string
216
     */
217
    public function render()
218
    {
219
        $module         = $this->getModule();
220
        $table          = $this->getTable();
221
        $filename       = $this->getFileName();
222
        $moduleDirname  = $module->getVar('mod_dirname');
223
        $tableName      = $table->getVar('table_name');
224
        $tableSoleName  = $table->getVar('table_solename');
225
        $language       = $this->getLanguage($moduleDirname, 'MA', '', 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

225
        $language       = $this->getLanguage($moduleDirname, 'MA', '', /** @scrutinizer ignore-type */ false);
Loading history...
226
        $content        = $this->getTemplatesUserCategoriesHeader($moduleDirname);
227
        $content        .= $this->getTemplatesUserCategoriesPanel($moduleDirname, $tableName, $tableSoleName, $language);
228
        $content        .= $this->getTemplatesUserCategoriesFooter($moduleDirname);
229
230
        $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED);
231
232
        return $this->renderFile();
233
    }
234
}
235