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 | }; |
||
8 | use Xmf\Request; |
||
9 | |||
10 | require_once __DIR__ . '/include/constantes.php'; |
||
11 | $params = ['view' => _EXTCAL_NAV_SEARCH, 'file' => _EXTCAL_FILE_SEARCH]; |
||
12 | $GLOBALS['xoopsOption']['template_main'] = "extcal_view_{$params['view']}.tpl"; |
||
13 | require_once __DIR__ . '/header.php'; |
||
14 | |||
15 | global $xoopsUser, $xoopsTpl; |
||
16 | |||
17 | /** @var CategoryHandler $categoryHandler */ |
||
18 | /** @var EventHandler $eventHandler */ |
||
19 | /** @var Helper $helper */ |
||
20 | $helper = Helper::getInstance(); |
||
21 | |||
22 | $recurEventsArray = []; |
||
23 | //needed to save the state of the form, so we don't show on the first time the list of available events |
||
24 | $num_tries = isset($_POST['num_tries']) ? $_POST['num_tries'] + 1 : 0; |
||
25 | |||
26 | /* ========================================================================== */ |
||
27 | /***************************************************************/ |
||
28 | /* adding search elements */ |
||
29 | /***************************************************************/ |
||
30 | $searchExp = Request::getString('searchExp', '', 'POST'); |
||
31 | $andor = Request::getString('andor', '', 'POST'); |
||
32 | $year = Request::getInt('year', date('Y'), 'POST'); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
33 | $month = Request::getInt('month', date('n'), 'POST'); |
||
34 | $day = Request::getInt('day', 0, 'POST'); |
||
35 | $cat = Request::getInt('cat', 0, 'POST'); |
||
36 | $orderby1 = Request::getString('orderby1', 'cat_name ASC', 'POST'); |
||
37 | $orderby2 = Request::getString('orderby2', 'event_title AS', 'POST'); |
||
38 | $orderby3 = Request::getString('orderby3', '', 'POST'); |
||
39 | /* ========================================================================== */ |
||
40 | |||
41 | //$orderby = isset($_GET['orderby']) ? (int)($_GET['orderby']) : 0; |
||
42 | |||
43 | //--------------------------------------------------------------- |
||
44 | $search = []; |
||
45 | $exp = new \XoopsFormText(_MD_EXTCAL_EXPRESSION, 'searchExp', 80, 80, $searchExp); |
||
46 | $search['searchExp'] = $exp->render(); |
||
47 | $search['andor'] = Utility::getListAndOr('andor', '', $andor)->render(); |
||
48 | //$search['year'] = getListYears($year,$helper->getConfig('agenda_nb_years_before'),$helper->getConfig('agenda_nb_years_after'), true)->render(); |
||
49 | $search['year'] = getListYears($year, 2, 5, true)->render(); |
||
50 | $search['month'] = getListMonths($month, true)->render(); |
||
51 | $search['day'] = getListDays($day, true)->render(); |
||
52 | |||
53 | //$search['cat'] = implode('', getCheckeCategories()); |
||
54 | $search['cat'] = Utility::getListCategories($cat, true, 'cat')->render(); |
||
55 | |||
56 | $search['orderby1'] = Utility::getListOrderBy('orderby1', '', $orderby1, false)->render(); |
||
57 | $search['orderby2'] = Utility::getListOrderBy('orderby2', '', $orderby2, true)->render(); |
||
58 | $search['orderby3'] = Utility::getListOrderBy('orderby3', '', $orderby3, true)->render(); |
||
59 | |||
60 | //echoArray($search,true); |
||
61 | $xoopsTpl->assign('search', $search); |
||
62 | /***************************************************************/ |
||
63 | |||
64 | // $form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get'); |
||
65 | // // $form->addElement(getListYears($year,$helper->getConfig('agenda_nb_years_before'),$helper->getConfig('agenda_nb_years_after'), true)); |
||
66 | // // $form->addElement(getListMonths($month, rtue)); |
||
67 | // $form->addElement(getListCategories($cat)); |
||
68 | // $form->addElement(Utility::getListOrderBy($orderby)); |
||
69 | // |
||
70 | // $form->addElement( new \XoopsFormText(_MD_EXTCAL_SEARCH_EXP, 'searchExp', 80, 80, $searchExp)); |
||
71 | // |
||
72 | // $form->addElement( new \XoopsFormButton("", "", _SEND, "submit")); |
||
73 | // |
||
74 | // // Assigning the form to the template |
||
75 | // $form->assign($xoopsTpl); |
||
76 | |||
77 | // Retriving events |
||
78 | //echoArray($_GET, false); |
||
79 | $orderBy = [ |
||
80 | $orderby1, |
||
81 | $orderby2, |
||
82 | $orderby3, |
||
83 | ]; |
||
84 | $userId = 0; |
||
85 | $user = ''; |
||
86 | //get all events for the date |
||
87 | $events = $eventHandler->getSearchEvent2($year, $month, $day, $cat, $searchExp, $andor, $orderBy, $userId, $user); |
||
88 | |||
89 | $eventHandler->serverTimeToUserTimes($events); |
||
90 | |||
91 | // Formating date |
||
92 | $eventHandler->formatEventsDate($events, $helper->getConfig('event_date_year')); |
||
93 | |||
94 | // Treatment for recurring event |
||
95 | $startMonth = mktime(0, 0, 0, $month, 1, $year); |
||
96 | $daysInTheMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
||
97 | $endMonth = mktime(23, 59, 59, $month, $daysInTheMonth, $year); |
||
98 | |||
99 | //$startMonth = mktime(0, 0, 0, 1, 1, 2011); |
||
100 | //$endMonth = mktime(23, 59, 59, 12, 31, 2011); |
||
101 | |||
102 | //echo "Start & End Month ===><br>{$startMonth}<br>{$endMonth}<br>"; |
||
103 | |||
104 | $eventsArray = []; |
||
105 | foreach ($events as $event) { |
||
106 | if (!$event['event_isrecur']) { |
||
107 | // Formating date |
||
108 | $eventHandler->formatEventDate($event, $helper->getConfig('event_date_week')); |
||
109 | $eventsArray[] = $event; |
||
110 | } else { |
||
111 | $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startMonth, $endMonth); |
||
112 | |||
113 | // Formating date |
||
114 | $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||
115 | //$eventsArray = array_merge($eventsArray, $recurEvents); |
||
116 | } |
||
117 | } |
||
118 | |||
119 | $criteria = new \CriteriaCompo(); |
||
120 | $criteria->add(new \Criteria('event_isrecur', 1)); |
||
121 | |||
122 | if ($cat > 0) { |
||
123 | $criteria->add(new \Criteria('cat_id', $cat)); |
||
124 | } |
||
125 | |||
126 | //$criteria = new \Criteria('event_isrecur', 1); |
||
127 | |||
128 | $recurrents = $eventHandler->getAllEvents($criteria, false); |
||
129 | //$categoryHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE); |
||
130 | $categoryHandler = $helper->getHandler(_EXTCAL_CLN_CAT); |
||
131 | |||
132 | //========================================= |
||
133 | foreach ($recurrents as $h => $hValue) { |
||
134 | // $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startMonth, $endMonth); |
||
135 | $recurEvents = $eventHandler->getRecurEventToDisplay($recurrents[$h], $startMonth, $endMonth); |
||
136 | |||
137 | $categoryObject = $categoryHandler->getCat($recurrents[$h]['cat_id']); |
||
138 | |||
139 | // echo '------------ CATEGORY OBJECT ----------------------------'; |
||
140 | // var_dump($categoryObject); |
||
141 | // |
||
142 | // $recurEvents['cat']['cat_name'] = $categoryObject->vars['cat_name']['value']; |
||
143 | // $recurEvents['cat']['cat_color'] = $categoryObject->vars['cat_color']['value']; |
||
144 | // $recurEvents['cat']['cat_light_color'] = Utility::getLighterColor($categoryObject->vars['cat_color']['value'], _EXTCAL_INFOBULLE_RGB_MIN, _EXTCAL_INFOBULLE_RGB_MAX); |
||
145 | |||
146 | // Formating date |
||
147 | $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||
148 | foreach ($recurEvents as $val) { |
||
149 | $val['cat']['cat_name'] = $categoryObject->vars['cat_name']['value']; |
||
150 | $val['cat']['cat_color'] = $categoryObject->vars['cat_color']['value']; |
||
151 | $val['cat']['cat_light_color'] = Utility::getLighterColor($categoryObject->vars['cat_color']['value'], _EXTCAL_INFOBULLE_RGB_MIN, _EXTCAL_INFOBULLE_RGB_MAX); |
||
152 | $recurEventsArray[] = $val; |
||
153 | } |
||
154 | } |
||
155 | |||
156 | $eventsArray = array_merge($eventsArray, $recurEventsArray); |
||
157 | |||
158 | // Sort event array by event start |
||
159 | //usort($eventsArray, "orderEvents"); |
||
160 | //echoArray($eventsArray,false); |
||
161 | |||
162 | // Assigning events to the template |
||
163 | $xoopsTpl->assign('evenements_trouves', sprintf(_MD_EXTCAL_EVENTS_FOUND, count($eventsArray))); |
||
164 | $xoopsTpl->assign('events', $eventsArray); |
||
165 | |||
166 | // Retriving categories and Assigning categories to the template |
||
167 | $cats = $categoryHandler->objectToArray($categoryHandler->getAllCat($xoopsUser)); |
||
168 | $xoopsTpl->assign('cats', $cats); |
||
169 | |||
170 | // Making navig data |
||
171 | // $monthCalObj = new Calendar_Month_Weekdays($year, $month); |
||
172 | // $pMonthCalObj = $monthCalObj->prevMonth('object'); |
||
173 | // $nMonthCalObj = $monthCalObj->nextMonth('object'); |
||
174 | // $navig = array('prev' => array('uri' => 'year=' . $pMonthCalObj->thisYear() |
||
175 | // . '&month=' . $pMonthCalObj->thisMonth(), |
||
176 | // 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $pMonthCalObj->getTimestamp())), |
||
177 | // 'this' => array( 'uri' => 'year=' . $monthCalObj->thisYear() |
||
178 | // . '&month=' . $monthCalObj->thisMonth(), |
||
179 | // 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $monthCalObj->getTimestamp()) ), |
||
180 | // 'next' => array('uri' => 'year=' . $nMonthCalObj->thisYear() |
||
181 | // . '&month=' . $nMonthCalObj->thisMonth(), |
||
182 | // 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $nMonthCalObj->getTimestamp()) ) |
||
183 | // ); |
||
184 | // |
||
185 | // // Title of the page |
||
186 | // $xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . |
||
187 | // $navig['this']['name'] |
||
188 | // ); |
||
189 | // |
||
190 | // // Assigning navig data to the template |
||
191 | // $xoopsTpl->assign('navig', $navig); |
||
192 | |||
193 | //Display tooltip |
||
194 | $xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle')); |
||
195 | $xoopsTpl->assign('showId', $helper->getConfig('showId')); |
||
196 | |||
197 | // Assigning current form navig data to the template |
||
198 | $xoopsTpl->assign('selectedCat', $cat); |
||
199 | $xoopsTpl->assign('year', $year); |
||
200 | $xoopsTpl->assign('month', $month); |
||
201 | |||
202 | $xoopsTpl->assign('num_tries', $num_tries); |
||
203 | |||
204 | //--------------------------------------------------------------- |
||
205 | if ($xoopsUser) { |
||
206 | $xoopsTpl->assign('isAdmin', $xoopsUser->isAdmin()); |
||
207 | $canEdit = false; |
||
208 | /* todo |
||
209 | $canEdit |
||
210 | = |
||
211 | $permHandler->isAllowed($xoopsUser, 'extcal_cat_edit', $event['cat']['cat_id']) |
||
212 | && $xoopsUser->getVar('uid') == $event['user']['uid']; |
||
213 | $xoopsTpl->assign('canEdit', $canEdit); |
||
214 | */ |
||
215 | } else { |
||
216 | $xoopsTpl->assign('isAdmin', false); |
||
217 | $xoopsTpl->assign('canEdit', false); |
||
218 | } |
||
219 | |||
220 | //--------------------------------------------------------------- |
||
221 | $xoopsTpl->assign('params', $params); |
||
222 | $tNavBar = getNavBarTabs($params['view']); |
||
223 | $xoopsTpl->assign('tNavBar', $tNavBar); |
||
224 | $xoopsTpl->assign('list_position', -1); |
||
225 | // echoArray($tNavBar,true); |
||
226 | //--------------------------------------------------------------- |
||
227 | |||
228 | //mb missing for xBootstrap templates by Angelo |
||
229 | $lang = [ |
||
230 | 'start' => _MD_EXTCAL_START, |
||
231 | 'end' => _MD_EXTCAL_END, |
||
232 | 'calmonth' => _MD_EXTCAL_NAV_CALMONTH, |
||
233 | 'calweek' => _MD_EXTCAL_NAV_CALWEEK, |
||
234 | 'year' => _MD_EXTCAL_NAV_YEAR, |
||
235 | 'month' => _MD_EXTCAL_NAV_MONTH, |
||
236 | 'week' => _MD_EXTCAL_NAV_WEEK, |
||
237 | 'day' => _MD_EXTCAL_NAV_DAY, |
||
238 | 'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
||
239 | 'agendaday' => _MD_EXTCAL_NAV_AGENDA_DAY, |
||
240 | 'search' => _MD_EXTCAL_NAV_SEARCH, |
||
241 | 'newevent' => _MD_EXTCAL_NAV_NEW_EVENT, |
||
242 | ]; |
||
243 | // Assigning language data to the template |
||
244 | $xoopsTpl->assign('lang', $lang); |
||
245 | $xoopsTpl->assign('view', 'search'); |
||
246 | |||
247 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
248 |