Issues (311)

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.

calendar.php (4 issues)

1
<?php declare(strict_types=1);
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
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
13
/**
14
 * wgEvents module for xoops
15
 *
16
 * @copyright      2020 XOOPS Project (https://xooops.org)
17
 * @license        GPL 2.0 or later
18
 * @package        wgevents
19
 * @author         wedega - Email:<[email protected]> - Website:<https://xoops.wedega.com>
20
 */
21
22
use Xmf\Request;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Request. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
23
use XoopsModules\Wgevents\ {
24
    Constants,
25
    SimpleCalendar
26
};
27
28
require __DIR__ . '/header.php';
29
$GLOBALS['xoopsOption']['template_main'] = 'wgevents_calendar.tpl';
30
require_once \XOOPS_ROOT_PATH . '/header.php';
31
32
if (!$permissionsHandler->getPermEventsView()) {
33
    \redirect_header('index.php?op=list', 3, \_NOPERM);
34
}
35
36
//request
37
$op            = Request::getCmd('op', 'list');
38
$filterFrom    = Request::getInt('filterFrom');
39
$filterTo      = Request::getInt('filterTo');
40
41
if (Request::hasVar('gotoMonth')) {
42
    $month   = Request::getInt('gotoMonth');
43
    $year    = Request::getInt('gotoYear');
44
} else {
45
    //default params
46
    $year     = (int)\date('Y');
47
    $month    = (int)\date('n');
48
}
49
$lastday  = (int)\date('t', \strtotime($month . '/1/' . $year));
50
$dayStart = \mktime(0, 0, 0, $month, 1, $year);
51
$dayEnd   = \mktime(23, 59, 59, $month, $lastday, $year);
52
53
//$filterCat     = Request::getInt('filterCat');
54
$filterSort    = 'datefrom-ASC';
55
if (0 === $filterFrom || Request::hasVar('gotoMonth')) {
56
    $filterFrom = (int)$dayStart;
57
    $filterTo   = (int)$dayEnd;
58
}
59
60
$filterFromPrevM = \mktime(0, 0, 0, (int)\date('n', $filterFrom - 1), 1, (int)\date('Y', $filterFrom - 1));
61
$filterToPrevM = $filterFrom - 1;
62
$filterFromNextM = $filterTo + 1;
63
$filterToNextM =  \mktime(23, 59, 59, (int)\date('n', $filterFromNextM), (int)\date('t', $filterFromNextM), (int)\date('Y', $filterFromNextM));
64
$filterFromPrevY = \mktime(0, 0, 0, (int)\date('n', $filterFrom), 1, (int)\date('Y', $filterFrom) - 1);
65
$filterToPrevY = \mktime(23, 59, 59, (int)\date('n', $filterTo), (int)\date('t', $filterTo), (int)\date('Y', $filterTo) - 1);
66
$filterFromNextY = \mktime(0, 0, 0, (int)\date('n', $filterFrom), 1, (int)\date('Y', $filterFrom) + 1);
67
$filterToNextY =  \mktime(23, 59, 59, (int)\date('n', $filterTo), (int)\date('t', $filterTo), (int)\date('Y', $filterTo) + 1);
68
69
/*calendar nav bar*/
70
$arrMonth = [
71
    1 => \_MA_WGEVENTS_CAL_JANUARY,
72
    2 => \_MA_WGEVENTS_CAL_FEBRUARY,
73
    3 => \_MA_WGEVENTS_CAL_MARCH,
74
    4 => \_MA_WGEVENTS_CAL_APRIL,
75
    5 => \_MA_WGEVENTS_CAL_MAY,
76
    6 => \_MA_WGEVENTS_CAL_JUNE,
77
    7 => \_MA_WGEVENTS_CAL_JULY,
78
    8 => \_MA_WGEVENTS_CAL_AUGUST,
79
    9 => \_MA_WGEVENTS_CAL_SEPTEMBER,
80
    10 => \_MA_WGEVENTS_CAL_OCTOBER,
81
    11 => \_MA_WGEVENTS_CAL_NOVEMBER,
82
    12 => \_MA_WGEVENTS_CAL_DECEMBER
83
];
84
$GLOBALS['xoopsTpl']->assign('monthNav', $arrMonth[\date('n', $filterFrom)]);
85
$GLOBALS['xoopsTpl']->assign('yearNav', \date('Y', $filterFrom));
86
$GLOBALS['xoopsTpl']->assign('filterFromPrevM', $filterFromPrevM);
87
$GLOBALS['xoopsTpl']->assign('filterToPrevM', $filterToPrevM);
88
$GLOBALS['xoopsTpl']->assign('filterFromNextM', $filterFromNextM);
89
$GLOBALS['xoopsTpl']->assign('filterToNextM', $filterToNextM);
90
$GLOBALS['xoopsTpl']->assign('filterFromPrevY', $filterFromPrevY);
91
$GLOBALS['xoopsTpl']->assign('filterToPrevY', $filterToPrevY);
92
$GLOBALS['xoopsTpl']->assign('filterFromNextY', $filterFromNextY);
93
$GLOBALS['xoopsTpl']->assign('filterToNextY', $filterToNextY);
94
//$otherParams = "op=filter&amp;filterByOwner=$filterByOwner&amp;filterGroup=$filterGroup";
95
//$GLOBALS['xoopsTpl']->assign('otherParams', $otherParams);
96
97
$lengthTitle = 30;
98
99
100
/*
101
if (Constants::FILTERBY_OWN === $filterByOwner) {
102
    $op = 'filterOwn';
103
} else if (Constants::FILTERBY_GROUP === $filterByOwner) {
104
    $op = 'filterGroup';
105
} else {
106
    $op = 'list';
107
}
108
*/
109
110
$op = 'list';
111
[$sortBy, $orderBy] = \explode('-', $filterSort);
112
113
// Define Stylesheet
114
$GLOBALS['xoTheme']->addStylesheet($style, null);
115
// Keywords
116
$keywords = [];
117
// Breadcrumbs
118
$xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_CAL_ITEMS];
119
// Paths
120
$GLOBALS['xoopsTpl']->assign('wgevents_url', \WGEVENTS_URL);
121
$GLOBALS['xoopsTpl']->assign('wgevents_icons_url_16', \WGEVENTS_ICONS_URL . '/16/');
122
123
$GLOBALS['xoTheme']->addStylesheet(\WGEVENTS_URL . '/class/SimpleCalendar/css/SimpleCalendar.css', null);
124
$calendar = new SimpleCalendar\SimpleCalendar();
125
$calendar->setStartOfWeek($helper->getConfig('cal_firstday'));
126
$calendar->setWeekDayNames([
127
    \_MA_WGEVENTS_CAL_MIN_SUNDAY,
128
    \_MA_WGEVENTS_CAL_MIN_MONDAY,
129
    \_MA_WGEVENTS_CAL_MIN_TUESDAY,
130
    \_MA_WGEVENTS_CAL_MIN_WEDNESDAY,
131
    \_MA_WGEVENTS_CAL_MIN_THURSDAY,
132
    \_MA_WGEVENTS_CAL_MIN_FRIDAY,
133
    \_MA_WGEVENTS_CAL_MIN_SATURDAY ]);
134
135
$uid = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0;
136
137
$formSimpleCal = new SimpleCalendar\SimpleCalendarforms();
138
$formFilter = $formSimpleCal->getFormGotoMonth($arrMonth, \date('n', $filterFrom), \date('Y', $filterFrom));
0 ignored issues
show
date('Y', $filterFrom) of type string is incompatible with the type integer expected by parameter $year of XoopsModules\Wgevents\Si...rms::getFormGotoMonth(). ( Ignorable by Annotation )

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

138
$formFilter = $formSimpleCal->getFormGotoMonth($arrMonth, \date('n', $filterFrom), /** @scrutinizer ignore-type */ \date('Y', $filterFrom));
Loading history...
date('n', $filterFrom) of type string is incompatible with the type integer expected by parameter $month of XoopsModules\Wgevents\Si...rms::getFormGotoMonth(). ( Ignorable by Annotation )

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

138
$formFilter = $formSimpleCal->getFormGotoMonth($arrMonth, /** @scrutinizer ignore-type */ \date('n', $filterFrom), \date('Y', $filterFrom));
Loading history...
139
$GLOBALS['xoopsTpl']->assign('formGoto', $formFilter->render());
140
141
/*
142
$filterHandler = new Filterhandler();
143
$filterHandler->filterByOwner = $filterByOwner;
144
$filterHandler->filterGroup = $filterGroup;
145
$filterHandler->filterCat = $filterCat;
146
$filterHandler->filterSort = $filterSort;
147
$filterHandler->showLimit = false;
148
$filterHandler->showSort = false;
149
$filterHandler->showPeriod = false;
150
151
$formFilter = $filterHandler->getFormFilterItems();
152
$GLOBALS['xoopsTpl']->assign('formFilter', $formFilter->render());
153
*/
154
$filtered = false;
155
156
$gmapsEnableCal = false;
157
$gmapsHeight    = false;
158
$useGMaps       = (bool)$helper->getConfig('use_gmaps');
159
if ($useGMaps) {
160
    $gmapsPositionList = (string)$helper->getConfig('gmaps_enablecal');
161
    $gmapsEnableCal    = ('top' === $gmapsPositionList || 'bottom' === $gmapsPositionList);
162
    $gmapsHeight       = $helper->getConfig('gmaps_height');
163
}
164
165
// get categories collection
166
$categories = $categoryHandler->getCollection();
167
// get events of period
168
$eventsArr = $eventHandler->getEvents(0, 0, $filterFrom, $filterTo, $sortBy, $orderBy);
169
170
$eventsCount = $eventsArr['count'];
171
if ($eventsCount > 0) {
172
    $eventsAll = $eventsArr['eventsAll'];
173
    $eventsMap = [];
174
    $calendar->setDate($filterFrom);
175
    $GLOBALS['xoopsTpl']->assign('eventsCount', $eventsCount);
176
    foreach (\array_keys($eventsAll) as $i) {
177
        $event = $eventsAll[$i]->getValuesEvents();
178
        $linkStyle = 'color:' . $categories[$event['catid']]['color'] . '!important;';
179
        $linkStyle .= 'border:1px solid ' . $categories[$event['catid']]['bordercolor'] . '!important;';
180
        $linkStyle .= 'background-color:' . $categories[$event['catid']]['bgcolor'] . '!important;';
181
        $linkStyle .= $categories[$event['catid']]['othercss'];
182
        $evTitle = \_MA_WGEVENTS_EVENT_NAME . ': ' . $event['name'] . PHP_EOL;
183
        $evTitle .= \_MA_WGEVENTS_EVENT_DATE . ': ' . $eventHandler->getDateFromToText($event['datefrom'], $event['dateto'], $event['allday']) . PHP_EOL;
184
        if ($event['location']) {
185
            $evTitle .= \_MA_WGEVENTS_EVENT_LOCATION . ': ' .$event['location'] . PHP_EOL;
186
        }
187
        $eventLink = '<a href="event.php?op=show&amp;id=' . $event['id'] .'" title="' . $evTitle .'">';
188
        /*
189
        if ($event['catlogo']) {
190
            $eventLink .= '<img class="wg-cal-catlogo" src="' . \WGEVENTS_UPLOAD_CATLOGOS_URL . '/' . $event['catlogo'] .'" alt="' . \_MA_WGEVENTS_CATEGORY_LOGO .'" title="' . \_MA_WGEVENTS_CATEGORY_LOGO .'">';
191
        }
192
        */
193
        $eventLink .= '<span class="wg-cal-eventtext">';
194
        $evName = $event['name'];
195
        if (\strlen($evName) > $lengthTitle) {
196
            $evName = \substr($evName, 0, $lengthTitle - 3) . '...';
197
        }
198
        $eventLink .= $evName;
199
        if ($useGMaps && $gmapsEnableCal && (float)$event['locgmlat'] > 0) {
200
            $eventsMap[$event['id']] = [
201
                'name' => $evName,
202
                'location' => $event['location_text_user'],
203
                'from' => $event['datefrom_text'],
204
                'url' => 'event.php?op=show&id=' . $event['id'],
205
                'lat'  => (float)$event['locgmlat'],
206
                'lon'  => (float)$event['locgmlon']
207
            ];
208
        }
209
        
210
        $eventLink .= '</span><i class="fa fa-edit wg-cal-icon pull-right" title="' . \_MA_WGEVENTS_CAL_EDITITEM . '"></i></a>';
211
        $calendar->addDailyHtml($eventLink, $event['datefrom'], $event['dateto'], $linkStyle);
212
    }
213
    if ($useGMaps && count($eventsMap) > 0) {
214
        if ('show' === $op) {
0 ignored issues
show
The condition 'show' === $op is always false.
Loading history...
215
            $GLOBALS['xoopsTpl']->assign('gmapsShow', true);
216
        } else {
217
            $GLOBALS['xoopsTpl']->assign('gmapsShowList', true);
218
            $GLOBALS['xoopsTpl']->assign('gmapsEnableCal', $gmapsEnableCal);
219
            $GLOBALS['xoopsTpl']->assign('gmapsHeight', $gmapsHeight);
220
            $GLOBALS['xoopsTpl']->assign('gmapsPositionList', $gmapsPositionList);
221
        }
222
        $GLOBALS['xoopsTpl']->assign('api_key', $helper->getConfig('gmaps_api'));
223
        $GLOBALS['xoopsTpl']->assign('eventsMap', $eventsMap);
224
    }
225
}
226
$calendar->setPermSubmit($permissionsHandler->getPermEventsSubmit());
227
$GLOBALS['xoopsTpl']->assign('events_calendar', $calendar->render());
228
229
// Keywords
230
wgeventsMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords));
231
unset($keywords);
232
// Description
233
wgeventsMetaDescription(\_MA_WGEVENTS_INDEX_DESC);
234
$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', \WGEVENTS_URL.'/index.php');
235
236
require __DIR__ . '/footer.php';
237