Issues (76)

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/Category.php (6 issues)

Labels
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Xoopsfaq;
4
5
/*
6
 You may not change or alter any portion of this comment or credits of
7
 supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit
9
 authors.
10
11
 This program is distributed in the hope that it will be useful, but
12
 WITHOUT ANY WARRANTY; without even the implied warranty of
13
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 */
15
16
/**
17
 * XOOPS FAQ Category & Category Handler Class Definitions
18
 *
19
 * @author    John Neill
20
 * @author    XOOPS Module Development Team
21
 * @copyright Copyright (c) 2001-2017 {@link https://xoops.org XOOPS Project}
22
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GNU Public License
23
 * @since     ::   1.23
24
 */
25
26
use Xmf\Module\Helper\Permission;
27
use XoopsFormButtonTray;
28
use XoopsFormHidden;
29
use XoopsFormText;
30
use XoopsObject;
31
use XoopsThemeForm;
32
33
/**
34
 * Category
35
 *
36
 * Class used to handle all of the CRUD actions for FAQ categories
37
 *
38
 * @author   ::    John Neill
39
 * @copyright:: Copyright (c) 2009
40
 */
41
final class Category extends XoopsObject
42
{
43
    private $category_id;
0 ignored issues
show
The private property $category_id is not used, and could be removed.
Loading history...
44
    private $category_title;
0 ignored issues
show
The private property $category_title is not used, and could be removed.
Loading history...
45
    private $category_order;
0 ignored issues
show
The private property $category_order is not used, and could be removed.
Loading history...
46
47
    /**
48
     * Constructor
49
     */
50
    public function __construct()
51
    {
52
        parent::__construct();
53
        $this->initVar('category_id', \XOBJ_DTYPE_INT, null, false);
54
        $this->initVar('category_title', \XOBJ_DTYPE_TXTBOX, null, true, 255);
55
        $this->initVar('category_order', \XOBJ_DTYPE_INT, 0, false);
56
    }
57
58
    /**
59
     * Display the category title
60
     *
61
     * @return string display the category title (filtered for display)
62
     */
63
    public function __toString()
64
    {
65
        return (string)$this->getVar('category_title', 's');
66
    }
67
68
    /**
69
     * Display the category edit form
70
     */
71
    public function displayForm(): void
72
    {
73
        echo $this->renderForm();
74
    }
75
76
    /**
77
     * Render the category edit form
78
     *
79
     * @return string HTML entities used to edit the catagory object
80
     */
81
    public function renderForm(): string
82
    {
83
        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
84
        $permHelper = new Permission();
85
        \xoops_load('constants', \basename(\dirname(__DIR__)));
86
87
        $caption = ($this->isNew()) ? \_AM_XOOPSFAQ_CREATE_NEW : \sprintf(\_AM_XOOPSFAQ_MODIFY_ITEM, $this->getVar('category_title'));
0 ignored issues
show
It seems like $this->getVar('category_title') 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

87
        $caption = ($this->isNew()) ? \_AM_XOOPSFAQ_CREATE_NEW : \sprintf(\_AM_XOOPSFAQ_MODIFY_ITEM, /** @scrutinizer ignore-type */ $this->getVar('category_title'));
Loading history...
88
89
        $form = new XoopsThemeForm($caption, 'content', \xoops_getenv('SCRIPT_NAME'), 'post', true);
90
        $form->addElement(new XoopsFormHidden('op', 'save'));
91
        $form->addElement(new XoopsFormHidden('category_id', $this->getVar('category_id')));
0 ignored issues
show
It seems like $this->getVar('category_id') can also be of type array and array; however, parameter $value of XoopsFormHidden::__construct() does only seem to accept 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

91
        $form->addElement(new XoopsFormHidden('category_id', /** @scrutinizer ignore-type */ $this->getVar('category_id')));
Loading history...
92
        // title
93
        $category_title = new XoopsFormText(\_AM_XOOPSFAQ_E_CATEGORY_TITLE, 'category_title', 50, 150, $this->getVar('category_title', 'e'));
0 ignored issues
show
It seems like $this->getVar('category_title', 'e') can also be of type array and array; however, parameter $value of XoopsFormText::__construct() does only seem to accept 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

93
        $category_title = new XoopsFormText(\_AM_XOOPSFAQ_E_CATEGORY_TITLE, 'category_title', 50, 150, /** @scrutinizer ignore-type */ $this->getVar('category_title', 'e'));
Loading history...
94
        $category_title->setDescription(\_AM_XOOPSFAQ_E_CATEGORY_TITLE_DESC);
95
        $form->addElement($category_title, true);
96
        // order
97
        $category_order = new XoopsFormText(\_AM_XOOPSFAQ_E_CATEGORY_ORDER, 'category_order', 5, 5, $this->getVar('category_order', 'e'));
98
        $category_order->setDescription(\_AM_XOOPSFAQ_E_CATEGORY_ORDER_DESC);
99
        $form->addElement($category_order, false);
100
        $form->addElement($permHelper->getGroupSelectFormForItem('viewcat', $this->getVar('category_id'), \_AM_XOOPSFAQ_CATEGORY_GROUP_PERMS, '', Constants::INCLUDE_ANNON));
101
        $form->addElement(new XoopsFormButtonTray('category_form', \_SUBMIT, 'submit'));
102
103
        return $form->render();
104
    }
105
}
106