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 | use Xmf\Request; |
||||||||
4 | use XoopsModules\Extcal\{Helper, |
||||||||
5 | Utility, |
||||||||
6 | CategoryHandler, |
||||||||
7 | EventHandler, |
||||||||
8 | Time |
||||||||
9 | }; |
||||||||
10 | |||||||||
11 | require_once __DIR__ . '/include/constantes.php'; |
||||||||
12 | $params = ['view' => _EXTCAL_NAV_CALWEEK, 'file' => _EXTCAL_FILE_CALWEEK]; |
||||||||
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 = Request::getInt('year', date('Y'), 'GET'); |
||||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||||
26 | $month = Request::getInt('month', date('n'), 'GET'); |
||||||||
27 | $day = Request::getInt('day', date('j'), 'GET'); |
||||||||
28 | $cat = Request::getInt('cat', 0, 'GET'); |
||||||||
29 | /* ========================================================================== */ |
||||||||
30 | |||||||||
31 | // Validate the date (day, month and year) |
||||||||
32 | $dayTS = mktime(0, 0, 0, $month, $day, $year); |
||||||||
33 | //$offset = date('w', $dayTS) - $helper->getConfig('week_start_day'); |
||||||||
34 | $offset = date('w', $dayTS) + 7 - $helper->getConfig('week_start_day') < 7 ? date('w', $dayTS) + 7 - $helper->getConfig('week_start_day') : 0; |
||||||||
35 | $dayTS -= ($offset * _EXTCAL_TS_DAY); |
||||||||
36 | $year = date('Y', $dayTS); |
||||||||
37 | $month = date('n', $dayTS); |
||||||||
38 | $day = date('j', $dayTS); |
||||||||
39 | |||||||||
40 | //echo $dayTS . ' dayTS-2 <br>'; |
||||||||
41 | //echo gmdate("Y-m-d\TH:i:s\Z", $dayTS). ' dayTS-2 <br>'; |
||||||||
42 | |||||||||
43 | $form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get'); |
||||||||
44 | $form->addElement(getListYears($year, $helper->getConfig('agenda_nb_years_before'), $helper->getConfig('agenda_nb_years_after'))); |
||||||||
45 | $form->addElement(getListMonths($month)); |
||||||||
46 | $form->addElement(getListDays($day)); |
||||||||
47 | $form->addElement(Utility::getListCategories($cat)); |
||||||||
48 | $form->addElement(new \XoopsFormButton('', 'form_submit', _SUBMIT, 'submit')); |
||||||||
49 | |||||||||
50 | // Assigning the form to the template |
||||||||
51 | $form->assign($xoopsTpl); |
||||||||
52 | |||||||||
53 | /**********************************************************************/ |
||||||||
54 | // Retriving events and formatting them |
||||||||
55 | //$events = $eventHandler->objectToArray($eventHandler->getEventCalendarWeek($day, $month, $year, $cat), array('cat_id')); |
||||||||
56 | |||||||||
57 | $criteres = [ |
||||||||
58 | 'periode' => _EXTCAL_EVENTS_CALENDAR_WEEK, |
||||||||
59 | 'day' => $day, |
||||||||
60 | 'month' => $month, |
||||||||
61 | 'year' => $year, |
||||||||
62 | 'cat' => $cat, |
||||||||
63 | 'externalKeys' => 'cat_id', |
||||||||
64 | ]; |
||||||||
65 | $events = $eventHandler->getEventsOnPeriode($criteres); |
||||||||
66 | /**********************************************************************/ |
||||||||
67 | //$eventsArray = $events; |
||||||||
68 | |||||||||
69 | // Calculating timestamp for the begin and the end of the month |
||||||||
70 | $startWeek = mktime(0, 0, 0, $month, $day, $year); |
||||||||
0 ignored issues
–
show
$year of type string is incompatible with the type integer expected by parameter $year of mktime() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() $month of type string is incompatible with the type integer expected by parameter $month of mktime() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() $day of type string is incompatible with the type integer expected by parameter $day of mktime() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||
71 | $endWeek = $startWeek + _EXTCAL_TS_WEEK - 1; |
||||||||
72 | |||||||||
73 | //echo $startWeek . ' startWeek <br>'; |
||||||||
74 | //echo gmdate("Y-m-d\TH:i:s\Z", $startWeek). ' startWeek <br>'; |
||||||||
75 | //echo $endWeek . ' endWeek <br>'; |
||||||||
76 | //echo gmdate("Y-m-d\TH:i:s\Z", $endWeek). ' endWeek <br>'; |
||||||||
77 | |||||||||
78 | /* |
||||||||
79 | * Adding all event occuring during this week to an array indexed by day number |
||||||||
80 | */ |
||||||||
81 | $eventsArray = []; |
||||||||
82 | foreach ($events as $event) { |
||||||||
83 | $eventHandler->addEventToCalArray($event, $eventsArray, $startWeek, $endWeek); |
||||||||
84 | // if (!$event['event_isrecur']) { |
||||||||
85 | // // Formating date |
||||||||
86 | // $eventHandler->formatEventDate($event, $helper->getConfig('event_date_week')); |
||||||||
87 | // $eventHandler->addEventToCalArray($event, $eventsArray, $startWeek, $endWeek); |
||||||||
88 | // } else { |
||||||||
89 | // $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startWeek, $endWeek); |
||||||||
90 | // // Formating date |
||||||||
91 | // $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||||||||
92 | // foreach ($recurEvents as $recurEvent) { |
||||||||
93 | // $eventHandler->addEventToCalArray($recurEvent, $eventsArray, $startWeek, $endWeek); |
||||||||
94 | // } |
||||||||
95 | // } |
||||||||
96 | } |
||||||||
97 | |||||||||
98 | /* |
||||||||
99 | * Making an array to create tabbed output on the template |
||||||||
100 | */ |
||||||||
101 | // Flag current day |
||||||||
102 | $selectedDays = [ |
||||||||
103 | 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
![]() 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
![]() 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
![]() |
|||||||||
104 | ]; |
||||||||
105 | |||||||||
106 | // Build calendar object |
||||||||
107 | $weekCalObj = new Calendar_Week($year, $month, $day, $helper->getConfig('week_start_day')); |
||||||||
0 ignored issues
–
show
$day of type string is incompatible with the type integer expected by parameter $d of Calendar_Week::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() $month of type string is incompatible with the type integer expected by parameter $m of Calendar_Week::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() $year of type string is incompatible with the type integer expected by parameter $y of Calendar_Week::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||
108 | $pWeekCalObj = $weekCalObj->prevWeek('object'); |
||||||||
109 | $nWeekCalObj = $weekCalObj->nextWeek('object'); |
||||||||
110 | $weekCalObj->build($selectedDays); |
||||||||
111 | |||||||||
112 | $week = []; |
||||||||
113 | $cellId = 0; |
||||||||
114 | while (false !== ($dayCalObj = $weekCalObj->fetch())) { |
||||||||
115 | $week[$cellId] = [ |
||||||||
116 | 'isEmpty' => $dayCalObj->isEmpty(), |
||||||||
117 | 'dayNumber' => $dayCalObj->thisDay(), |
||||||||
118 | 'month' => $dayCalObj->thisMonth(), |
||||||||
119 | 'year' => $dayCalObj->thisYear(), |
||||||||
120 | 'isSelected' => $dayCalObj->isSelected(), |
||||||||
121 | ]; |
||||||||
122 | if (isset($eventsArray[$dayCalObj->thisDay()]) && |
||||||||
123 | is_array($eventsArray[$dayCalObj->thisDay()]) && |
||||||||
124 | !$dayCalObj->isEmpty() && |
||||||||
125 | @count($eventsArray[$dayCalObj->thisDay()]) > 0) { |
||||||||
126 | $week[$cellId]['events'] = $eventsArray[$dayCalObj->thisDay()]; |
||||||||
127 | } else { |
||||||||
128 | $week[$cellId]['events'] = ''; |
||||||||
129 | } |
||||||||
130 | ++$cellId; |
||||||||
131 | } |
||||||||
132 | |||||||||
133 | // Assigning events to the template |
||||||||
134 | $xoopsTpl->assign('week', $week); |
||||||||
135 | |||||||||
136 | // Retriving categories |
||||||||
137 | $cats = $categoryHandler->objectToArray($categoryHandler->getAllCat($xoopsUser)); |
||||||||
138 | // Assigning categories to the template |
||||||||
139 | $xoopsTpl->assign('cats', $cats); |
||||||||
140 | |||||||||
141 | // Retriving weekdayNames |
||||||||
142 | //$weekdayNames = Calendar_Util_Textual::weekdayNames(); |
||||||||
143 | $weekdayNames = [_CAL_SUNDAY, _CAL_MONDAY, _CAL_TUESDAY, _CAL_WEDNESDAY, _CAL_THURSDAY, _CAL_FRIDAY, _CAL_SATURDAY]; |
||||||||
144 | for ($i = 0; $i < $helper->getConfig('week_start_day'); ++$i) { |
||||||||
145 | $weekdayName = array_shift($weekdayNames); |
||||||||
146 | $weekdayNames[] = $weekdayName; |
||||||||
147 | } |
||||||||
148 | // Assigning weekdayNames to the template |
||||||||
149 | $xoopsTpl->assign('weekdayNames', $weekdayNames); |
||||||||
150 | |||||||||
151 | // Retriving monthNames |
||||||||
152 | $monthNames = Calendar_Util_Textual::monthNames(); |
||||||||
153 | |||||||||
154 | // Making navig data |
||||||||
155 | $navig = [ |
||||||||
156 | 'prev' => [ |
||||||||
157 | 'uri' => 'year=' . $pWeekCalObj->thisYear() . '&month=' . $pWeekCalObj->thisMonth() . '&day=' . $pWeekCalObj->thisDay(), |
||||||||
158 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $pWeekCalObj->getTimestamp()), |
||||||||
159 | ], |
||||||||
160 | 'this' => [ |
||||||||
161 | 'uri' => 'year=' . $weekCalObj->thisYear() . '&month=' . $weekCalObj->thisMonth() . '&day=' . $weekCalObj->thisDay(), |
||||||||
162 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $weekCalObj->getTimestamp()), |
||||||||
163 | ], |
||||||||
164 | 'next' => [ |
||||||||
165 | 'uri' => 'year=' . $nWeekCalObj->thisYear() . '&month=' . $nWeekCalObj->thisMonth() . '&day=' . $nWeekCalObj->thisDay(), |
||||||||
166 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $nWeekCalObj->getTimestamp()), |
||||||||
167 | ], |
||||||||
168 | ]; |
||||||||
169 | |||||||||
170 | // Title of the page |
||||||||
171 | $xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . $navig['this']['name']); |
||||||||
172 | |||||||||
173 | // Assigning navig data to the template |
||||||||
174 | $xoopsTpl->assign('navig', $navig); |
||||||||
175 | |||||||||
176 | //Display tooltip |
||||||||
177 | $xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle')); |
||||||||
178 | $xoopsTpl->assign('showId', $helper->getConfig('showId')); |
||||||||
179 | |||||||||
180 | // Assigning current form navig data to the template |
||||||||
181 | $xoopsTpl->assign('selectedCat', $cat); |
||||||||
182 | $xoopsTpl->assign('year', $year); |
||||||||
183 | $xoopsTpl->assign('month', $month); |
||||||||
184 | $xoopsTpl->assign('day', $day); |
||||||||
185 | $xoopsTpl->assign('params', $params); |
||||||||
186 | |||||||||
187 | $tNavBar = getNavBarTabs($params['view']); |
||||||||
188 | $xoopsTpl->assign('tNavBar', $tNavBar); |
||||||||
189 | $xoopsTpl->assign('list_position', $helper->getConfig('list_position')); |
||||||||
190 | |||||||||
191 | //mb missing for xBootstrap templates by Angelo |
||||||||
192 | $lang = [ |
||||||||
193 | 'start' => _MD_EXTCAL_START, |
||||||||
194 | 'end' => _MD_EXTCAL_END, |
||||||||
195 | 'calmonth' => _MD_EXTCAL_NAV_CALMONTH, |
||||||||
196 | 'calweek' => _MD_EXTCAL_NAV_CALWEEK, |
||||||||
197 | 'year' => _MD_EXTCAL_NAV_YEAR, |
||||||||
198 | 'month' => _MD_EXTCAL_NAV_MONTH, |
||||||||
199 | 'week' => _MD_EXTCAL_NAV_WEEK, |
||||||||
200 | 'day' => _MD_EXTCAL_NAV_DAY, |
||||||||
201 | 'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
||||||||
202 | 'agendaday' => _MD_EXTCAL_NAV_AGENDA_DAY, |
||||||||
203 | 'search' => _MD_EXTCAL_NAV_SEARCH, |
||||||||
204 | 'newevent' => _MD_EXTCAL_NAV_NEW_EVENT, |
||||||||
205 | ]; |
||||||||
206 | |||||||||
207 | // Assigning language data to the template |
||||||||
208 | $xoopsTpl->assign('lang', $lang); |
||||||||
209 | $xoopsTpl->assign('view', 'calweek'); |
||||||||
210 | |||||||||
211 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||||
212 |