Issues (340)

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

1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Newbb;
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
/**
16
 * @copyright    XOOPS Project (https://xoops.org)/
17
 * @license      GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
18
 * @author       phppp (D.J., [email protected])
19
 * @author       XOOPS Development Team
20
 */
21
22
use XoopsTree;
23
24
require_once $GLOBALS['xoops']->path('class/xoopstree.php');
25
26
/**
27
 * Class Tree
28
 */
29
class Tree extends XoopsTree
30
{
31
    /** @var string */
32
    private string $prefix = '&nbsp;&nbsp;';
33
    /** @var string */
34
    private string $increment = '&nbsp;&nbsp;';
35
    /** @var array */
36
    private array $postArray = [];
37
38
    /**
39
     * @param string $table_name
40
     * @param string $id_name
41
     * @param string $pid_name
42
     */
43
    public function __construct($table_name, $id_name = 'post_id', $pid_name = 'pid')
44
    {
45
        parent::__construct($table_name, $id_name, $pid_name);
46
    }
47
48
    /**
49
     * @param string $val
50
     */
51
    public function setPrefix(string $val = ''): void
52
    {
53
        $this->prefix    = $val;
54
        $this->increment = $val;
55
    }
56
57
    /**
58
     * @param int    $sel_id
59
     * @param string $order
60
     */
61
    public function getAllPostArray(int $sel_id, string $order = ''): void
62
    {
63
        $this->postArray = $this->getAllChild($sel_id, $order);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getAllChild($sel_id, $order) can also be of type mixed. However, the property $postArray is declared as type array. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
64
    }
65
66
    /**
67
     * @param array $postArray
68
     */
69
    public function setPostArray(array $postArray): void
70
    {
71
        $this->postArray = $postArray;
72
    }
73
74
    // returns an array of first child objects for a given id($sel_id)
75
76
    /**
77
     * @param mixed  $postTree_array
78
     * @param int    $pid
79
     * @param string $prefix
80
     * @return bool
81
     */
82
    public function getPostTree(&$postTree_array, int $pid = 0, string $prefix = '&nbsp;&nbsp;'): bool
83
    {
84
        if (!\is_array($postTree_array)) {
85
            $postTree_array = [];
86
        }
87
88
        $newPostArray = [];
89
        $prefix       .= $this->increment;
90
        foreach ($this->postArray as $post) {
91
            if ($post->getVar('pid') == $pid) {
92
                $postTree_array[] = [
93
                    'prefix'      => $prefix,
94
                    'icon'        => $post->getVar('icon'),
95
                    'post_time'   => $post->getVar('post_time'),
96
                    'post_id'     => $post->getVar('post_id'),
97
                    'forum_id'    => $post->getVar('forum_id'),
98
                    'subject'     => $post->getVar('subject'),
99
                    'poster_name' => $post->getVar('poster_name'),
100
                    'uid'         => $post->getVar('uid'),
101
                ];
102
                $this->getPostTree($postTree_array, $post->getVar('post_id'), $prefix);
103
            } else {
104
                $newPostArray[] = $post;
105
            }
106
        }
107
        $this->postArray = $newPostArray;
108
        unset($newPostArray);
109
110
        return true;
111
    }
112
}
113