Issues (278)

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.

admin/column.php (5 issues)

1
<?php
2
/**
3
 * Module: Soapbox
4
 * Author: hsalazar
5
 * Licence: GNU
6
 */
7
8
use Xmf\Request;
9
use XoopsModules\Soapbox;
10
11
/* General Stuff */
12
require_once __DIR__ . '/admin_header.php';
13
$adminObject = \Xmf\Module\Admin::getInstance();
14
15
/** @var Soapbox\Helper $helper */
16
$helper = Soapbox\Helper::getInstance();
17
18
$op = '';
19
if (\Xmf\Request::hasVar('op', 'GET')) {
20
    $op = trim(strip_tags($myts->stripSlashesGPC($_GET['op'])));
21
}
22
if (\Xmf\Request::hasVar('op', 'POST')) {
23
    $op = trim(strip_tags($myts->stripSlashesGPC($_POST['op'])));
24
}
25
26
/** @var \XoopsModules\Soapbox\EntrydataHandler $entrydataHandler */
27
$entrydataHandler = new \XoopsModules\Soapbox\EntrydataHandler();
28
29
/**
30
 * @param int|string $columnID
31
 */
32
function editcol($columnID = '')
33
{
34
    global $indexAdmin;
35
    global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsLogger, $xoopsOption, $xoopsUserIsAdmin;
36
    /** @var Soapbox\Helper $helper */
37
    $helper = Soapbox\Helper::getInstance();
38
39
    $adminObject = \Xmf\Module\Admin::getInstance();
40
    $xoopsDB     = \XoopsDatabaseFactory::getDatabaseConnection();
0 ignored issues
show
The assignment to $xoopsDB is dead and can be removed.
Loading history...
41
    $myts        = \MyTextSanitizer::getInstance();
42
43
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
44
    $columnID = (int)$columnID;
45
    /** @var \XoopsModules\Soapbox\EntrydataHandler $entrydataHandler */
46
    $entrydataHandler = new \XoopsModules\Soapbox\EntrydataHandler();
47
    // If there is a parameter, and the id exists, retrieve data: we're editing a column
48
    if (0 !== $columnID) {
49
        //get category object
50
        $_categoryob = $entrydataHandler->getColumn($columnID);
51
        if (!is_object($_categoryob)) {
52
            redirect_header('index.php', 1, _AM_SOAPBOX_NOCOLTOEDIT);
53
        }
54
        //get vars
55
        $category_vars = $_categoryob->getVars();
56
        foreach ($category_vars as $k => $v) {
57
            $e_category[$k] = $_categoryob->getVar($k, 'E');
58
        }
59
60
        xoops_cp_header();
61
        $adminObject->displayNavigation(basename(__FILE__));
62
        //adminMenu(1, _AM_SOAPBOX_COLS._AM_SOAPBOX_EDITING . $_categoryob->getVar('name') . "'");
63
        //echo "<h3 style='color: #2F5376; '>"._AM_SOAPBOX_ADMINCOLMNGMT."</h3>";
64
65
        //editcol(0);
66
67
        $sform = new \XoopsThemeForm(_AM_SOAPBOX_MODCOL . ': ' . $_categoryob->getVar('name'), 'op', $myts->htmlSpecialChars(xoops_getenv('PHP_SELF')), 'post', true);
68
    } else {
69
        $_categoryob = $entrydataHandler->createColumn(true);
70
        //mb        $_categoryob->cleanVars();
71
72
        //get vars
73
        $category_vars = $_categoryob->getVars();
74
        foreach ($category_vars as $k => $v) {
75
            $e_category[$k] = $_categoryob->getVar($k, 'E');
76
        }
77
78
        $e_category['weight'] = 1;
79
        $e_category['author'] = $xoopsUser->uid();
80
81
        xoops_cp_header();
82
        $adminObject->displayNavigation(basename(__FILE__));
83
        //adminMenu(1, _AM_SOAPBOX_COLS._AM_SOAPBOX_CREATINGCOL);
84
        //echo "<h3 style='color: #2F5376; '>"._AM_SOAPBOX_ADMINCOLMNGMT."</h3>";
85
86
        //editcol(0);
87
88
        $sform = new \XoopsThemeForm(_AM_SOAPBOX_NEWCOL, 'op', $myts->htmlSpecialChars(xoops_getenv('PHP_SELF')), 'post', true);
89
    }
90
91
    $sform->setExtra('enctype="multipart/form-data"');
92
    $sform->addElement(new \XoopsFormText(_AM_SOAPBOX_COLNAME, 'name', 50, 80, $e_category['name']), true);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $e_category does not seem to be defined for all execution paths leading up to this point.
Loading history...
93
94
    /*
95
        ob_start();
96
        getuserForm((int)($e_category['author']));
97
        $sform->addElement(new \XoopsFormLabel(_AM_SOAPBOX_AUTHOR, ob_get_contents()));
98
        ob_end_clean();
99
    */
100
    require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
101
102
    $userstart = \Xmf\Request::getInt('userstart', 0, 'GET');
103
104
    $memberHandler = xoops_getHandler('member');
105
    $usercount     = $memberHandler->getUserCount();
0 ignored issues
show
The method getUserCount() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

105
    /** @scrutinizer ignore-call */ 
106
    $usercount     = $memberHandler->getUserCount();
Loading history...
106
    // Selector to get author
107
    if (empty($e_category['author'])) {
108
        $authorid    = $xoopsUser->uid();
109
        $authoruname = $xoopsUser->uname();
110
    } else {
111
        $author_ob   = $memberHandler->getUser($e_category['author']);
0 ignored issues
show
The method getUser() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsAvatarHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

111
        /** @scrutinizer ignore-call */ 
112
        $author_ob   = $memberHandler->getUser($e_category['author']);
Loading history...
112
        $authorid    = $author_ob->uid();
113
        $authoruname = $author_ob->uname();
114
    }
115
    $criteria = new \CriteriaCompo();
116
    $criteria->add(new \Criteria('uid', $authorid, '!='));
117
    $criteria->setSort('uname');
118
    $criteria->setOrder('ASC');
119
    $criteria->setLimit(199);
120
    $criteria->setStart($userstart);
121
    $user_list_arr = [$authorid => $authoruname] + $memberHandler->getUserList($criteria);
0 ignored issues
show
The method getUserList() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

121
    $user_list_arr = [$authorid => $authoruname] + $memberHandler->/** @scrutinizer ignore-call */ getUserList($criteria);
Loading history...
122
123
    $nav = new \XoopsPageNav($usercount, 200, $userstart, 'userstart', $myts->htmlSpecialChars('op=mod&columnID=' . $columnID));
124
125
    $user_select = new \XoopsFormSelect('', 'author', $authorid);
126
    $user_select->addOptionArray($user_list_arr);
127
    $user_select_tray = new \XoopsFormElementTray(_AM_SOAPBOX_AUTHOR, '<br>');
128
    $user_select_tray->addElement($user_select);
129
    $user_select_nav = new \XoopsFormLabel('', $nav->renderNav(4));
130
    $user_select_tray->addElement($user_select_nav);
131
    $sform->addElement($user_select_tray);
132
133
    //HACK by domifara for Wysiwyg
134
    $sform->addElement(new \XoopsFormTextArea(_AM_SOAPBOX_COLDESCRIPT, 'description', $e_category['description'], 7, 60));
135
    //    $editor=soapbox_getWysiwygForm($helper->getConfig('editorUser') , _AM_SOAPBOX_COLDESCRIPT, 'description',  $e_category['description'], '100%', '300px');
136
    //    $sform->addElement($editor,true);
137
138
    $sform->addElement(new \XoopsFormText(_AM_SOAPBOX_COLPOSIT, 'weight', 4, 4, $e_category['weight']));
139
140
    // notification public
141
    $notifypub_radio = new \XoopsFormRadioYN(_AM_SOAPBOX_NOTIFY, 'notifypub', $e_category['notifypub'], ' ' . _AM_SOAPBOX_YES . '', ' ' . _AM_SOAPBOX_NO . '');
142
    $sform->addElement($notifypub_radio);
143
144
    if (!isset($e_category['colimage']) || empty($e_category['colimage']) || '' === $e_category['colimage']) {
145
        $e_category['colimage'] = 'nopicture.png';
146
    }
147
    $graph_array     = \XoopsLists:: getImgListAsArray(XOOPS_ROOT_PATH . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')));
148
    $colimage_select = new \XoopsFormSelect('', 'colimage', $e_category['colimage']);
149
    $colimage_select->addOptionArray($graph_array);
150
    $colimage_select->setExtra("onchange='showImgSelected(\"image3\", \"colimage\", \"" . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '", "", "' . XOOPS_URL . "\")'");
151
    $colimage_tray = new \XoopsFormElementTray(_AM_SOAPBOX_COLIMAGE, '&nbsp;');
152
    $colimage_tray->addElement($colimage_select);
153
    $colimage_tray->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '/' . $e_category['colimage'] . "' name='image3' id='image3' alt=''>"));
154
    $sform->addElement($colimage_tray);
155
156
    // Code to call the file browser to select an image to upload
157
    $sform->addElement(new \XoopsFormFile(_AM_SOAPBOX_COLIMAGEUPLOAD, 'cimage', (int)$helper->getConfig('maxfilesize')), false);
158
159
    $sform->addElement(new \XoopsFormHidden('columnID', $e_category['columnID']));
160
161
    $buttonTray = new \XoopsFormElementTray('', '');
162
    $hidden     = new \XoopsFormHidden('op', 'addcol');
163
    $buttonTray->addElement($hidden);
164
165
    // No ID for column -- then it's new column, button says 'Create'
166
    if (empty($e_category['columnID'])) {
167
        $butt_create = new \XoopsFormButton('', '', _AM_SOAPBOX_CREATE, 'submit');
168
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcol\'"');
169
        $buttonTray->addElement($butt_create);
170
171
        $butt_clear = new \XoopsFormButton('', '', _AM_SOAPBOX_CLEAR, 'reset');
172
        $buttonTray->addElement($butt_clear);
173
174
        $butt_cancel = new \XoopsFormButton('', '', _AM_SOAPBOX_CANCEL, 'button');
175
        $butt_cancel->setExtra('onclick="history.go(-1)"');
176
        $buttonTray->addElement($butt_cancel);
177
    } else {        // button says 'Update'
178
        $butt_create = new \XoopsFormButton('', '', _AM_SOAPBOX_MODIFY, 'submit');
179
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcol\'"');
180
        $buttonTray->addElement($butt_create);
181
182
        $butt_cancel = new \XoopsFormButton('', '', _AM_SOAPBOX_CANCEL, 'button');
183
        $butt_cancel->setExtra('onclick="history.go(-1)"');
184
        $buttonTray->addElement($butt_cancel);
185
    }
186
187
    $sform->addElement($buttonTray);
188
    //-----------
189
    //    $xoopsGTicket->addTicketXoopsFormElement($sform, __LINE__);
190
    //-----------
191
    $sform->display();
192
    unset($hidden);
193
}
194
195
switch ($op) {
196
    case 'mod':
197
        $columnID = Request::getInt('columnID', Request::getInt('columnID', 0, 'GET'), 'POST'); //isset($_POST['columnID']) ? (int)($_POST['columnID']) : (int)($_GET['columnID']);
198
        editcol($columnID);
199
        break;
200
    case 'addcol':
201
        //-------------------------
202
        if (!$GLOBALS['xoopsSecurity']->check()) {
203
            redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
204
        }
205
        //-------------------------
206
        //articleID check
207
        if (!isset($_POST['columnID'])) {
208
            redirect_header('index.php', 1, _AM_SOAPBOX_ARTNOTCREATED);
209
        } else {
210
            $columnID = \Xmf\Request::getInt('columnID', 0, 'POST');
211
        }
212
213
        //get category object
214
        /** @var \XoopsModules\Soapbox\EntrydataHandler $entrydataHandler */
215
        $entrydataHandler = new \XoopsModules\Soapbox\EntrydataHandler();
216
        $_categoryob      = $entrydataHandler->getColumn($columnID);
217
        //new data or edit
218
        if (!is_object($_categoryob)) {
219
            $_categoryob = $entrydataHandler->createColumn(true);
220
            //            $_categoryob->cleanVars();
221
222
            $_categoryob->setVar('created', time());
223
        }
224
225
        if (\Xmf\Request::hasVar('columnID', 'POST')) {
226
            $_categoryob->setVar('columnID', $columnID);
227
        }
228
        if (\Xmf\Request::hasVar('name', 'POST')) {
229
            $_categoryob->setVar('name', $_POST['name']);
230
        }
231
        if (\Xmf\Request::hasVar('description', 'POST')) {
232
            $_categoryob->setVar('description', $_POST['description']);
233
        }
234
235
        if (\Xmf\Request::hasVar('weight', 'POST')) {
236
            $_categoryob->setVar('weight', \Xmf\Request::getInt('weight', 0, 'POST'));
237
        }
238
        if (\Xmf\Request::hasVar('notifypub', 'POST')) {
239
            $_categoryob->setVar('notifypub', \Xmf\Request::getInt('notifypub', 0, 'POST'));
240
        }
241
242
        if (\Xmf\Request::hasVar('author', 'POST')) {
243
            if ('-1' === $_POST['author'] && isset($_POST['authorinput'])) {
244
                $author = \Xmf\Request::getInt('authorinput', 0, 'POST');
245
            } else {
246
                $author = \Xmf\Request::getInt('author', 0, 'POST');
247
            }
248
        } else {
249
            $author = $xoopsUser->uid();
250
        }
251
        $_categoryob->setVar('author', $author);
252
253
        //-----------------
254
        //colimage
255
        if (\Xmf\Request::hasVar('colimage', 'POST')) {
256
            $_categoryob->setVar('colimage', $_POST['colimage']);
257
        }
258
        if (isset($_FILES['cimage']['name'])) {
259
            $colimage_name = trim(strip_tags($myts->stripSlashesGPC($_FILES['cimage']['name'])));
260
            if ('' !== $colimage_name) {
261
                if (file_exists(XOOPS_ROOT_PATH . '/' . $helper->getConfig('sbuploaddir') . '/' . $colimage_name)) {
262
                    redirect_header('column.php', 1, _AM_SOAPBOX_FILEEXISTS);
263
                }
264
                $allowed_mimetypes = ['image/gif', 'image/jpeg', 'image/pjpeg', 'image/png'];
265
                Soapbox\Utility::uploadFile($allowed_mimetypes, $colimage_name, 'index.php', 0, $helper->getConfig('sbuploaddir'));
266
                $_categoryob->setVar('colimage', $colimage_name);
267
            }
268
        }
269
        if ('' === $_categoryob->getVar('colimage')) {
270
            $_categoryob->setVar('colimage', 'blank.png');
271
        }
272
        //-----------------
273
274
        // Save to database
275
        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
276
            require $GLOBALS['xoops']->path('class/theme.php');
277
            $GLOBALS['xoTheme'] = new \xos_opal_Theme();
278
        }
279
280
        if ($_categoryob->_isNew) {
281
            if (!$entrydataHandler->insertColumn($_categoryob)) {
282
                xoops_cp_header();
283
                $adminObject->displayNavigation(basename(__FILE__));
284
                // print_r($_categoryob->getErrors());
285
                xoops_cp_footer();
286
                // exit();
287
                redirect_header('index.php', 1, _AM_SOAPBOX_NOTUPDATED);
288
            } else {
289
                //event trigger
290
                $entrydataHandler->newColumnTriggerEvent($_categoryob, 'new_column');
291
                redirect_header('permissions.php', 1, _AM_SOAPBOX_COLCREATED);
292
            }
293
        } else {
294
            if (!$entrydataHandler->insertColumn($_categoryob)) {
295
                redirect_header('index.php', 1, _AM_SOAPBOX_NOTUPDATED);
296
            } else {
297
                redirect_header('index.php', 1, _AM_SOAPBOX_COLMODIFIED);
298
            }
299
        }
300
        //        exit();
301
        break;
302
    case 'del':
303
304
        $confirm = \Xmf\Request::getInt('confirm', 0, 'POST');
305
306
        // confirmed, so delete
307
        if (1 === $confirm) {
308
            //-------------------------
309
            if (!$GLOBALS['xoopsSecurity']->check()) {
310
                redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
311
            }
312
            //-------------------------
313
            //columnID check
314
            if (!isset($_POST['columnID'])) {
315
                redirect_header('index.php', 1, _NOPERM);
316
            } else {
317
                $columnID = \Xmf\Request::getInt('columnID', 0, 'POST');
318
            }
319
            //get category object
320
            $_categoryob = $entrydataHandler->getColumn($columnID);
321
            if (!is_object($_categoryob)) {
322
                redirect_header('index.php', 1, _NOPERM);
323
            }
324
325
            if (!$entrydataHandler->deleteColumn($_categoryob)) {
326
                trigger_error('ERROR:not deleted from database');
327
                exit();
328
            }
329
            $groups           = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
330
            $module_id        = $xoopsModule->getVar('mid');
331
            $grouppermHandler = xoops_getHandler('groupperm');
332
333
            $name = $myts->htmlSpecialChars($_categoryob->getVar('name'));
334
            xoops_groupperm_deletebymoditem($module_id, _AM_SOAPBOX_COLPERMS, $columnID);
335
            redirect_header('index.php', 1, sprintf(_AM_SOAPBOX_COLISDELETED, $name));
336
        } else {
337
            $columnID = \Xmf\Request::getInt('columnID', \Xmf\Request::getInt('columnID', 0, 'GET'), 'POST');
338
            //get category object
339
            $_categoryob = $entrydataHandler->getColumn($columnID);
340
            if (!is_object($_categoryob)) {
341
                redirect_header('index.php', 1, _NOPERM);
342
            }
343
            $name = $myts->htmlSpecialChars($_categoryob->getVar('name'));
344
            xoops_cp_header();
345
            $adminObject->displayNavigation(basename(__FILE__));
346
            xoops_confirm([
347
                              'op'       => 'del',
348
                              'columnID' => $columnID,
349
                              'confirm'  => 1,
350
                              'name'     => $name,
351
                          ], 'column.php', _AM_SOAPBOX_DELETETHISCOL . '<br><br>' . $name, _AM_SOAPBOX_DELETE);
352
            xoops_cp_footer();
353
        }
354
        exit();
355
        break;
356
    case 'cancel':
357
        redirect_header('index.php', 1, sprintf(_AM_SOAPBOX_BACK2IDX, ''));
358
        break;
359
    case 'reorder':
360
        //-------------------------
361
        if (!$GLOBALS['xoopsSecurity']->check()) {
362
            redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
363
        }
364
        $entrydataHandler->reorderColumnsUpdate($_POST['columnweight']);
365
        redirect_header('./column.php', 1, _AM_SOAPBOX_ORDERUPDATED);
366
367
        break;
368
    case 'default':
369
    default:
370
        //$adminObject->displayNavigation(basename(__FILE__));
371
        editcol(0);
372
        //    SoapboxUtility::showColumns(0);
373
374
        break;
375
}
376
require_once __DIR__ . '/admin_footer.php';
377