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 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_AGENDA_WEEK, 'file' => _EXTCAL_FILE_AGENDA_WEEK]; |
||||||||
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
Bug
introduced
by
![]() |
|||||||||
26 | $month = \Xmf\Request::getInt('month', date('n'), 'GET'); |
||||||||
27 | $day = \Xmf\Request::getInt('day', date('j'), 'GET'); |
||||||||
28 | $cat = \Xmf\Request::getInt('cat', 0, 'GET'); |
||||||||
29 | |||||||||
30 | // Validate the date (day, month and year) |
||||||||
31 | $dayTS = mktime(0, 0, 0, $month, $day, $year); |
||||||||
32 | //$offset = date('w', $dayTS) - $helper->getConfig('week_start_day'); |
||||||||
33 | $offset = date('w', $dayTS) + 7 - $helper->getConfig('week_start_day') < 7 ? date('w', $dayTS) + 7 - $helper->getConfig('week_start_day') : 0; |
||||||||
34 | $dayTS -= ($offset * _EXTCAL_TS_DAY); |
||||||||
35 | $year = date('Y', $dayTS); |
||||||||
36 | $month = date('n', $dayTS); |
||||||||
37 | $day = date('j', $dayTS); |
||||||||
38 | |||||||||
39 | $form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get'); |
||||||||
40 | $form->addElement(getListYears($year, $helper->getConfig('agenda_nb_years_before'), $helper->getConfig('agenda_nb_years_after'))); |
||||||||
41 | $form->addElement(getListMonths($month)); |
||||||||
42 | $form->addElement(getListDays($day)); |
||||||||
43 | $form->addElement(Utility::getListCategories($cat)); |
||||||||
44 | $form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit')); |
||||||||
45 | |||||||||
46 | // Assigning the form to the template |
||||||||
47 | $form->assign($xoopsTpl); |
||||||||
48 | |||||||||
49 | $mTranche = $helper->getConfig('agenda_tranche_minutes'); //minutes |
||||||||
50 | $hStart = $helper->getConfig('agenda_start_hour'); //heure debut de journee |
||||||||
51 | $hEnd = $helper->getConfig('agenda_end_hour'); //heure fin de journee |
||||||||
52 | //$helper->getConfig('agenda_nb_days_week') = 5; |
||||||||
53 | $nbJours = $helper->getConfig('agenda_nb_days_week'); //nombre de jour |
||||||||
54 | |||||||||
55 | /**********************************************************************/ |
||||||||
56 | // Retriving events and formatting them |
||||||||
57 | //$events = $eventHandler->objectToArray($eventHandler->getEventWeek($day, $month, $year, $cat, $nbJours), array('cat_id')); |
||||||||
58 | $criteres = [ |
||||||||
59 | 'periode' => _EXTCAL_EVENTS_AGENDA_WEEK, |
||||||||
60 | 'day' => $day, |
||||||||
61 | 'month' => $month, |
||||||||
62 | 'year' => $year, |
||||||||
63 | 'cat' => $cat, |
||||||||
64 | 'nbJours' => $nbJours, |
||||||||
65 | 'externalKeys' => 'cat_id', |
||||||||
66 | ]; |
||||||||
67 | $events = $eventHandler->getEventsOnPeriode($criteres); |
||||||||
68 | /**********************************************************************/ |
||||||||
69 | $eventsArray = $events; |
||||||||
70 | // Formating date |
||||||||
71 | // $eventHandler->formatEventsDate($events, $helper->getConfig('event_date_year')); |
||||||||
72 | // |
||||||||
73 | // Treatment for recurring event |
||||||||
74 | // $startWeek = mktime(0, 0, 0, $month, $day, $year); |
||||||||
75 | // $endWeek = $startWeek + _EXTCAL_TS_WEEK; |
||||||||
76 | // |
||||||||
77 | // $eventsArray = []; |
||||||||
78 | // foreach ($events as $event) { |
||||||||
79 | // if (!$event['event_isrecur']) { |
||||||||
80 | // // Formating date |
||||||||
81 | // $eventHandler->formatEventDate($event, $helper->getConfig('event_date_week')); |
||||||||
82 | // $eventsArray[] = $event; |
||||||||
83 | // } else { |
||||||||
84 | // $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startWeek, $endWeek); |
||||||||
85 | // // Formating date |
||||||||
86 | // $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||||||||
87 | // $eventsArray = array_merge($eventsArray, $recurEvents); |
||||||||
88 | // } |
||||||||
89 | // } |
||||||||
90 | // |
||||||||
91 | // Sort event array by event start |
||||||||
92 | // usort($eventsArray, "orderEvents"); |
||||||||
93 | |||||||||
94 | //------------------------------------------------------------------- |
||||||||
95 | // Assigning events to the template |
||||||||
96 | //------------------------------------------------------------------- |
||||||||
97 | |||||||||
98 | //$params['colJourWidth'] = (int)((((500-50)/$nbJours)/500*100)+.5); |
||||||||
99 | $params['colJourWidth'] = (int)((((500 - 50) / $nbJours) / 500 * 100) + .6); |
||||||||
100 | // echo "agenda_week : {$dayTS}<br>"; |
||||||||
101 | $tAgenda = agenda_getEvents($eventsArray, $dayTS, $hStart, $hEnd, $mTranche, $nbJours); |
||||||||
102 | //$exp = print_r($eventsArray, true); |
||||||||
103 | $exp = print_r($tAgenda, true); |
||||||||
104 | //echo "<pre>{$exp}</pre>"; |
||||||||
105 | |||||||||
106 | $xoopsTpl->assign('agenda', $tAgenda); |
||||||||
107 | //------------------------------------------------------------------- |
||||||||
108 | |||||||||
109 | // Retriving categories |
||||||||
110 | $cats = $categoryHandler->objectToArray($categoryHandler->getAllCat($xoopsUser)); |
||||||||
111 | // Assigning categories to the template |
||||||||
112 | $xoopsTpl->assign('cats', $cats); |
||||||||
113 | |||||||||
114 | // Making navig data |
||||||||
115 | $weekCalObj = new Calendar_Week($year, $month, $day, $helper->getConfig('week_start_day')); |
||||||||
0 ignored issues
–
show
$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
![]() $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
![]() |
|||||||||
116 | $pWeekCalObj = $weekCalObj->prevWeek('object'); |
||||||||
117 | $nWeekCalObj = $weekCalObj->nextWeek('object'); |
||||||||
118 | |||||||||
119 | $navig = [ |
||||||||
120 | 'prev' => [ |
||||||||
121 | 'uri' => 'year=' . $pWeekCalObj->thisYear() . '&month=' . $pWeekCalObj->thisMonth() . '&day=' . $pWeekCalObj->thisDay(), |
||||||||
122 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $pWeekCalObj->getTimestamp()), |
||||||||
123 | ], |
||||||||
124 | 'this' => [ |
||||||||
125 | 'uri' => 'year=' . $weekCalObj->thisYear() . '&month=' . $weekCalObj->thisMonth() . '&day=' . $weekCalObj->thisDay(), |
||||||||
126 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $weekCalObj->getTimestamp()), |
||||||||
127 | ], |
||||||||
128 | 'next' => [ |
||||||||
129 | 'uri' => 'year=' . $nWeekCalObj->thisYear() . '&month=' . $nWeekCalObj->thisMonth() . '&day=' . $nWeekCalObj->thisDay(), |
||||||||
130 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $nWeekCalObj->getTimestamp()), |
||||||||
131 | ], |
||||||||
132 | ]; |
||||||||
133 | |||||||||
134 | // Title of the page |
||||||||
135 | $xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . $navig['this']['name']); |
||||||||
136 | |||||||||
137 | // Assigning navig data to the template |
||||||||
138 | $xoopsTpl->assign('navig', $navig); |
||||||||
139 | |||||||||
140 | //Display tooltip |
||||||||
141 | $xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle')); |
||||||||
142 | $xoopsTpl->assign('showId', $helper->getConfig('showId')); |
||||||||
143 | |||||||||
144 | // Assigning current form navig data to the template |
||||||||
145 | $xoopsTpl->assign('selectedCat', $cat); |
||||||||
146 | $xoopsTpl->assign('year', $year); |
||||||||
147 | $xoopsTpl->assign('month', $month); |
||||||||
148 | $xoopsTpl->assign('day', $day); |
||||||||
149 | $xoopsTpl->assign('params', $params); |
||||||||
150 | |||||||||
151 | $tNavBar = getNavBarTabs($params['view']); |
||||||||
152 | $xoopsTpl->assign('tNavBar', $tNavBar); |
||||||||
153 | $xoopsTpl->assign('list_position', $helper->getConfig('list_position')); |
||||||||
154 | |||||||||
155 | // echoArray($tNavBar,true); |
||||||||
156 | |||||||||
157 | //mb missing for xBootstrap templates by Angelo |
||||||||
158 | $lang = [ |
||||||||
159 | 'start' => _MD_EXTCAL_START, |
||||||||
160 | 'end' => _MD_EXTCAL_END, |
||||||||
161 | 'calmonth' => _MD_EXTCAL_NAV_CALMONTH, |
||||||||
162 | 'calweek' => _MD_EXTCAL_NAV_CALWEEK, |
||||||||
163 | 'year' => _MD_EXTCAL_NAV_YEAR, |
||||||||
164 | 'month' => _MD_EXTCAL_NAV_MONTH, |
||||||||
165 | 'week' => _MD_EXTCAL_NAV_WEEK, |
||||||||
166 | 'day' => _MD_EXTCAL_NAV_DAY, |
||||||||
167 | 'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
||||||||
168 | 'agendaday' => _MD_EXTCAL_NAV_AGENDA_DAY, |
||||||||
169 | 'search' => _MD_EXTCAL_NAV_SEARCH, |
||||||||
170 | 'newevent' => _MD_EXTCAL_NAV_NEW_EVENT, |
||||||||
171 | ]; |
||||||||
172 | // Assigning language data to the template |
||||||||
173 | $xoopsTpl->assign('lang', $lang); |
||||||||
174 | $xoopsTpl->assign('view', 'agendaweek'); |
||||||||
175 | |||||||||
176 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||||
177 |