Issues (371)

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/FormDateTimePicker.php (4 issues)

1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Xoopspoll;
4
5
/**
6
 * Xoopspoll form timepicker
7
 *
8
 * You may not change or alter any portion of this comment or credits
9
 * of supporting developers from this source code or any supporting source code
10
 * which is considered copyrighted (c) material of the original comment or credit authors.
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 *
15
 * @copyright ::   &copy; {@link https://xoops.org/ XOOPS Project}
16
 * @license   ::     {@link https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL 2}
17
 * @subpackage::  class
18
 * @since     ::       1.40
19
 * @author    ::      TXMod Xoops (aka timgno) {@link https://www.txmodxoops.org/ TXMod Xoops}
20
 * @author    ::      zyspec <[email protected]>
21
 * @credits::     {@link https://www.trentrichardson.com Trent Richardson}
22
 */
23
24
/**
25
 * Creates a text field with jquery ui calendar & time select popup
26
 */
27
class FormDateTimePicker extends \XoopsFormText
28
{
29
    /**
30
     * Contains the maximum field size
31
     */
32
    public const MAXSIZE = 25;
33
34
    /**
35
     * Constructor to build FormDateTimePicker object
36
     * @param mixed $caption HTML description to display for the element
37
     * @param mixed $name    HTML element name (ie. name='$name')
38
     * @param mixed $size    size of field to display
39
     * @param mixed $value   timestamp of date/time to show
40
     */
41
    public function __construct($caption, $name, $size, $value)
42
    {
43
        $value = (!\is_numeric($value) || (0 === (int)$value)) ? \time($value) : (int)$value;
0 ignored issues
show
The call to time() has too many arguments starting with $value. ( Ignorable by Annotation )

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

43
        $value = (!\is_numeric($value) || (0 === (int)$value)) ? /** @scrutinizer ignore-call */ \time($value) : (int)$value;

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
44
        $size  = (int)$size;
45
        $size  = ($size > 0 && $size <= self::MAXSIZE) ? $size : self::MAXSIZE;
46
        parent::__construct($caption, $name, $size, self::MAXSIZE, $value);
47
    }
48
49
    /**
50
     * Generate the HTML <input> to display the date/time field
51
     * @return string HTML code used to display in a form
52
     */
53
    public function render(): string
54
    {
55
        static $included = false;
56
57
        $ele_name  = $this->getName();
58
        $ele_value = $this->getValue(true);
59
        //        if (is_string($ele_value)) {
60
        if (\is_numeric($ele_value)) {
61
            //            $display_value = '';
62
            //            $display_value = formatTimestamp($ele_value, 'm');
63
            $display_value = \ucfirst(\date(_MEDIUMDATESTRING, (int)$ele_value));
64
        } else {
65
            $display_value = $ele_value;
66
            $ele_value     = \time();
0 ignored issues
show
The assignment to $ele_value is dead and can be removed.
Loading history...
67
        }
68
69
        if (\is_object($GLOBALS['xoTheme'])) {
70
            $moduleHandler = \xoops_getHandler('module');
71
            $sys_module    = $moduleHandler->getByDirname('system');
0 ignored issues
show
The method getByDirname() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsModuleHandler 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

71
            /** @scrutinizer ignore-call */ 
72
            $sys_module    = $moduleHandler->getByDirname('system');
Loading history...
72
            $configHandler = \xoops_getHandler('config');
73
            $moduleConfig  = $configHandler->getConfigsByCat(0, $sys_module->getVar('mid'));
0 ignored issues
show
The method getConfigsByCat() 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

73
            /** @scrutinizer ignore-call */ 
74
            $moduleConfig  = $configHandler->getConfigsByCat(0, $sys_module->getVar('mid'));
Loading history...
74
            $jq_theme_dir  = $moduleConfig['jquery_theme'];
75
76
            $GLOBALS['xoTheme']->addStylesheet($GLOBALS['xoops']->url("modules/system/css/ui/{$jq_theme_dir}/ui.all.css"));
77
            $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
78
            $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
79
            $GLOBALS['xoTheme']->addScript('browse.php?modules/xoopspoll/assets/js/jquery-ui-timepicker-addon.js');
80
            $GLOBALS['xoTheme']->addScript('browse.php?modules/xoopspoll/assets/js/jquery-ui-sliderAccess.js');
81
            $GLOBALS['xoTheme']->addStylesheet($GLOBALS['xoops']->url('modules/xoopspoll/assets/css/datetimepicker.css'));
82
83
            if (!$included) {
84
                $included = true;
85
                \xoops_loadLanguage('admin', 'xoopspoll');
86
                // setup regional date variables
87
                $reg_values = "closeText: '"
88
                              . \_AM_XOOPSPOLL_DTP_CLOSETEXT
89
                              . "',"
90
                              . "prevText: '"
91
                              . \_AM_XOOPSPOLL_DTP_PREVTEXT
92
                              . "',"
93
                              . "nextText: '"
94
                              . \_AM_XOOPSPOLL_DTP_NEXTTEXT
95
                              . "',"
96
                              . "currentText: '"
97
                              . \_AM_XOOPSPOLL_DTP_CURRENTTEXT
98
                              . "',"
99
                              . 'monthNames: ['
100
                              . \_AM_XOOPSPOLL_DTP_MONTHNAMES
101
                              . '],'
102
                              . 'monthNamesShort: ['
103
                              . \_AM_XOOPSPOLL_DTP_MONTHNAMESSHORT
104
                              . '],'
105
                              . 'dayNames: ['
106
                              . \_AM_XOOPSPOLL_DTP_DAYNAMES
107
                              . '],'
108
                              . 'dayNamesShort: ['
109
                              . \_AM_XOOPSPOLL_DTP_DAYNAMESSHORT
110
                              . '],'
111
                              . 'dayNamesMin: ['
112
                              . \_AM_XOOPSPOLL_DTP_DAYNAMESMIN
113
                              . '],'
114
                              . "weekHeader: '"
115
                              . \_AM_XOOPSPOLL_DTP_WEEKHEADER
116
                              . "',"
117
                              . "dateFormat: '"
118
                              . \_AM_XOOPSPOLL_DTP_DATEFORMAT
119
                              . "',"
120
                              . "firstDay: '"
121
                              . \_AM_XOOPSPOLL_DTP_FIRSTDAY
122
                              . "',"
123
                              . 'isRTL: '
124
                              . \_AM_XOOPSPOLL_DTP_ISRTL
125
                              . ','
126
                              . 'showMonthAfterYear: '
127
                              . \_AM_XOOPSPOLL_DTP_SHOWMONTHAFTERYEAR
128
                              . ','
129
                              . "yearSuffix: '"
130
                              . \_AM_XOOPSPOLL_DTP_YEARSUFFIX
131
                              . "',";
132
                // set regional time variables
133
                $reg_values .= "timeOnlyTitle: '"
134
                               . \_AM_XOOPSPOLL_DTP_TIMEONLYTITLE
135
                               . "',"
136
                               . "timeText: '"
137
                               . \_AM_XOOPSPOLL_DTP_TIMETEXT
138
                               . "',"
139
                               . "hourText: '"
140
                               . \_AM_XOOPSPOLL_DTP_HOURTEXT
141
                               . "',"
142
                               . "minuteText: '"
143
                               . \_AM_XOOPSPOLL_DTP_MINUTETEXT
144
                               . "',"
145
                               . "secondText: '"
146
                               . \_AM_XOOPSPOLL_DTP_SECONDTEXT
147
                               . "',"
148
                               . "millisecText: '"
149
                               . \_AM_XOOPSPOLL_DTP_MILLISECTEXT
150
                               . "',"
151
                               . "timeFormat: '"
152
                               . \_AM_XOOPSPOLL_DTP_TIMEFORMAT
153
                               . "',"
154
                               . 'ampm: false,'
155
                               . 'stepMinute: 5';
156
157
                $GLOBALS['xoTheme']->addScript(
158
                    '',
159
                    '',
160
                    '
161
                  $(function() {
162
                      $( ".datetimepicker" ).datetimepicker({
163
                          ' . $reg_values . '
164
                      });
165
                  });
166
        '
167
                );
168
            }
169
        }
170
171
        return "<input type='text' name='{$ele_name}' id='{$ele_name}' class='datetimepicker' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='{$display_value}'" . $this->getExtra() . '>';
172
    }
173
}
174