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.

class/utf8map - Copy.php (4 issues)

1
<?php declare(strict_types=1);
2
3
require_once \dirname(__DIR__) . '/include/songlist.object.php';
4
require_once \dirname(__DIR__) . '/include/songlist.form.php';
5
6
/**
7
 * Class Utf8map
8
 */
9
class Utf8map extends \XoopsObject
10
{
11
    /**
12
     * Utf8map constructor.
13
     * @param null $fid
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $fid is correct as it would always require null to be passed?
Loading history...
14
     */
15
    public function __construct($fid = null)
0 ignored issues
show
The parameter $fid is not used and could be removed. ( Ignorable by Annotation )

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

15
    public function __construct(/** @scrutinizer ignore-unused */ $fid = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
    {
17
        $this->initVar('utfid', XOBJ_DTYPE_INT, 0, false);
18
        $this->initVar('from', XOBJ_DTYPE_TXTBOX, null, false, 2);
19
        $this->initVar('to', XOBJ_DTYPE_TXTBOX, null, false, 2);
20
        $this->initVar('created', XOBJ_DTYPE_INT, 0, false);
21
        $this->initVar('updated', XOBJ_DTYPE_INT, 0, false);
22
    }
23
24
    /**
25
     * @param bool $as_array
26
     * @return array|string
27
     */
28
    public function getForm($as_array = false)
29
    {
30
        return songlist_utf8map_get_form($this, $as_array);
0 ignored issues
show
The function songlist_utf8map_get_form 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

30
        return /** @scrutinizer ignore-call */ songlist_utf8map_get_form($this, $as_array);
Loading history...
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    public function toArray(): array
37
    {
38
        $ret  = parent::toArray();
39
        $form = $this->getForm(true);
40
        foreach ($form as $key => $element) {
41
            $ret['form'][$key] = $element->render();
42
        }
43
        foreach (['created', 'updated'] as $key) {
44
            if ($this->getVar($key) > 0) {
45
                $ret['form'][$key] = date(_DATESTRING, $this->getVar($key));
46
                $ret[$key]         = date(_DATESTRING, $this->getVar($key));
47
            }
48
        }
49
50
        return $ret;
51
    }
52
}
53
54
/**
55
 * Class Utf8mapHandler
56
 */
57
class Utf8mapHandler extends \XoopsPersistableObjectHandler
58
{
59
    /**
60
     * Utf8mapHandler constructor.
61
     * @param \XoopsDatabase $db
62
     */
63
    public function __construct(\XoopsDatabase $db)
64
    {
65
        parent::__construct($db, 'songlist_utf8map', Utf8map::class, 'utfid', 'from');
66
    }
67
68
    /**
69
     * @return array
70
     */
71
    public function filterFields(): array
72
    {
73
        return ['utfid', 'from', 'to', 'created', 'updated'];
74
    }
75
76
    /**
77
     * @param $filter
78
     * @return \CriteriaCompo
79
     */
80
    public function getFilterCriteria($filter): \CriteriaCompo
81
    {
82
        $parts    = explode('|', $filter);
83
        $criteria = new \CriteriaCompo();
84
        foreach ($parts as $part) {
85
            $var = explode(',', $part);
86
            if (!empty($var[1]) && !is_numeric($var[0])) {
87
                $object = $this->create();
88
                if (XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
89
                    || XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
90
                    $criteria->add(new \Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
91
                } elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
92
                    $criteria->add(new \Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
93
                } elseif (XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
94
                    $criteria->add(new \Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
95
                } elseif (XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
96
                    $criteria->add(new \Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
97
                }
98
            } elseif (!empty($var[1]) && is_numeric($var[0])) {
99
                $criteria->add(new \Criteria($var[0], $var[1]));
100
            }
101
        }
102
103
        return $criteria;
104
    }
105
106
    /**
107
     * @param        $filter
108
     * @param        $field
109
     * @param string $sort
110
     * @param string $op
111
     * @param string $fct
112
     * @return string
113
     */
114
    public function getFilterForm($filter, $field, $sort = 'created', $op = 'dashboard', $fct = 'list'): string
115
    {
116
        $ele = songlist_getFilterElement($filter, $field, $sort, $op, $fct);
117
        if (is_object($ele)) {
118
            return $ele->render();
119
        }
120
121
        return '&nbsp;';
122
    }
123
124
    /**
125
     * @param bool $force
126
     * @return mixed
127
     */
128
    public function insert(\XoopsObject $obj, $force = true)
129
    {
130
        if ($obj->isNew()) {
131
            $obj->setVar('created', time());
132
        } else {
133
            $obj->setVar('updated', time());
134
        }
135
136
        return parent::insert($obj, $force);
137
    }
138
139
    /**
140
     * @param string $phrase
141
     * @param null   $criteria
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $criteria is correct as it would always require null to be passed?
Loading history...
142
     * @return string|string[]
143
     */
144
    public function convert($phrase = '', $criteria = null)
145
    {
146
        foreach ($this->getObjects($criteria, true) as $utfid => $utf8) {
147
            $phrase = str_replace(mb_strtolower($utf8->getVar('from')), \mb_strtolower($utf8->getVar('to')), $phrase);
148
            $phrase = str_replace(mb_strtoupper($utf8->getVar('from')), \mb_strtoupper($utf8->getVar('to')), $phrase);
149
        }
150
151
        return $phrase;
152
    }
153
}
154