This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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
Unused Code
introduced
by
![]() |
|||||
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
|
|||||
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
![]() |
|||||
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
|
|||||
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 . " \n"; |
||||
134 | $form .= '<input name="options[0]" size="5" maxlength="255" value="' . $options[0] . '" type="text"> ' . _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 |