Issues (388)

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/utf8map.php (3 issues)

Labels
1
<?php declare(strict_types=1);
2
3
use Xmf\Module\Admin;
4
use Xmf\Request;
5
use XoopsModules\Songlist\Helper;
6
use XoopsModules\Songlist\Utf8mapHandler;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Utf8mapHandler. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
7
use XoopsModules\Songlist\Form\FormController;
8
9
require __DIR__ . '/header.php';
10
11
xoops_loadLanguage('admin', 'songlist');
12
13
xoops_cp_header();
14
15
$op     = $_REQUEST['op'] ?? 'utf8map';
16
$fct    = $_REQUEST['fct'] ?? 'list';
17
$limit  = Request::getInt('limit', 30, 'REQUEST');
18
$start  = Request::getInt('start', 0, 'REQUEST');
19
$order  = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
20
$sort   = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
21
$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
22
23
switch ($op) {
24
    default:
25
    case 'utf8map':
26
        switch ($fct) {
27
            default:
28
            case 'list':
29
                $adminObject = Admin::getInstance();
30
                $adminObject->displayNavigation(basename(__FILE__));
31
32
                /** @var Utf8mapHandler $utf8mapHandler */
33
                $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map');
34
35
                $criteria        = $utf8mapHandler->getFilterCriteria($GLOBALS['filter']);
36
                $ttl             = $utf8mapHandler->getCount($criteria);
37
                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
38
39
                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
40
                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
41
42
                foreach ($utf8mapHandler->filterFields() as $id => $key) {
43
                    $GLOBALS['xoopsTpl']->assign(
44
                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
45
                        '<a href="'
46
                        . $_SERVER['SCRIPT_NAME']
47
                        . '?start='
48
                        . $GLOBALS['start']
49
                        . '&limit='
50
                        . $GLOBALS['limit']
51
                        . '&sort='
52
                        . $key
53
                        . '&order='
54
                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
55
                        . '&op='
56
                        . $GLOBALS['op']
57
                        . '&filter='
58
                        . $GLOBALS['filter']
59
                        . '">'
60
                        . (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
61
                        . '</a>'
62
                    );
63
                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $utf8mapHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
64
                }
65
66
                $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
67
                $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
68
                $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
69
                $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
70
                $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
71
                $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
72
73
                $criteria->setStart($GLOBALS['start']);
74
                $criteria->setLimit($GLOBALS['limit']);
75
                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
76
                $criteria->setOrder($GLOBALS['order']);
77
78
                $utf8maps = $utf8mapHandler->getObjects($criteria, true);
79
                foreach ($utf8maps as $cid => $utf8map) {
80
                    if (is_object($utf8map)) {
81
                        $GLOBALS['xoopsTpl']->append('utf8map', $utf8map->toArray());
82
                    }
83
                }
84
                $GLOBALS['xoopsTpl']->assign('form', FormController::getFormUtf8map(false));
85
                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
86
                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_utf8map_list.tpl');
87
                break;
88
            case 'new':
89
            case 'edit':
90
                $adminObject = Admin::getInstance();
91
                $adminObject->displayNavigation(basename(__FILE__));
92
93
                $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map');
94
                if (Request::hasVar('id', 'REQUEST')) {
95
                    $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST'));
96
                } else {
97
                    $utf8map = $utf8mapHandler->create();
98
                }
99
100
                $GLOBALS['xoopsTpl']->assign('form', $utf8map->getForm());
0 ignored issues
show
The method getForm() does not exist on XoopsObject. It seems like you code against a sub-type of XoopsObject such as XoopsModules\Songlist\Votes or XoopsModules\Songlist\Genre or XoopsModules\Songlist\Voice or SystemSmilies or SystemBanner or XoopsModules\Songlist\Requests or SystemBannerclient or XoopsModules\Songlist\Category or XoopsModules\Songlist\Utf8map or XoopsModules\Songlist\Songs or ProfileCategory or SystemUserrank or XoopsModules\Songlist\Albums or Utf8map or XoopsModules\Songlist\Artists or SystemGroup or SystemBlock or SystemAvatar or SystemUsers. ( Ignorable by Annotation )

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

100
                $GLOBALS['xoopsTpl']->assign('form', $utf8map->/** @scrutinizer ignore-call */ getForm());
Loading history...
101
                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
102
                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_utf8map_edit.tpl');
103
                break;
104
            case 'save':
105
                $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map');
106
                $id             = 0;
107
                $id             = Request::getInt('id', 0, 'REQUEST');
108
                if ($id) {
109
                    $utf8map = $utf8mapHandler->get($id);
110
                } else {
111
                    $utf8map = $utf8mapHandler->create();
112
                }
113
                $utf8map->setVars($_POST[$id]);
114
115
                if (!$id = $utf8mapHandler->insert($utf8map)) {
116
                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_UTF8MAP_FAILEDTOSAVE);
117
                    exit(0);
118
                }
119
                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
120
                    redirect_header(
121
                        $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
122
                        10,
123
                        _AM_SONGLIST_MSG_UTF8MAP_SAVEDOKEY
124
                    );
125
                } else {
126
                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_UTF8MAP_SAVEDOKEY);
127
                }
128
                exit(0);
129
130
                break;
131
            case 'savelist':
132
                $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map');
133
                foreach ($_REQUEST['id'] as $id) {
134
                    $utf8map = $utf8mapHandler->get($id);
135
                    $utf8map->setVars($_POST[$id]);
136
                    if (!$utf8mapHandler->insert($utf8map)) {
137
                        redirect_header(
138
                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
139
                            10,
140
                            _AM_SONGLIST_MSG_UTF8MAP_FAILEDTOSAVE
141
                        );
142
                        exit(0);
143
                    }
144
                }
145
                redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_UTF8MAP_SAVEDOKEY);
146
                exit(0);
147
                break;
148
            case 'delete':
149
                $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map');
150
                $id             = 0;
151
                if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
152
                    $utf8map = $utf8mapHandler->get($id);
153
                    if (!$utf8mapHandler->delete($utf8map)) {
154
                        redirect_header(
155
                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
156
                            10,
157
                            _AM_SONGLIST_MSG_UTF8MAP_FAILEDTODELETE
158
                        );
159
                        exit(0);
160
                    }
161
                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_UTF8MAP_DELETED);
162
                    exit(0);
163
                }
164
                $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST'));
165
                xoops_confirm(
166
                    ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
167
                    $_SERVER['SCRIPT_NAME'],
168
                    sprintf(_AM_SONGLIST_MSG_UTF8MAP_DELETE, $utf8map->getVar('from'), $utf8map->getVar('to'))
0 ignored issues
show
It seems like $utf8map->getVar('from') can also be of type array and array; however, parameter $values of sprintf() does only seem to accept double|integer|string, maybe add an additional type check? ( Ignorable by Annotation )

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

168
                    sprintf(_AM_SONGLIST_MSG_UTF8MAP_DELETE, /** @scrutinizer ignore-type */ $utf8map->getVar('from'), $utf8map->getVar('to'))
Loading history...
169
                );
170
171
                break;
172
        }
173
        break;
174
}
175
176
xoops_cp_footer();
177