Issues (51)

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.

include/form.page.php (3 issues)

1
<?php
2
/**
3
 * About
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * @copyright      The XOOPS Co.Ltd. http://www.xoops.com.cn
13
 * @copyright      XOOPS Project (https://xoops.org)
14
 * @license        GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
15
 * @package        about
16
 * @since          1.0.0
17
 * @author         Mengjue Shao <[email protected]>
18
 * @author         Susheng Yang <[email protected]>
19
 */
20
21
use Xmf\Request;
22
use XoopsModules\About;
23
use XoopsModules\About\Constants;
24
use XoopsModules\About\Utility;
25
use XoopsModules\About\PageHandler;
26
/** @var Helper $helper */
27
/** @var PageHandler $pageHandler */
28
29
defined('XOOPS_ROOT_PATH') || exit('Restricted access');
30
31
//require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
32
33
$pageType = isset($_REQUEST['type']) ? Request::getInt('type', 0) : $pageObj->getVar('page_type');
34
$format   = empty($format) ? 'e' : $format;
35
36
$menu_status = $pageObj->isNew() ? 1 : $pageObj->getVar('page_menu_status');
37
$list_status = $pageObj->isNew() ? 1 : $pageObj->getVar('page_status');
38
$page_blank  = $pageObj->isNew() ? 0 : $pageObj->getVar('page_blank');
39
40
$title = $pageObj->isNew() ? _AM_ABOUT_PAGE_INSERT : _AM_ABOUT_EDIT;
41
42
$form = new \XoopsThemeForm($title, 'form', 'admin.page.php', 'post', true);
43
$form->setExtra('enctype="multipart/form-data"');
44
45
if (Constants::PAGE_TYPE_PAGE == $pageType) {
46
    $form->addElement(new \XoopsFormText(_AM_ABOUT_PAGE_TITLE, 'page_title', 60, 255, $pageObj->getVar('page_title', $format)), true);
47
    $menu = new \XoopsFormElementTray(_AM_ABOUT_PAGE_MENU_LIST);
48
49
    $menu->addElement(new \XoopsFormRadioYN('', 'page_menu_status', $menu_status));
50
    $menu->addElement(new \XoopsFormText(_AM_ABOUT_PAGE_MENU_TITLE . ':', 'page_menu_title', 30, 255, $pageObj->getVar('page_menu_title', $format)));
51
    $menu->addElement(new \XoopsFormLabel('', _AM_ABOUT_PAGE_LINK_MENU));
52
    $form->addElement($menu, true);
53
54
    $editorTray = new \XoopsFormElementTray(_AM_ABOUT_PAGE_TEXT, '<br>');
55
    if (class_exists('XoopsFormEditor')) {
56
        $options['name']   = 'page_text';
57
        $options['value']  = $pageObj->getVar('page_text');
58
        $options['rows']   = 25;
59
        $options['cols']   = '100%';
60
        $options['width']  = '100%';
61
        $options['height'] = '400px';
62
        $pageEditor        = new \XoopsFormEditor('', $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea');
63
        $editorTray->addElement($pageEditor);
64
    } else {
65
        $pageEditor = new \XoopsFormDhtmlTextArea('', 'page_text', $pageObj->getVar('page_text'), '100%', '100%');
0 ignored issues
show
'100%' of type string is incompatible with the type integer expected by parameter $rows of XoopsFormDhtmlTextArea::__construct(). ( Ignorable by Annotation )

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

65
        $pageEditor = new \XoopsFormDhtmlTextArea('', 'page_text', $pageObj->getVar('page_text'), /** @scrutinizer ignore-type */ '100%', '100%');
Loading history...
'100%' of type string is incompatible with the type integer expected by parameter $cols of XoopsFormDhtmlTextArea::__construct(). ( Ignorable by Annotation )

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

65
        $pageEditor = new \XoopsFormDhtmlTextArea('', 'page_text', $pageObj->getVar('page_text'), '100%', /** @scrutinizer ignore-type */ '100%');
Loading history...
66
        $editorTray->addElement($pageEditor);
67
    }
68
    $form->addElement($editorTray);
69
70
    // Template set
71
    $templates = Utility::getTemplateList('page');
72
    if ($templates && is_array($templates)) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $templates of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
73
        $template_select = new \XoopsFormSelect(_AM_ABOUT_TEMPLATE_SELECT, 'page_tpl', $pageObj->getVar('page_tpl'));
74
        $template_select->addOptionArray($templates);
75
        $form->addElement($template_select);
76
    }
77
} else {
78
    $form->addElement(new \XoopsFormText(_AM_ABOUT_PAGE_MENU_TITLE . ':', 'page_menu_title', 60, 255, $pageObj->getVar('page_menu_title', $format)));
79
    $form->addElement(new \XoopsFormHidden('page_menu_status', $menu_status));
80
    $form->addElement(new \XoopsFormText(_AM_ABOUT_PAGE_LINK_TEXT, 'page_text', 60, 255, $pageObj->isNew() ? XOOPS_URL . $pageObj->getVar('page_text', $format) : $pageObj->getVar('page_text', $format)), true);
81
}
82
83
// Get list of possible parent pages
84
$page_list = $pageHandler->getTrees(0, '--');
85
if (!$pageObj->isNew()) {
86
    $child_list = $pageHandler->getTrees($pageObj->getVar('page_id'));
87
    $page_list  = array_diff_key($page_list, $child_list);  // remove this class' children from 'parent' list
88
    unset($page_list[$pageObj->getVar('page_id')]);        // remove this id from 'parent' list
89
}
90
$page_options = [];
91
if ($page_list) {
92
    foreach ($page_list as $id => $page) {
93
        $page_options[$id] = $page['prefix'] . $page['page_menu_title'];
94
    }
95
}
96
$page_select = new \XoopsFormSelect(_AM_ABOUT_PAGE_HIGHER, 'page_pid', $pageObj->getVar('page_pid'));
97
$page_select->addOption(0, _NONE);
98
$page_select->addOptionArray($page_options);
99
$form->addElement($page_select);
100
101
$image_tray     = new \XoopsFormElementTray(_AM_ABOUT_PAGE_IMAGE);
102
$image_uploader = new \XoopsFormFile('', 'userfile', 500000);
103
$image_tray->addElement($image_uploader);
104
$pageImage = $pageObj->getVar('page_image');
105
if (!empty($pageImage) && file_exists(XOOPS_ROOT_PATH . '/uploads/' . $xoopsModule->dirname() . '/' . $pageImage)) {
106
    $image_tray->addElement(new \XoopsFormLabel('', '<div style="padding: 8px;"><img src="' . XOOPS_URL . '/uploads/' . $xoopsModule->dirname() . '/' . $pageImage . '"></div>'));
107
    $delete_check = new \XoopsFormCheckBox('', 'delete_image');
108
    $delete_check->addOption(1, _DELETE);
109
    $image_tray->addElement($delete_check);
110
}
111
$form->addElement($image_tray);
112
$form->addElement(new \XoopsFormRadioYN(_AM_ABOUT_PAGE_LINK_BLANK, 'page_blank', $page_blank));
113
$form->addElement(new \XoopsFormRadioYN(_AM_ABOUT_PAGE_STATUS, 'page_status', $list_status, $yes = _AM_ABOUT_PAGE_SUB, $no = _AM_ABOUT_PAGE_DRAFT));
114
115
$form->addElement(new \XoopsFormHidden('id', $pageObj->getVar('page_id')));
116
$form->addElement(new \XoopsFormHidden('page_type', $pageType));
117
$form->addElement(new \XoopsFormHidden('op', 'save'));
118
//$form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
119
$form->addElement(new \XoopsFormButtonTray('submit', _SUBMIT, 'submit'));
120
121
return $form;
122