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

1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Songlist;
4
5
/*
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
use CriteriaElement;
16
use XoopsDatabase;
17
use XoopsPersistableObjectHandler;
18
19
/**
20
 * @copyright      {@link https://xoops.org/ XOOPS Project}
21
 * @license        {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
22
 * @author         XOOPS Development Team, Wishcraft
23
 */
24
25
/**
26
 * Class VisibilityHandler
27
 */
28
class VisibilityHandler extends XoopsPersistableObjectHandler
29
{
30
    /**
31
     * VisibilityHandler constructor.
32
     * @param \XoopsDatabase $db
33
     */
34
    public function __construct(XoopsDatabase $db)
35
    {
36
        parent::__construct($db, 'songlist_visibility', Visibility::class, 'field_id');
37
    }
38
39
    /**
40
     * get all objects matching a condition
41
     *
42
     * @param \CriteriaElement|null $criteria {@link \CriteriaElement} to match
43
     * @param null                  $fields
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $fields is correct as it would always require null to be passed?
Loading history...
44
     * @param bool                  $asObject
45
     * @param bool                  $id_as_key
46
     * @return array of objects/array <a href='psi_element://XoopsObject'>XoopsObject</a>
47
     * @internal param array $fields variables to fetch
48
     * @internal param bool $asObject flag indicating as object, otherwise as array
49
     * @internal param bool $id_as_key use the ID as key for the array
50
     */
51
    public function &getAll(CriteriaElement $criteria = null, $fields = null, $asObject = true, $id_as_key = true): array //getAll($criteria = null)
52
    {
53
        $limit            = null;
54
        $GLOBALS['start'] = null;
55
        $sql              = "SELECT * FROM `{$this->table}`";
56
        if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
57
            $sql     .= ' ' . $criteria->renderWhere();
58
            $groupby = $criteria->getGroupby();
59
            if ($groupby) {
60
                $sql .= ' ' . $groupby;
61
            }
62
            $sort = $criteria->getSort();
63
            if ($sort) {
64
                $sql      .= " ORDER BY {$sort} " . $criteria->getOrder();
65
                $orderSet = true;
66
            }
67
            $limit            = $criteria->getLimit();
68
            $GLOBALS['start'] = $criteria->getStart();
69
        }
70
        if (empty($orderSet)) {
71
            $sql .= " ORDER BY `{$this->keyName}` DESC";
72
        }
73
        $result = $this->db->query($sql, $limit, $GLOBALS['start']);
74
        $ret    = [];
75
        while (false !== ($row = $this->db->fetchArray($result))) {
76
            $ret[$row['field_id']][] = $row;
77
        }
78
79
        return $ret;
80
    }
81
82
    /**
83
     * Get fields visible to the $user_groups on a $profile_groups profile
84
     *
85
     * @param array $profile_groups groups of the user to be accessed
86
     * @param array $user_groups    groups of the visitor, default as $GLOBALS['xoopsUser']
87
     *
88
     * @return array
89
     */
90
    public function getVisibleFields($profile_groups, $user_groups = []): array
91
    {
92
        $profile_groups[] = '0';
93
        $user_groups[]    = '0';
94
        $profile_groups[] = $user_groups[] = 0;
95
        $sql              = "SELECT field_id FROM {$this->table} WHERE profile_group IN (" . \implode(',', $profile_groups) . ')';
96
        $sql              .= ' AND user_group IN (' . \implode(',', $user_groups) . ')';
97
        $field_ids        = [];
98
        $result           = $this->db->query($sql);
99
        if ($result) {
100
            while ([$field_id] = $this->db->fetchRow($result)) {
101
                $field_ids[] = $field_id;
102
            }
103
        }
104
105
        return $field_ids;
106
    }
107
}
108