Issues (222)

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.

admin/menus.php (9 issues)

1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright       XOOPS Project (https://xoops.org)
14
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
15
 * @package         Mymenus
16
 * @since           1.0
17
 * @author          trabis <[email protected]>
18
 */
19
20
use Xmf\Request;
0 ignored issues
show
The type Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
$currentFile = basename(__FILE__);
23
require __DIR__   . '/admin_header.php';
24
25
$op = Request::getString('op', 'list');
26
switch ($op) {
27
    case 'list':
28
    default:
29
        $apply_filter = Request::getBool('apply_filter', false);
30
        //  admin navigation
31
        xoops_cp_header();
32
        $adminObject = \Xmf\Module\Admin::getInstance();
0 ignored issues
show
The type Xmf\Module\Admin was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
        $adminObject->displayNavigation($currentFile);
34
        // buttons
35
        if (true === $apply_filter) {
36
            $adminObject->addItemButton(_LIST, '?op=list', 'list');
0 ignored issues
show
The constant _LIST was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
37
        }
38
        $adminObject->addItemButton(_ADD, $currentFile . '?op=edit', 'add');
0 ignored issues
show
The constant _ADD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
39
        $adminObject->displayButton('left');
40
        //
41
        $menusCount = $helper->getHandler('Menus')->getCount();
42
        $GLOBALS['xoopsTpl']->assign('menusCount', $menusCount);
43
        //
44
        if ($menusCount > 0) {
45
            // get filter parameters
46
            $filter_menus_title_condition = Request::getString('filter_menus_title_condition', '');
47
            $filter_menus_title           = Request::getString('filter_menus_title', '');
48
            //
49
            $menusCriteria = new \CriteriaCompo();
0 ignored issues
show
The type CriteriaCompo was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
50
            //
51
            if (true === $apply_filter) {
52
                // evaluate title criteria
53
                if ('' !== $filter_menus_title) {
54
                    switch ($filter_menus_title_condition) {
55
                        case 'CONTAINS':
56
                        default:
57
                            $pre      = '%';
58
                            $post     = '%';
59
                            $function = 'LIKE';
60
                            break;
61
                        case 'MATCHES':
62
                            $pre      = '';
63
                            $post     = '';
64
                            $function = '=';
65
                            break;
66
                        case 'STARTSWITH':
67
                            $pre      = '';
68
                            $post     = '%';
69
                            $function = 'LIKE';
70
                            break;
71
                        case 'ENDSWITH':
72
                            $pre      = '%';
73
                            $post     = '';
74
                            $function = 'LIKE';
75
                            break;
76
                    }
77
                    $menusCriteria->add(new \Criteria('title', $pre . $filter_menus_title . $post, $function));
0 ignored issues
show
The type Criteria was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
78
                }
79
            }
80
            $GLOBALS['xoopsTpl']->assign('apply_filter', $apply_filter);
81
            $menusFilterCount = $helper->getHandler('Menus')->getCount($menusCriteria);
82
            $GLOBALS['xoopsTpl']->assign('menusFilterCount', $menusFilterCount);
83
            //
84
            $menusCriteria->setSort('id');
85
            $menusCriteria->setOrder('ASC');
86
            //
87
            $start = Request::getInt('start', 0);
88
            $limit = $helper->getConfig('admin_perpage');
89
            $menusCriteria->setStart($start);
90
            $menusCriteria->setLimit($limit);
91
            //
92
            if ($menusFilterCount > $limit) {
93
                xoops_load('XoopsPagenav');
94
                $linklist   = "op={$op}";
95
                $linklist   .= "&filter_menus_title_condition={$filter_menus_title_condition}";
96
                $linklist   .= "&filter_menus_title={$filter_menus_title}";
97
                $pagenavObj = new \XoopsPageNav($itemFilterCount, $limit, $start, 'start', $linklist);
0 ignored issues
show
The type XoopsPageNav was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
98
                $pagenav    = $pagenavObj->renderNav(4);
99
            } else {
100
                $pagenav = '';
101
            }
102
            $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav);
103
            //
104
            $filter_menus_title_condition_select = new \XoopsFormSelect(_AM_MYMENUS_MENU_TITLE, 'filter_menus_title_condition', $filter_menus_title_condition, 1, false);
0 ignored issues
show
The type XoopsFormSelect was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
105
            $filter_menus_title_condition_select->addOption('CONTAINS', _CONTAINS);
106
            $filter_menus_title_condition_select->addOption('MATCHES', _MATCHES);
107
            $filter_menus_title_condition_select->addOption('STARTSWITH', _STARTSWITH);
108
            $filter_menus_title_condition_select->addOption('ENDSWITH', _ENDSWITH);
109
            $GLOBALS['xoopsTpl']->assign('filter_menus_title_condition_select', $filter_menus_title_condition_select->render());
110
            $GLOBALS['xoopsTpl']->assign('filter_menus_title_condition', $filter_menus_title_condition);
111
            $GLOBALS['xoopsTpl']->assign('filter_menus_title', $filter_menus_title);
112
            //
113
            $menusObjs = $helper->getHandler('Menus')->getObjects($menusCriteria);
114
            foreach ($menusObjs as $menusObj) {
115
                $menusObjArray = $menusObj->getValues(); // as array
116
                $GLOBALS['xoopsTpl']->append('menus', $menusObjArray);
117
                unset($menusObjArray);
118
            }
119
            unset($menusCriteria, $menusObjs);
120
        } else {
121
            // NOP
122
        }
123
        $GLOBALS['xoopsTpl']->display($GLOBALS['xoops']->path("modules/{$helper->getDirname()}/templates/static/mymenus_admin_menus.tpl"));
124
        require __DIR__   . '/admin_footer.php';
125
        break;
126
127
    case 'add':
128
    case 'edit':
129
        //  admin navigation
130
        xoops_cp_header();
131
        $adminObject = \Xmf\Module\Admin::getInstance();
132
        $adminObject->displayNavigation($currentFile);
133
        // buttons
134
        $adminObject->addItemButton(_LIST, $currentFile . '?op=list', 'list');
135
        $adminObject->displayButton('left');
136
        //
137
        $id = Request::getInt('id', 0);
138
        if (!$menusObj = $helper->getHandler('Menus')->get($id)) {
139
            // ERROR
140
            redirect_header($currentFile, 3, _AM_MYMENUS_MSG_ERROR);
141
        }
142
        $form = $menusObj->getForm();
143
        $form->display();
144
        //
145
        require __DIR__   . '/admin_footer.php';
146
        break;
147
148
    case 'save':
149
        if (!$GLOBALS['xoopsSecurity']->check()) {
150
            redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
151
        }
152
        $id         = Request::getInt('id', 0, 'POST');
153
        $isNewMenus = 0 == $id;
154
        //
155
        $menusObj = $helper->getHandler('Menus')->get($id);
156
        $menusObj->setVar('title',  Request::getString('title', '', 'POST'));
157
        $menusObj->setVar('css', Request::getString('css', '', 'POST'));
158
        //
159
        if (!$helper->getHandler('Menus')->insert($menusObj)) {
160
            // ERROR
161
            xoops_cp_header();
162
            echo $menusObj->getHtmlErrors();
163
            xoops_cp_footer();
164
            exit();
165
        }
166
        $id = (int)$menusObj->getVar('id');
167
        //
168
        if ($isNewMenus) {
169
            // NOP
170
        } else {
171
            // NOP
172
        }
173
        //
174
        redirect_header($currentFile, 3, _AM_MYMENUS_MSG_SUCCESS);
175
        break;
176
177
    case 'delete':
178
        $id       = Request::getInt('id', null);
179
        $menusObj = $helper->getHandler('Menus')->get($id);
180
        if (true === Request::getBool('ok', false, 'POST')) {
181
            if (!$GLOBALS['xoopsSecurity']->check()) {
182
                redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
183
            }
184
            // delete menus
185
            if (!$helper->getHandler('Menus')->delete($menusObj)) {
186
                // ERROR
187
                xoops_cp_header();
188
                xoops_error(_AM_MYMENUS_MSG_ERROR, $menusObj->getVar('id'));
189
                xoops_cp_footer();
190
                exit();
191
            }
192
            // Delete links
193
            $helper->getHandler('Links')->deleteAll(new \Criteria('mid', $id));
194
            redirect_header($currentFile, 3, _AM_MYMENUS_MSG_DELETE_MENU_SUCCESS);
195
        } else {
196
            xoops_cp_header();
197
            xoops_confirm(['ok' => true, 'id' => $id, 'op' => 'delete'], //                $_SERVER['REQUEST_URI'],
0 ignored issues
show
The function xoops_confirm was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

197
            /** @scrutinizer ignore-call */ 
198
            xoops_confirm(['ok' => true, 'id' => $id, 'op' => 'delete'], //                $_SERVER['REQUEST_URI'],
Loading history...
198
                          Request::getString('REQUEST_URI', '', 'SERVER'), sprintf(_AM_MYMENUS_MENUS_SUREDEL, $menusObj->getVar('title')));
199
            require __DIR__   . '/admin_footer.php';
200
        }
201
        break;
202
}
203