Issues (292)

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

Labels
Severity
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Adslight\Form;
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
 * Module: Adslight
17
 *
18
 * @category        Module
19
 * @author          XOOPS Development Team <https://xoops.org>
20
 * @copyright       {@link https://xoops.org/ XOOPS Project}
21
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
22
 */
23
24
use Xmf\Request;
25
use XoopsModules\Adslight;
26
27
require_once \dirname(__DIR__, 2) . '/include/common.php';
28
29
$moduleDirName = \basename(\dirname(__DIR__, 2));
30
$permHelper    = new \Xmf\Module\Helper\Permission();
31
32
\xoops_load('XoopsFormLoader');
33
34
/**
35
 * Class ListingForm
36
 */
37
class ListingForm extends \XoopsThemeForm
38
{
39
    public $targetObject;
40
    public $helper;
41
42
    /**
43
     * Constructor
44
     *
45
     * @param $target
46
     */
47
    public function __construct($target)
48
    {
49
        $this->helper       = $target->helper;
50
        $this->targetObject = $target;
51
52
        $this->helper->loadLanguage('admin');
53
54
        $title = $this->targetObject->isNew() ? \AM_ADSLIGHT_LISTING_ADD : \AM_ADSLIGHT_LISTING_EDIT;
55
        parent::__construct($title, 'form', \xoops_getenv('SCRIPT_NAME'), 'post', true);
56
        $this->setExtra('enctype="multipart/form-data"');
57
58
        //include ID field, it's needed so the module knows if it is a new form or an edited form
59
60
        $hidden = new \XoopsFormHidden('lid', $this->targetObject->getVar('lid'));
61
        $this->addElement($hidden);
62
        unset($hidden);
63
64
        // Lid
65
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_LISTING_LID, $this->targetObject->getVar('lid'), 'lid'));
66
        // Cid
67
        //$categoriesHandler = $this->helper->getHandler('Categories');
68
        //$db     = \XoopsDatabaseFactory::getDatabaseConnection();
69
        /** @var \XoopsPersistableObjectHandler $categoriesHandler */
70
        $categoriesHandler = $this->helper->getHandler('Categories');
71
72
        $categories_id_select = new \XoopsFormSelect(\AM_ADSLIGHT_LISTING_CID, 'cid', $this->targetObject->getVar('cid'));
73
        $categories_id_select->addOptionArray($categoriesHandler->getList());
74
        $this->addElement($categories_id_select, false);
75
        // Title
76
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_TITLE, 'title', 50, 255, $this->targetObject->getVar('title')), false);
77
        // Status
78
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_STATUS, 'status', 50, 255, $this->targetObject->getVar('status')), false);
79
        // Expire
80
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_EXPIRE, 'expire', 50, 255, $this->targetObject->getVar('expire')), false);
81
        // Type
82
        //$typeHandler = $this->helper->getHandler('Type');
83
        //$db     = \XoopsDatabaseFactory::getDatabaseConnection();
84
        /** @var \XoopsPersistableObjectHandler $typeHandler */
85
        $typeHandler = $this->helper->getHandler('Type');
86
87
        $type_id_select = new \XoopsFormSelect(\AM_ADSLIGHT_LISTING_TYPE, 'type', $this->targetObject->getVar('type'));
88
        $type_id_select->addOptionArray($typeHandler->getList());
89
        $this->addElement($type_id_select, false);
90
        // Desctext
91
        if (\class_exists('XoopsFormEditor')) {
92
            $editorOptions           = [];
93
            $editorOptions['name']   = 'desctext';
94
            $editorOptions['value']  = $this->targetObject->getVar('desctext', 'e');
95
            $editorOptions['rows']   = 5;
96
            $editorOptions['cols']   = 40;
97
            $editorOptions['width']  = '100%';
98
            $editorOptions['height'] = '400px';
99
            //$editorOptions['editor'] = xoops_getModuleOption('adslight_editor', 'adslight');
100
            //$this->addElement( new \XoopsFormEditor(AM_ADSLIGHT_LISTING_DESCTEXT, 'desctext', $editorOptions), false  );
101
            if ($this->helper->isUserAdmin()) {
102
                $descEditor = new \XoopsFormEditor(\AM_ADSLIGHT_LISTING_DESCTEXT, $this->helper->getConfig('adslightEditorAdmin'), $editorOptions, $nohtml = false, $onfailure = 'textarea');
103
            } else {
104
                $descEditor = new \XoopsFormEditor(\AM_ADSLIGHT_LISTING_DESCTEXT, $this->helper->getConfig('adslightEditorUser'), $editorOptions, $nohtml = false, $onfailure = 'textarea');
105
            }
106
        } else {
107
            $descEditor = new \XoopsFormDhtmlTextArea(\AM_ADSLIGHT_LISTING_DESCTEXT, 'description', $this->targetObject->getVar('description', 'e'), 5, 50);
108
        }
109
        $this->addElement($descEditor);
110
        // Tel
111
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_TEL, 'tel', 50, 255, $this->targetObject->getVar('tel')), false);
112
        // Price
113
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_PRICE, 'price', 50, 255, $this->targetObject->getVar('price')), false);
114
        // Typeprice
115
        //$priceHandler = $this->helper->getHandler('Price');
116
        //$db     = \XoopsDatabaseFactory::getDatabaseConnection();
117
        /** @var \XoopsPersistableObjectHandler $priceHandler */
118
        $priceHandler = $this->helper->getHandler('Price');
119
120
        $price_id_select = new \XoopsFormSelect(\AM_ADSLIGHT_LISTING_TYPEPRICE, 'typeprice', $this->targetObject->getVar('typeprice'));
121
        $price_id_select->addOptionArray($priceHandler->getList());
122
        $this->addElement($price_id_select, false);
123
        // Typecondition
124
        //$conditionHandler = $this->helper->getHandler('Condition');
125
        //$db     = \XoopsDatabaseFactory::getDatabaseConnection();
126
        /** @var \XoopsPersistableObjectHandler $conditionHandler */
127
        $conditionHandler = $this->helper->getHandler('Condition');
128
129
        $condition_id_select = new \XoopsFormSelect(\AM_ADSLIGHT_LISTING_TYPECONDITION, 'typecondition', $this->targetObject->getVar('typecondition'));
130
        $condition_id_select->addOptionArray($conditionHandler->getList());
131
        $this->addElement($condition_id_select, false);
132
        // Date_created
133
        $this->addElement(new \XoopsFormDateTime(\AM_ADSLIGHT_LISTING_DATE_CREATED, 'date_created', 0, $this->targetObject->getVar('date_created')));
134
        // Email
135
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_EMAIL, 'email', 50, 255, $this->targetObject->getVar('email')), false);
136
        // Submitter
137
        $this->addElement(new \XoopsFormSelectUser(\AM_ADSLIGHT_LISTING_SUBMITTER, 'submitter', false, $this->targetObject->getVar('usid'), 1, false), false);
138
        // Usid
139
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_USID, 'usid', 50, 255, $this->targetObject->getVar('usid')), false);
140
        // Town
141
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_TOWN, 'town', 50, 255, $this->targetObject->getVar('town')), false);
142
        // Country
143
        $this->addElement(new \XoopsFormSelectCountry(\AM_ADSLIGHT_LISTING_COUNTRY, 'country', $this->targetObject->getVar('country')), false);
144
        // Contactby
145
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_CONTACTBY, 'contactby', 50, 255, $this->targetObject->getVar('contactby')), false);
146
        // Premium
147
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_PREMIUM, 'premium', 50, 255, $this->targetObject->getVar('premium')), false);
148
        // Valid
149
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_LISTING_VALID, 'valid', 50, 255, $this->targetObject->getVar('valid')), false);
150
        // Photo
151
        //        $photo = $this->targetObject->getVar('photo') ?: 'blank.png';
152
153
        // pull the first picture
154
        $photoName = '';
155
        /** @var \XoopsPersistableObjectHandler $picturesHandler */
156
        $picturesHandler      = $this->helper->getHandler('Pictures');
157
        $lid                  = $this->targetObject->getVar('lid');
158
        $uid                  = $this->targetObject->getVar('usid');
159
        $criteriaLid          = new \Criteria('lid', $lid);
160
        $criteriaUid          = new \Criteria('uid', $uid);
161
        $picturesObjectsArray = $picturesHandler->getObjects($criteriaLid, $criteriaUid);
0 ignored issues
show
$criteriaUid of type Criteria is incompatible with the type boolean expected by parameter $id_as_key of XoopsPersistableObjectHandler::getObjects(). ( Ignorable by Annotation )

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

161
        $picturesObjectsArray = $picturesHandler->getObjects($criteriaLid, /** @scrutinizer ignore-type */ $criteriaUid);
Loading history...
162
        // How many pictures are on the user album
163
        $picturesCount = $picturesHandler->getCount($criteriaLid);
164
        if ($picturesCount > 0) {
165
            $photo1    = \reset($picturesObjectsArray);
166
            $photoName = $photo1->getVar('url');
167
        }
168
        $photo = $photoName ?: 'blank.png';
169
170
        $uploadDir   = '/uploads/adslight/';
171
        $imgtray     = new \XoopsFormElementTray(\AM_ADSLIGHT_LISTING_PHOTO, '<br>');
172
        $imgpath     = \sprintf(\AM_ADSLIGHT_FORMIMAGE_PATH, $uploadDir);
173
        $imageselect = new \XoopsFormSelect($imgpath, 'photo', $photo);
174
        $imageArray  = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadDir);
175
        foreach ($imageArray as $image) {
176
            $imageselect->addOption($image, $image);
177
        }
178
        $imageselect->setExtra("onchange='showImgSelected(\"image_photo\", \"photo\", \"" . $uploadDir . '", "", "' . XOOPS_URL . "\")'");
179
        $imgtray->addElement($imageselect);
180
        $imgtray->addElement(new \XoopsFormLabel('', "<br><img src='" . XOOPS_URL . '/' . $uploadDir . '/' . $photo . "' name='image_photo' id='image_photo' alt='' style='max-width:300px' >"));
181
        $fileseltray = new \XoopsFormElementTray('', '<br>');
182
        $fileseltray->addElement(new \XoopsFormFile(\AM_ADSLIGHT_FORMUPLOAD, 'photo', $this->helper->getConfig('maxsize')));
183
        $fileseltray->addElement(new \XoopsFormLabel(''));
184
        $imgtray->addElement($fileseltray);
185
        $this->addElement($imgtray);
186
        // Hits
187
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_LISTING_HITS, $this->targetObject->getVar('hits'), 'hits'));
188
        // Item_rating
189
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_LISTING_ITEM_RATING, $this->targetObject->getVar('item_rating'), 'item_rating'));
190
        // Item_votes
191
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_LISTING_ITEM_VOTES, $this->targetObject->getVar('item_votes'), 'item_votes'));
192
        // User_rating
193
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_LISTING_USER_RATING, $this->targetObject->getVar('user_rating'), 'user_rating'));
194
        // User_votes
195
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_LISTING_USER_VOTES, $this->targetObject->getVar('user_votes'), 'user_votes'));
196
        // Comments
197
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_LISTING_COMMENTS, $this->targetObject->getVar('comments'), 'comments'));
198
        // Remind
199
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_LISTING_REMIND, $this->targetObject->getVar('remind'), 'remind'));
200
201
        $this->addElement(new \XoopsFormHidden('op', 'save'));
202
        $this->addElement(new \XoopsFormButton('', 'submit', \_SUBMIT, 'submit'));
203
    }
204
}
205