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.

view_calendar-month.php (6 issues)

Labels
1
<?php
2
3
use XoopsModules\Extcal\{Helper,
4
    Utility,
5
    CategoryHandler,
6
    EventHandler,
7
    Time
8
};
9
use Xmf\Request;
10
11
require_once __DIR__ . '/include/constantes.php';
12
$params                                  = ['view' => _EXTCAL_NAV_CALMONTH, 'file' => _EXTCAL_FILE_CALMONTH];
13
$GLOBALS['xoopsOption']['template_main'] = "extcal_view_{$params['view']}.tpl";
14
require_once __DIR__ . '/header.php';
15
16
global $xoopsUser, $xoopsTpl;
17
18
/** @var Time $timeHandler */
19
/** @var CategoryHandler $categoryHandler */
20
/** @var EventHandler $eventHandler */
21
/** @var Helper $helper */
22
$helper = Helper::getInstance();
23
24
/* ========================================================================== */
25
$year  = \Xmf\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

25
$year  = \Xmf\Request::getInt('year', /** @scrutinizer ignore-type */ date('Y'), 'GET');
Loading history...
26
$month = \Xmf\Request::getInt('month', date('n'), 'GET');
27
$cat   = \Xmf\Request::getInt('cat', 0, 'GET');
28
/* ========================================================================== */
29
30
$form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get');
31
$form->addElement(getListYears($year, $helper->getConfig('agenda_nb_years_before'), $helper->getConfig('agenda_nb_years_after')));
32
$form->addElement(getListMonths($month));
33
$form->addElement(Utility::getListCategories($cat));
34
$form->addElement(new \XoopsFormButton('', 'form_submit', _SUBMIT, 'submit'));
35
36
// Assigning the form to the template
37
$form->assign($xoopsTpl);
38
39
/**********************************************************************/
40
// Retriving events and formatting them
41
// $events = $eventHandler->objectToArray($eventHandler->getEventCalendarMonth($month, $year, $cat), array('cat_id'));
42
$criteres = [
43
    'periode'      => _EXTCAL_EVENTS_CALENDAR_MONTH,
44
    'month'        => $month,
45
    'year'         => $year,
46
    'cat'          => $cat,
47
    'externalKeys' => 'cat_id',
48
];
49
$events   = $eventHandler->getEventsOnPeriode($criteres);
50
/**********************************************************************/
51
52
// Calculating timestamp for the begin and the end of the month
53
$startMonth = mktime(0, 0, 0, $month, 1, $year);
54
$endMonth   = mktime(23, 59, 59, $month + 1, 0, $year);
55
56
/*
57
*  Adding all event occuring during this month to an array indexed by day number
58
*/
59
$eventsArray = [];
60
foreach ($events as $event) {
61
    $eventHandler->formatEventDate($event, $helper->getConfig('event_date_month'));
62
    $eventHandler->addEventToCalArray($event, $eventsArray, $startMonth, $endMonth);
63
    //     if (!$event['event_isrecur']) {
64
    //         // Formating date
65
    //         $eventHandler->formatEventDate($event, $helper->getConfig('event_date_month'));
66
    //         $eventHandler->addEventToCalArray($event, $eventsArray, $startMonth, $endMonth);
67
    //     } else {
68
    //         $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startMonth, $endMonth);
69
    //         // Formating date
70
    //         $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_month'));
71
    //         foreach ($recurEvents as $recurEvent) {
72
    //             $eventHandler->addEventToCalArray($recurEvent, $eventsArray, $startMonth, $endMonth);
73
    //         }
74
    //     }
75
}
76
77
/*
78
*  Making an array to create tabbed output on the template
79
*/
80
// Flag current day
81
$selectedDays = [
82
    new Calendar_Day(date('Y', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser))), date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser))), date('j', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser)))),
0 ignored issues
show
date('j', xoops_getUserT...rTimeZone($xoopsUser))) of type string is incompatible with the type integer expected by parameter $d of Calendar_Day::__construct(). ( Ignorable by Annotation )

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

82
    new Calendar_Day(date('Y', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser))), date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser))), /** @scrutinizer ignore-type */ date('j', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser)))),
Loading history...
date('n', xoops_getUserT...rTimeZone($xoopsUser))) of type string is incompatible with the type integer expected by parameter $m of Calendar_Day::__construct(). ( Ignorable by Annotation )

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

82
    new Calendar_Day(date('Y', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser))), /** @scrutinizer ignore-type */ date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser))), date('j', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser)))),
Loading history...
date('Y', xoops_getUserT...rTimeZone($xoopsUser))) of type string is incompatible with the type integer expected by parameter $y of Calendar_Day::__construct(). ( Ignorable by Annotation )

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

82
    new Calendar_Day(/** @scrutinizer ignore-type */ date('Y', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser))), date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser))), date('j', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($xoopsUser)))),
Loading history...
83
];
84
85
// Build calendar object
86
$monthCalObj  = new Calendar_Month_Weeks($year, $month, $helper->getConfig('week_start_day'));
87
$pMonthCalObj = $monthCalObj->prevMonth('object');
88
$nMonthCalObj = $monthCalObj->nextMonth('object');
89
$monthCalObj->build();
90
91
$tableRows = [];
92
$rowId     = 0;
93
$cellId    = 0;
94
while (false !== ($weekCalObj = $monthCalObj->fetch())) {
95
    $weekCalObj->build($selectedDays);
96
    $tableRows[$rowId]['weekInfo'] = [
97
        'week'  => $weekCalObj->thisWeek('n_in_year'),
98
        'day'   => $weekCalObj->thisDay(),
99
        'month' => $weekCalObj->thisMonth(),
100
        'year'  => $weekCalObj->thisYear(),
101
    ];
102
    while (false !== ($dayCalObj = $weekCalObj->fetch())) {
103
        $tableRows[$rowId]['week'][$cellId] = [
104
            'isEmpty'    => $dayCalObj->isEmpty(),
105
            'number'     => $dayCalObj->thisDay(),
106
            'isSelected' => $dayCalObj->isSelected(),
107
        ];
108
        if (isset($eventsArray[$dayCalObj->thisDay()]) &&
109
            is_array($eventsArray[$dayCalObj->thisDay()]) &&
110
            count($eventsArray[$dayCalObj->thisDay()]) > 0 &&
111
            !$dayCalObj->isEmpty()) {
112
            $tableRows[$rowId]['week'][$cellId]['events'] = $eventsArray[$dayCalObj->thisDay()];
113
        } else {
114
            $tableRows[$rowId]['week'][$cellId]['events'] = '';
115
        }
116
        ++$cellId;
117
    }
118
    $cellId = 0;
119
    ++$rowId;
120
}
121
122
// Assigning events to the template
123
$xoopsTpl->assign('tableRows', $tableRows);
124
125
// Retriving categories
126
$cats = $categoryHandler->objectToArray($categoryHandler->getAllCat($xoopsUser));
127
// Assigning categories to the template
128
$xoopsTpl->assign('cats', $cats);
129
130
// Retriving weekdayNames
131
//$weekdayNames = Calendar_Util_Textual::weekdayNames();
132
//$weekdayNames = array('Dimanche','Mardi','Mercresi','Jeudi','Vendredi','Samedi');
133
$weekdayNames = [_CAL_SUNDAY, _CAL_MONDAY, _CAL_TUESDAY, _CAL_WEDNESDAY, _CAL_THURSDAY, _CAL_FRIDAY, _CAL_SATURDAY];
134
135
for ($i = 0; $i < $helper->getConfig('week_start_day'); ++$i) {
136
    $weekdayName    = array_shift($weekdayNames);
137
    $weekdayNames[] = $weekdayName;
138
}
139
// Assigning weekdayNames to the template
140
$xoopsTpl->assign('weekdayNames', $weekdayNames);
141
142
// Retriving monthNames
143
$monthNames = Calendar_Util_Textual::monthNames();
144
145
// Making navig data
146
$navig = [
147
    'prev' => [
148
        'uri'  => 'year=' . $pMonthCalObj->thisYear() . '&amp;month=' . $pMonthCalObj->thisMonth(),
0 ignored issues
show
The method thisYear() does not exist on integer. ( Ignorable by Annotation )

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

148
        'uri'  => 'year=' . $pMonthCalObj->/** @scrutinizer ignore-call */ thisYear() . '&amp;month=' . $pMonthCalObj->thisMonth(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
149
        'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $pMonthCalObj->getTimestamp()),
150
    ],
151
    'this' => [
152
        'uri'  => 'year=' . $monthCalObj->thisYear() . '&amp;month=' . $monthCalObj->thisMonth(),
153
        'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $monthCalObj->getTimestamp()),
154
    ],
155
    'next' => [
156
        'uri'  => 'year=' . $nMonthCalObj->thisYear() . '&amp;month=' . $nMonthCalObj->thisMonth(),
0 ignored issues
show
The method thisYear() does not exist on integer. ( Ignorable by Annotation )

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

156
        'uri'  => 'year=' . $nMonthCalObj->/** @scrutinizer ignore-call */ thisYear() . '&amp;month=' . $nMonthCalObj->thisMonth(),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
157
        'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $nMonthCalObj->getTimestamp()),
158
    ],
159
];
160
161
// Title of the page
162
$xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . $navig['this']['name']);
163
164
// Assigning navig data to the template
165
$xoopsTpl->assign('navig', $navig);
166
167
//Display tooltip
168
$xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle'));
169
$xoopsTpl->assign('showId', $helper->getConfig('showId'));
170
171
// Assigning current form navig data to the template
172
$xoopsTpl->assign('selectedCat', $cat);
173
$xoopsTpl->assign('year', $year);
174
$xoopsTpl->assign('month', $month);
175
$xoopsTpl->assign('params', $params);
176
177
$tNavBar = getNavBarTabs($params['view']);
178
$xoopsTpl->assign('tNavBar', $tNavBar);
179
$xoopsTpl->assign('list_position', $helper->getConfig('list_position'));
180
// echoArray($tNavBar,true);
181
182
//mb missing for xBootstrap templates by Angelo
183
$lang = [
184
    'start'      => _MD_EXTCAL_START,
185
    'end'        => _MD_EXTCAL_END,
186
    'calmonth'   => _MD_EXTCAL_NAV_CALMONTH,
187
    'calweek'    => _MD_EXTCAL_NAV_CALWEEK,
188
    'year'       => _MD_EXTCAL_NAV_YEAR,
189
    'month'      => _MD_EXTCAL_NAV_MONTH,
190
    'week'       => _MD_EXTCAL_NAV_WEEK,
191
    'day'        => _MD_EXTCAL_NAV_DAY,
192
    'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK,
193
    'agendaday'  => _MD_EXTCAL_NAV_AGENDA_DAY,
194
    'search'     => _MD_EXTCAL_NAV_SEARCH,
195
    'newevent'   => _MD_EXTCAL_NAV_NEW_EVENT,
196
];
197
198
// Assigning language data to the template
199
$xoopsTpl->assign('lang', $lang);
200
$xoopsTpl->assign('view', 'calmonth');
201
202
require_once XOOPS_ROOT_PATH . '/footer.php';
203