Issues (1844)

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.

assets/js/calendar/calendar.php (1 issue)

1
<?php declare(strict_types=1);
2
3
/**
4
 * File: calendar.php | (c) dynarch.com 2004
5
 *                         Distributed as part of "The Coolest DHTML Calendar"
6
 *                         under the same terms.
7
 *                         -----------------------------------------------------------------
8
 *                         This file implements a simple PHP wrapper for the calendar.  It
9
 *                         allows you to easily include all the calendar files and setup the
10
 *                         calendar by instantiating and calling a PHP object.
11
 */
12
define('NEWLINE', "\n");
13
14
/**
15
 * DHTML_Calendar
16
 *
17
 * @author    John
18
 * @copyright Copyright (c) 2009
19
 */
20
class calendar
21
{
22
    public $calendar_lib_path;
23
    public $calendar_file;
24
    public $calendar_lang_file;
25
    public $calendar_setup_file;
26
    public $calendar_theme_file;
27
    public $calendar_options;
28
29
    /**
30
     * DHTML_Calendar::DHTML_Calendar()
31
     *
32
     * @param string $calendar_lib_path
33
     * @param string $lang
34
     * @param string $theme
35
     * @param mixed  $stripped
36
     * @param array  $calendar_options
37
     * @param array  $calendar_field_attributes
38
     */
39
    public function __construct(
40
        string $calendar_lib_path = '',
41
        string $lang = 'en',
42
        string $theme = 'calendar-win2k-1',
43
        $stripped = false,
44
        array $calendar_options = [],
45
        array $calendar_field_attributes = []
46
    ) {
47
        $this->set_option('date', '');
48
        $this->set_option('ifFormat', '%m/%d/%Y %H:%M');
49
        $this->set_option('daFormat', '%m/%d/%Y %H:%M');
50
        $this->set_option('firstDay', 1); // show Monday first
51
        $this->set_option('showOthers', true);
52
53
        if ($stripped) {
54
            $this->calendar_file       = 'calendar_stripped.js';
55
            $this->calendar_setup_file = 'calendar-setup_stripped.js';
56
        } else {
57
            $this->calendar_file       = 'calendar.js';
58
            $this->calendar_setup_file = 'calendar-setup.js';
59
        }
60
61
        $lang                      = file_exists(XOOPS_ROOT_PATH . 'modules/xhelp/assets/js/calendar/lang/calendar-' . _LANGCODE . '.js') ? _LANGCODE : 'en';
62
        $this->calendar_lang_file  = 'lang/calendar-' . $lang . '.js';
63
        $this->calendar_lib_path   = '/modules/xhelp/assets/js/calendar/';
64
        $this->calendar_theme_file = 'calendar-blue.css';
65
        $this->calendar_theme_url  = 'modules/xhelp/assets/js/calendar/css/';
0 ignored issues
show
Bug Best Practice introduced by
The property calendar_theme_url does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
66
    }
67
68
    /**
69
     * @param $name
70
     * @param $value
71
     */
72
    public function set_option($name, $value)
73
    {
74
        $this->calendar_options[$name] = $value;
75
    }
76
77
    /**
78
     * DHTML_Calendar::load_files()
79
     */
80
    public function load_files()
81
    {
82
        $this->get_load_files_code();
83
    }
84
85
    /**
86
     * DHTML_Calendar::get_load_files_code()
87
     */
88
    public function get_load_files_code()
89
    {
90
        if (isset($GLOBALS['xo_Theme'])) {
91
            $GLOBALS['xo_Theme']->addStylesheet($this->calendar_theme_url . $this->calendar_theme_file);
92
            $GLOBALS['xo_Theme']->addScript($this->calendar_lib_path . $this->calendar_file);
93
            $GLOBALS['xo_Theme']->addScript($this->calendar_lib_path . $this->calendar_lang_file);
94
            $GLOBALS['xo_Theme']->addScript($this->calendar_lib_path . $this->calendar_setup_file);
95
        } else {
96
            $ret = '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/' . $this->calendar_theme_url . $this->calendar_theme_file . '">';
97
            $ret .= '<script type="text/javascript" src="' . XOOPS_URL . '/' . $this->calendar_lib_path . $this->calendar_file . '"></script>';
98
            $ret .= '<script type="text/javascript" src="' . XOOPS_URL . '/' . $this->calendar_lib_path . $this->calendar_lang_file . '"></script>';
99
            $ret .= '<script type="text/javascript" src="' . XOOPS_URL . '/' . $this->calendar_lib_path . $this->calendar_setup_file . '"></script>';
100
            echo $ret;
101
        }
102
    }
103
104
    /**
105
     * DHTML_Calendar::_make_calendar()
106
     *
107
     * @param array $other_options
108
     * @return string
109
     */
110
    public function _make_calendar(array $other_options = []): string
111
    {
112
        $js_options = $this->_make_js_hash(array_merge($this->calendar_options, $other_options));
113
        $code       = ('<script type="text/javascript">Calendar.setup({' . $js_options . '});</script>');
114
115
        return $code;
116
    }
117
118
    /**
119
     * DHTML_Calendar::make_input_field()
120
     *
121
     * @param array $cal_options
122
     * @param array $field_attributes
123
     * @param mixed $show
124
     * @return string
125
     */
126
    public function make_input_field(array $cal_options = [], array $field_attributes = [], $show = true): string
127
    {
128
        $id      = $this->_gen_id();
129
        $attrstr = $this->_make_html_attr(array_merge($field_attributes, ['id' => $this->_field_id($id), 'type' => 'text']));
130
        $data    = '<input ' . $attrstr . '>';
131
        $data    .= '<a href="#" id="' . $this->_trigger_id($id) . '">' . '&nbsp;<img src="' . XOOPS_URL . '/' . $this->calendar_lib_path . 'img.png" style="vertical-align: middle; border: 0px;" alt=""></a>&nbsp;';
132
        $options = array_merge(
133
            $cal_options,
134
            [
135
                'inputField' => $this->_field_id($id),
136
                'button'     => $this->_trigger_id($id),
137
            ]
138
        );
139
        $data    .= $this->_make_calendar($options);
140
        if ($show) {
141
            echo $data;
142
143
            return '';
144
        }
145
146
        return $data;
147
    }
148
149
    // / PRIVATE SECTION
150
151
    /**
152
     * @param $id
153
     * @return string
154
     */
155
    public function _field_id($id): string
156
    {
157
        return 'f-calendar-field-' . $id;
158
    }
159
160
    /**
161
     * @param $id
162
     * @return string
163
     */
164
    public function _trigger_id($id): string
165
    {
166
        return 'f-calendar-trigger-' . $id;
167
    }
168
169
    /**
170
     * @return int
171
     */
172
    public function _gen_id(): int
173
    {
174
        static $id = 0;
175
176
        return ++$id;
177
    }
178
179
    /**
180
     * @param $array
181
     * @return string
182
     */
183
    public function _make_js_hash($array): string
184
    {
185
        $jstr = '';
186
        //        reset($array);
187
        //        while (list($key, $val) = each($array)) {
188
        foreach ($array as $key => $val) {
189
            if (is_bool($val)) {
190
                $val = $val ? 'true' : 'false';
191
            } elseif (!is_numeric($val)) {
192
                $val = '"' . $val . '"';
193
            }
194
            if ($jstr) {
195
                $jstr .= ',';
196
            }
197
            $jstr .= '"' . $key . '":' . $val;
198
        }
199
200
        return $jstr;
201
    }
202
203
    /**
204
     * @param $array
205
     * @return string
206
     */
207
    public function _make_html_attr($array): string
208
    {
209
        $attrstr = '';
210
        //        reset($array);
211
        //        while (list($key, $val) = each($array)) {
212
        foreach ($array as $key => $val) {
213
            $attrstr .= $key . '="' . $val . '" ';
214
        }
215
216
        return $attrstr;
217
    }
218
}
219