Issues (167)

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/Field.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Tdmdownloads;
6
7
/**
8
 * TDMDownload
9
 *
10
 * You may not change or alter any portion of this comment or credits
11
 * of supporting developers from this source code or any supporting source code
12
 * which is considered copyrighted (c) material of the original comment or credit authors.
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 *
17
 * @copyright   Gregory Mage (Aka Mage)
18
 * @license     GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
19
 * @author      Gregory Mage (Aka Mage)
20
 */
21
22
/**
23
 * Class Field
24
 * @package XoopsModules\Tdmdownloads
25
 */
26
class Field extends \XoopsObject
27
{
28
    // constructor
29
    public function __construct()
30
    {
31
        $this->initVar('fid', \XOBJ_DTYPE_INT, null, false, 11);
32
        $this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false);
33
        $this->initVar('img', \XOBJ_DTYPE_TXTBOX, null, false);
34
        $this->initVar('weight', \XOBJ_DTYPE_INT, null, false, 11);
35
        $this->initVar('status', \XOBJ_DTYPE_INT, null, false, 5);
36
        $this->initVar('search', \XOBJ_DTYPE_INT, null, false, 5);
37
        $this->initVar('status_def', \XOBJ_DTYPE_INT, null, false, 5);
38
        //pour les jointures
39
        $this->initVar('data', \XOBJ_DTYPE_TXTAREA, null, false);
40
    }
41
42
    /**
43
     * @param null $db
44
     * @return int|string
45
     */
46
    public function getNewEnreg($db = null)
47
    {
48
        $newEnreg = 0;
49
        /** @var \XoopsMySQLDatabase $db */
50
        if (null !== $db) {
51
            $newEnreg = $db->getInsertId();
52
        }
53
        return $newEnreg;
54
    }
55
56
    /**
57
     * @param bool $action
58
     *
59
     * @return \XoopsThemeForm
60
     */
61
    public function getForm($action = false)
62
    {
63
        $helper        = Helper::getInstance();
64
        $moduleDirName = \basename(\dirname(__DIR__));
65
        if (!$action) {
66
            $action = $_SERVER['REQUEST_URI'];
67
        }
68
        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
69
        //nom du formulaire selon l'action (editer ou ajouter):
70
        $title = $this->isNew() ? \sprintf(_AM_TDMDOWNLOADS_FORMADD) : \sprintf(_AM_TDMDOWNLOADS_FORMEDIT);
71
        //création du formulaire
72
        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
73
        $form->setExtra('enctype="multipart/form-data"');
74
        //titre
75
        if (1 == $this->getVar('status_def')) {
76
            $form->addElement(new \XoopsFormLabel(_AM_TDMDOWNLOADS_FORMTITLE, $this->getVar('title')));
77
            $form->addElement(new \XoopsFormHidden('title', $this->getVar('title')));
0 ignored issues
show
It seems like $this->getVar('title') 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

77
            $form->addElement(new \XoopsFormHidden('title', /** @scrutinizer ignore-type */ $this->getVar('title')));
Loading history...
78
        } else {
79
            $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMTITLE, 'title', 50, 255, $this->getVar('title')), true);
0 ignored issues
show
It seems like $this->getVar('title') 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

79
            $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMTITLE, 'title', 50, 255, /** @scrutinizer ignore-type */ $this->getVar('title')), true);
Loading history...
80
        }
81
        //image
82
        $downloadsfield_img = $this->getVar('img') ?: 'blank.gif';
83
        $uploadirectory     = '/uploads/' . $moduleDirName . '/images/field';
84
        $imgtray            = new \XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMIMAGE, '<br>');
85
        $imgpath            = \sprintf(_AM_TDMDOWNLOADS_FORMPATH, $uploadirectory);
86
        $imageselect        = new \XoopsFormSelect($imgpath, 'downloadsfield_img', $downloadsfield_img);
87
        $topics_array       = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadirectory);
88
        foreach ($topics_array as $image) {
89
            $imageselect->addOption($image, $image);
90
        }
91
        $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"downloadsfield_img\", \"" . $uploadirectory . '", "", "' . XOOPS_URL . "\")'");
92
        $imgtray->addElement($imageselect, false);
93
        $imgtray->addElement(new \XoopsFormLabel('', "<br><img src='" . XOOPS_URL . '/' . $uploadirectory . '/' . $downloadsfield_img . "' name='image3' id='image3' alt=''><br>"));
94
        $fileseltray = new \XoopsFormElementTray('', '<br>');
95
        $fileseltray->addElement(new \XoopsFormFile(_AM_TDMDOWNLOADS_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxuploadsize')), false);
96
        $fileseltray->addElement(new \XoopsFormLabel(''), false);
97
        $imgtray->addElement($fileseltray);
98
        $form->addElement($imgtray);
99
        //poids du champ
100
        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMWEIGHT, 'weight', 5, 5, $this->getVar('weight', 'e')), false);
101
        // affiché?
102
        $status = $this->getVar('status') ?: 0;
103
        $form->addElement(new \XoopsFormRadioYN(_AM_TDMDOWNLOADS_FORMAFFICHE, 'status', $status));
104
        // affiché dans le champ de recherche?
105
        $search = $this->getVar('search') ?: 0;
106
        $form->addElement(new \XoopsFormRadioYN(_AM_TDMDOWNLOADS_FORMAFFICHESEARCH, 'search', $search));
107
        // pour passer "fid" si on modifie le champ
108
        if (!$this->isNew()) {
109
            $form->addElement(new \XoopsFormHidden('fid', $this->getVar('fid')));
110
            $form->addElement(new \XoopsFormHidden('status_def', $this->getVar('status_def')));
111
        } else {
112
            $form->addElement(new \XoopsFormHidden('status_def', 0));
113
        }
114
        //pour enregistrer le formulaire
115
        $form->addElement(new \XoopsFormHidden('op', 'save_field'));
116
        //boutton d'envoi du formulaire
117
        $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', 'submit', false));
118
        return $form;
119
    }
120
}
121