Issues (733)

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.

blocks/upcoming.php (4 issues)

1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright    {@link https://xoops.org/ XOOPS Project}
14
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package      extcal
16
 * @since
17
 * @author       XOOPS Development Team,
18
 */
19
20
use XoopsModules\Extcal\{Helper,
21
    EventHandler,
22
    CategoryHandler
23
};
24
use Xmf\Request;
25
26
require_once dirname(__DIR__) . '/include/constantes.php';
27
28
/**
29
 * @param $options
30
 *
31
 * @return array|bool
32
 */
33
function bExtcalUpcomingShow($options)
34
{
35
    /** @var Helper $helper */
36
    if (!class_exists(Helper::class)) {
37
        return false;
38
    }
39
40
    $helper = Helper::getInstance();
41
    $helper->loadLanguage('main');
42
    $helper->loadLanguage('blocks');
43
    /** @var EventHandler $eventHandler */
44
    $eventHandler = $helper->getHandler(_EXTCAL_CLN_EVENT);
45
46
    $nbEvent     = $options[0];
47
    $titleLenght = $options[1];
0 ignored issues
show
The assignment to $titleLenght is dead and can be removed.
Loading history...
48
    $nbDays      = $options[2];
49
50
    array_shift($options);
51
    array_shift($options);
52
    array_shift($options);
53
54
    // Checking if no cat is selected
55
    if (isset($options[0]) && 0 == $options[0] && 1 == count($options)) {
56
        $options = 0;
0 ignored issues
show
The assignment to $options is dead and can be removed.
Loading history...
57
    }
58
59
    //-------------------
60
    /* ========================================================================== */
61
    $year  = Request::getInt('year', date('Y'), 'GET');
0 ignored issues
show
date('Y') of type string is incompatible with the type integer expected by parameter $default of Xmf\Request::getInt(). ( Ignorable by Annotation )

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

61
    $year  = Request::getInt('year', /** @scrutinizer ignore-type */ date('Y'), 'GET');
Loading history...
62
    $month = Request::getInt('month', date('n'), 'GET');
63
    $day   = Request::getInt('day', date('j'), 'GET');
64
    $cat   = Request::getInt('cat', 0, 'GET');
65
    /* ========================================================================== */
66
67
    // Validate the date (day, month and year)
68
    $dayTS = mktime(0, 0, 0, $month, $day, $year);
69
70
    //$offset = $helper->getConfig('week_start_day') - date('w', $dayTS);
71
72
    //------- mb --------------
73
    //   let's make sure that the upcoming events start tomorrow
74
    //    $offset = date('w', $dayTS) + 7-$helper->getConfig('week_start_day')<7 ? date('w', $dayTS) + 7-$helper->getConfig('week_start_day') : 0;
75
    //    $dayTS = $dayTS - ($offset * _EXTCAL_TS_DAY);
76
77
    $dayTS += _EXTCAL_TS_DAY;
78
    //------- mb -----------------
79
80
    $year  = date('Y', $dayTS);
81
    $month = date('n', $dayTS);
82
    $day   = date('j', $dayTS);
83
84
    // Retriving events and formatting them
85
    //$events = $eventHandler->objectToArray($eventHandler->getEventWeek($day, $month, $year, $cat), array('cat_id'));
86
    $criteres = [
87
        'periode'      => _EXTCAL_EVENTS_UPCOMING,
88
        //        'periode'      => _EXTCAL_EVENTS_CALENDAR_WEEK,
89
        'day'          => $day,
90
        'month'        => $month,
91
        'year'         => $year,
92
        'cat'          => $cat,
93
        'externalKeys' => 'cat_id',
94
        'nbEvent'      => $nbEvent,
95
        'nbDays'       => $nbDays,
96
    ];
97
    $events   = $eventHandler->getEventsOnPeriode($criteres);
98
99
    //----------------------------
100
101
    //$eventHandler->serverTimeToUserTimes($events);
102
    $eventHandler->formatEventsDate($events, $helper->getConfig('event_date_month'));
103
104
    if (count($events) > $nbEvent) {
105
        $events = array_slice($events, 0, $nbEvent);
106
    }
107
108
    return $events;
109
}
110
111
/**
112
 * @param $options
113
 *
114
 * @return string
115
 */
116
function bExtcalUpcomingEdit($options)
117
{
118
    global $xoopsUser;
119
120
    /** @var Helper $helper */
121
    if (!class_exists(Helper::class)) {
122
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the documented return type string.
Loading history...
123
    }
124
125
    $helper = Helper::getInstance();
126
    $helper->loadLanguage('main');
127
    $helper->loadLanguage('blocks');
128
    /** @var CategoryHandler $categoryHandler */
129
    $categoryHandler = $helper->getHandler(_EXTCAL_CLN_CAT);
130
131
    $cats = $categoryHandler->getAllCat($xoopsUser, 'extcal_cat_view');
132
133
    $form = _MB_EXTCAL_DISPLAY . "&nbsp;\n";
134
    $form .= '<input name="options[0]" size="5" maxlength="255" value="' . $options[0] . '" type="text">&nbsp;' . _MB_EXTCAL_EVENT . '<br>';
135
    $form .= _MB_EXTCAL_TITLE_LENGTH . ' : <input name="options[1]" size="5" maxlength="255" value="' . $options[1] . '" type="text"><br>';
136
137
    $form .= _MB_EXTCAL_UPCOMING_DAYS . ' : <input name="options[2]" size="5" maxlength="255" value="' . $options[2] . '" type="text"><br>';
138
139
    array_shift($options);
140
    array_shift($options);
141
    array_shift($options);
142
143
    $form .= _MB_EXTCAL_CAT_TO_USE . '<br><select name="options[]" multiple="multiple" size="5">';
144
    if (false === array_search(0, $options, true)) {
145
        $form .= '<option value="0">' . _MB_EXTCAL_ALL_CAT . '</option>';
146
    } else {
147
        $form .= '<option value="0" selected="selected">' . _MB_EXTCAL_ALL_CAT . '</option>';
148
    }
149
    foreach ($cats as $cat) {
150
        if (false === array_search($cat->getVar('cat_id'), $options, true)) {
151
            $form .= '<option value="' . $cat->getVar('cat_id') . '">' . $cat->getVar('cat_name') . '</option>';
152
        } else {
153
            $form .= '<option value="' . $cat->getVar('cat_id') . '" selected="selected">' . $cat->getVar('cat_name') . '</option>';
154
        }
155
    }
156
    $form .= '</select>';
157
158
    return $form;
159
}
160