Issues (964)

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/Admin/AdminMenu.php (1 issue)

Severity
1
<?php
2
3
namespace XoopsModules\Tdmcreate\Files\Admin;
4
5
use XoopsModules\Tdmcreate;
6
use XoopsModules\Tdmcreate\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
 * tdmcreate module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops http://www.txmodxoops.org
26
 *
27
 */
28
29
/**
30
 * Class AdminMenu.
31
 */
32
class AdminMenu extends Files\CreateFile
33
{
34
    /**
35
     * @public function constructor
36
     * @param null
37
     */
38
    public function __construct()
39
    {
40
        parent::__construct();
41
    }
42
43
    /**
44
     * @static function getInstance
45
     * @param null
46
     * @return AdminMenu
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 string $filename
62
     */
63
    public function write($module, $filename)
64
    {
65
        $this->setModule($module);
66
        $this->setFileName($filename);
67
    }
68
69
    /**
70
     * @private function getAdminMenuArray
71
     * @param array $param
72
     * @param bool $adminObject
73
     * @return string
74
     */
75
    private function getAdminMenuArray($param = [], $adminObject = false)
76
    {
77
        $xc  = Tdmcreate\Files\CreateXoopsCode::getInstance();
78
        $ret = '';
79
        if ($adminObject) {
80
            $ret .= $this->getSimpleString("\$adminmenu[] = [");
81
            foreach ($param as $key => $value) {
82
                $ret .= $this->getSimpleString("\t'{$key}' => {$value},");
83
            }
84
            $ret .= $this->getSimpleString("];");
85
        } else {
86
            foreach ($param as $key => $value) {
87
                $ret .= $xc->getXcEqualsOperator((string)$key, (string)$value);
88
            }
89
        }
90
91
        return $ret;
92
    }
93
94
    /**
95
     * @private function getAdminMenuHeader
96
     * @param null
97
     * @return string
98
     */
99
    private function getAdminMenuHeader()
100
    {
101
        $ret = $this->getSimpleString('');
102
        $mod     = [
103
            '$dirname      ' => 'basename(dirname(__DIR__))',
104
            '$moduleHandler' => "xoops_getHandler('module')",
105
            '$xoopsModule  '   => 'XoopsModule::getByDirname($dirname)',
106
            '$moduleInfo   '    => "\$moduleHandler->get(\$xoopsModule->getVar('mid'))",
107
            '$sysPathIcon32' => "\$moduleInfo->getInfo('sysicons32')",
108
        ];
109
        $ret .= $this->getAdminMenuArray($mod);
110
        $ret .= $this->getSimpleString('');
111
112
        return $ret;
113
    }
114
115
    /**
116
     * @private function getAdminMenuDashboard
117
     * @param string $language
118
     * @param int    $menu
119
     *
120
     * @return string
121
     */
122
    private function getAdminMenuDashboard($language, $menu)
123
    {
124
        $param = ['title' => "{$language}{$menu}", 'link' => "'admin/index.php'", 'icon' => "\$sysPathIcon32.'/dashboard.png'"];
125
        $ret   = $this->getAdminMenuArray($param, true);
126
127
        return $ret;
128
    }
129
130
    /**
131
     * @private function getAdminMenuImagesPath
132
     * @param array $tables
133
     * @param int   $t
134
     *
135
     * @return string
136
     */
137
    private function getAdminMenuImagesPath($tables, $t)
0 ignored issues
show
The method getAdminMenuImagesPath() 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...
138
    {
139
        $xc     = Tdmcreate\Files\CreateXoopsCode::getInstance();
140
        $ret    = '';
141
        $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id'));
142
        foreach (array_keys($fields) as $f) {
143
            $fieldElement = $fields[$f]->getVar('field_element');
144
            switch ($fieldElement) {
145
                case 13:
146
                    $ret = $xc->getXcEqualsOperator("\$adminmenu[\$i]['icon']", "'assets/icons/32/{$tables[$t]->getVar('table_image')}'");
147
                    break;
148
                default:
149
                    $ret = $xc->getXcEqualsOperator("\$adminmenu[\$i]['icon']", "\$sysPathIcon32.'/{$tables[$t]->getVar('table_image')}'");
150
                    break;
151
            }
152
        }
153
154
        return $ret;
155
    }
156
157
    /**
158
     * @private function getAdminMenuList
159
     * @param string $module
160
     * @param string $language
161
     * @param string $langAbout
162
     * @param int    $menu
163
     *
164
     * @return string
165
     */
166
    private function getAdminMenuList($module, $language, $langAbout, $menu)
167
    {
168
        $ret    = '';
169
        $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order');
170
        $tablePermissions = [];
171
        foreach (array_keys($tables) as $t) {
172
            $tablePermissions[] = $tables[$t]->getVar('table_permissions');
173
            if (1 == $tables[$t]->getVar('table_admin')) {
174
                ++$menu;
175
                $param1 = ['title' => "{$language}{$menu}", 'link' => "'admin/{$tables[$t]->getVar('table_name')}.php'", 'icon' => "'assets/icons/32/{$tables[$t]->getVar('table_image')}'"];
176
                $ret    .= $this->getAdminMenuArray($param1, true);
177
            }
178
        }
179
        if (in_array(1, $tablePermissions)) {
180
            ++$menu;
181
            $param2 = ['title' => "{$language}{$menu}", 'link' => "'admin/permissions.php'", 'icon' => "\$sysPathIcon32.'/permissions.png'"];
182
            $ret    .= $this->getAdminMenuArray($param2, true);
183
        }
184
        ++$menu;
185
        $param3 = ['title' => "{$language}{$menu}", 'link' => "'admin/feedback.php'", 'icon' => "\$sysPathIcon32.'/mail_foward.png'"];
186
        $ret    .= $this->getAdminMenuArray($param3, true);
187
        unset($menu);
188
        $param3 = ['title' => (string)$langAbout, 'link' => "'admin/about.php'", 'icon' => "\$sysPathIcon32.'/about.png'"];
189
        $ret    .= $this->getAdminMenuArray($param3, true);
190
191
        return $ret;
192
    }
193
194
    /**
195
     * @public function render
196
     * @param null
197
     * @return bool|string
198
     */
199
    public function render()
200
    {
201
        $module        = $this->getModule();
202
        $filename      = $this->getFileName();
203
        $moduleDirname = $module->getVar('mod_dirname');
204
        $language      = $this->getLanguage($moduleDirname, 'MI', 'ADMENU');
205
        $langAbout     = $this->getLanguage($moduleDirname, 'MI', 'ABOUT');
206
        $menu          = 1;
207
        $content       = $this->getHeaderFilesComments($module);
208
        $content       .= $this->getAdminMenuHeader();
209
        $content       .= $this->getAdminMenuDashboard($language, $menu);
210
        $content       .= $this->getAdminMenuList($module, $language, $langAbout, $menu);
211
212
        $this->create($moduleDirname, 'admin', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
213
214
        return $this->renderFile();
215
    }
216
}
217