mambax7 /
extcal
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_CALMONTH, 'file' => _EXTCAL_FILE_CALMONTH]; |
||||||||
| 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
Loading history...
|
|||||||||
| 26 | $month = \Xmf\Request::getInt('month', date('n'), 'GET'); |
||||||||
| 27 | $cat = \Xmf\Request::getInt('cat', 0, 'GET'); |
||||||||
| 28 | /* ========================================================================== */ |
||||||||
| 29 | |||||||||
| 30 | $form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get'); |
||||||||
| 31 | $form->addElement(getListYears($year, $helper->getConfig('agenda_nb_years_before'), $helper->getConfig('agenda_nb_years_after'))); |
||||||||
| 32 | $form->addElement(getListMonths($month)); |
||||||||
| 33 | $form->addElement(Utility::getListCategories($cat)); |
||||||||
| 34 | $form->addElement(new \XoopsFormButton('', 'form_submit', _SUBMIT, 'submit')); |
||||||||
| 35 | |||||||||
| 36 | // Assigning the form to the template |
||||||||
| 37 | $form->assign($xoopsTpl); |
||||||||
| 38 | |||||||||
| 39 | /**********************************************************************/ |
||||||||
| 40 | // Retriving events and formatting them |
||||||||
| 41 | // $events = $eventHandler->objectToArray($eventHandler->getEventCalendarMonth($month, $year, $cat), array('cat_id')); |
||||||||
| 42 | $criteres = [ |
||||||||
| 43 | 'periode' => _EXTCAL_EVENTS_CALENDAR_MONTH, |
||||||||
| 44 | 'month' => $month, |
||||||||
| 45 | 'year' => $year, |
||||||||
| 46 | 'cat' => $cat, |
||||||||
| 47 | 'externalKeys' => 'cat_id', |
||||||||
| 48 | ]; |
||||||||
| 49 | $events = $eventHandler->getEventsOnPeriode($criteres); |
||||||||
| 50 | /**********************************************************************/ |
||||||||
| 51 | |||||||||
| 52 | // Calculating timestamp for the begin and the end of the month |
||||||||
| 53 | $startMonth = mktime(0, 0, 0, $month, 1, $year); |
||||||||
| 54 | $endMonth = mktime(23, 59, 59, $month + 1, 0, $year); |
||||||||
| 55 | |||||||||
| 56 | /* |
||||||||
| 57 | * Adding all event occuring during this month to an array indexed by day number |
||||||||
| 58 | */ |
||||||||
| 59 | $eventsArray = []; |
||||||||
| 60 | foreach ($events as $event) { |
||||||||
| 61 | $eventHandler->formatEventDate($event, $helper->getConfig('event_date_month')); |
||||||||
| 62 | $eventHandler->addEventToCalArray($event, $eventsArray, $startMonth, $endMonth); |
||||||||
| 63 | // if (!$event['event_isrecur']) { |
||||||||
| 64 | // // Formating date |
||||||||
| 65 | // $eventHandler->formatEventDate($event, $helper->getConfig('event_date_month')); |
||||||||
| 66 | // $eventHandler->addEventToCalArray($event, $eventsArray, $startMonth, $endMonth); |
||||||||
| 67 | // } else { |
||||||||
| 68 | // $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startMonth, $endMonth); |
||||||||
| 69 | // // Formating date |
||||||||
| 70 | // $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_month')); |
||||||||
| 71 | // foreach ($recurEvents as $recurEvent) { |
||||||||
| 72 | // $eventHandler->addEventToCalArray($recurEvent, $eventsArray, $startMonth, $endMonth); |
||||||||
| 73 | // } |
||||||||
| 74 | // } |
||||||||
| 75 | } |
||||||||
| 76 | |||||||||
| 77 | /* |
||||||||
| 78 | * Making an array to create tabbed output on the template |
||||||||
| 79 | */ |
||||||||
| 80 | // Flag current day |
||||||||
| 81 | $selectedDays = [ |
||||||||
| 82 | 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
Loading history...
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
Loading history...
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
Loading history...
|
|||||||||
| 83 | ]; |
||||||||
| 84 | |||||||||
| 85 | // Build calendar object |
||||||||
| 86 | $monthCalObj = new Calendar_Month_Weeks($year, $month, $helper->getConfig('week_start_day')); |
||||||||
| 87 | $pMonthCalObj = $monthCalObj->prevMonth('object'); |
||||||||
| 88 | $nMonthCalObj = $monthCalObj->nextMonth('object'); |
||||||||
| 89 | $monthCalObj->build(); |
||||||||
| 90 | |||||||||
| 91 | $tableRows = []; |
||||||||
| 92 | $rowId = 0; |
||||||||
| 93 | $cellId = 0; |
||||||||
| 94 | while (false !== ($weekCalObj = $monthCalObj->fetch())) { |
||||||||
| 95 | $weekCalObj->build($selectedDays); |
||||||||
| 96 | $tableRows[$rowId]['weekInfo'] = [ |
||||||||
| 97 | 'week' => $weekCalObj->thisWeek('n_in_year'), |
||||||||
| 98 | 'day' => $weekCalObj->thisDay(), |
||||||||
| 99 | 'month' => $weekCalObj->thisMonth(), |
||||||||
| 100 | 'year' => $weekCalObj->thisYear(), |
||||||||
| 101 | ]; |
||||||||
| 102 | while (false !== ($dayCalObj = $weekCalObj->fetch())) { |
||||||||
| 103 | $tableRows[$rowId]['week'][$cellId] = [ |
||||||||
| 104 | 'isEmpty' => $dayCalObj->isEmpty(), |
||||||||
| 105 | 'number' => $dayCalObj->thisDay(), |
||||||||
| 106 | 'isSelected' => $dayCalObj->isSelected(), |
||||||||
| 107 | ]; |
||||||||
| 108 | if (isset($eventsArray[$dayCalObj->thisDay()]) && |
||||||||
| 109 | is_array($eventsArray[$dayCalObj->thisDay()]) && |
||||||||
| 110 | count($eventsArray[$dayCalObj->thisDay()]) > 0 && |
||||||||
| 111 | !$dayCalObj->isEmpty()) { |
||||||||
| 112 | $tableRows[$rowId]['week'][$cellId]['events'] = $eventsArray[$dayCalObj->thisDay()]; |
||||||||
| 113 | } else { |
||||||||
| 114 | $tableRows[$rowId]['week'][$cellId]['events'] = ''; |
||||||||
| 115 | } |
||||||||
| 116 | ++$cellId; |
||||||||
| 117 | } |
||||||||
| 118 | $cellId = 0; |
||||||||
| 119 | ++$rowId; |
||||||||
| 120 | } |
||||||||
| 121 | |||||||||
| 122 | // Assigning events to the template |
||||||||
| 123 | $xoopsTpl->assign('tableRows', $tableRows); |
||||||||
| 124 | |||||||||
| 125 | // Retriving categories |
||||||||
| 126 | $cats = $categoryHandler->objectToArray($categoryHandler->getAllCat($xoopsUser)); |
||||||||
| 127 | // Assigning categories to the template |
||||||||
| 128 | $xoopsTpl->assign('cats', $cats); |
||||||||
| 129 | |||||||||
| 130 | // Retriving weekdayNames |
||||||||
| 131 | //$weekdayNames = Calendar_Util_Textual::weekdayNames(); |
||||||||
| 132 | //$weekdayNames = array('Dimanche','Mardi','Mercresi','Jeudi','Vendredi','Samedi'); |
||||||||
| 133 | $weekdayNames = [_CAL_SUNDAY, _CAL_MONDAY, _CAL_TUESDAY, _CAL_WEDNESDAY, _CAL_THURSDAY, _CAL_FRIDAY, _CAL_SATURDAY]; |
||||||||
| 134 | |||||||||
| 135 | for ($i = 0; $i < $helper->getConfig('week_start_day'); ++$i) { |
||||||||
| 136 | $weekdayName = array_shift($weekdayNames); |
||||||||
| 137 | $weekdayNames[] = $weekdayName; |
||||||||
| 138 | } |
||||||||
| 139 | // Assigning weekdayNames to the template |
||||||||
| 140 | $xoopsTpl->assign('weekdayNames', $weekdayNames); |
||||||||
| 141 | |||||||||
| 142 | // Retriving monthNames |
||||||||
| 143 | $monthNames = Calendar_Util_Textual::monthNames(); |
||||||||
| 144 | |||||||||
| 145 | // Making navig data |
||||||||
| 146 | $navig = [ |
||||||||
| 147 | 'prev' => [ |
||||||||
| 148 | 'uri' => 'year=' . $pMonthCalObj->thisYear() . '&month=' . $pMonthCalObj->thisMonth(), |
||||||||
|
0 ignored issues
–
show
The method
thisYear() does not exist on integer.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||||
| 149 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $pMonthCalObj->getTimestamp()), |
||||||||
| 150 | ], |
||||||||
| 151 | 'this' => [ |
||||||||
| 152 | 'uri' => 'year=' . $monthCalObj->thisYear() . '&month=' . $monthCalObj->thisMonth(), |
||||||||
| 153 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $monthCalObj->getTimestamp()), |
||||||||
| 154 | ], |
||||||||
| 155 | 'next' => [ |
||||||||
| 156 | 'uri' => 'year=' . $nMonthCalObj->thisYear() . '&month=' . $nMonthCalObj->thisMonth(), |
||||||||
|
0 ignored issues
–
show
The method
thisYear() does not exist on integer.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||||
| 157 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $nMonthCalObj->getTimestamp()), |
||||||||
| 158 | ], |
||||||||
| 159 | ]; |
||||||||
| 160 | |||||||||
| 161 | // Title of the page |
||||||||
| 162 | $xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . $navig['this']['name']); |
||||||||
| 163 | |||||||||
| 164 | // Assigning navig data to the template |
||||||||
| 165 | $xoopsTpl->assign('navig', $navig); |
||||||||
| 166 | |||||||||
| 167 | //Display tooltip |
||||||||
| 168 | $xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle')); |
||||||||
| 169 | $xoopsTpl->assign('showId', $helper->getConfig('showId')); |
||||||||
| 170 | |||||||||
| 171 | // Assigning current form navig data to the template |
||||||||
| 172 | $xoopsTpl->assign('selectedCat', $cat); |
||||||||
| 173 | $xoopsTpl->assign('year', $year); |
||||||||
| 174 | $xoopsTpl->assign('month', $month); |
||||||||
| 175 | $xoopsTpl->assign('params', $params); |
||||||||
| 176 | |||||||||
| 177 | $tNavBar = getNavBarTabs($params['view']); |
||||||||
| 178 | $xoopsTpl->assign('tNavBar', $tNavBar); |
||||||||
| 179 | $xoopsTpl->assign('list_position', $helper->getConfig('list_position')); |
||||||||
| 180 | // echoArray($tNavBar,true); |
||||||||
| 181 | |||||||||
| 182 | //mb missing for xBootstrap templates by Angelo |
||||||||
| 183 | $lang = [ |
||||||||
| 184 | 'start' => _MD_EXTCAL_START, |
||||||||
| 185 | 'end' => _MD_EXTCAL_END, |
||||||||
| 186 | 'calmonth' => _MD_EXTCAL_NAV_CALMONTH, |
||||||||
| 187 | 'calweek' => _MD_EXTCAL_NAV_CALWEEK, |
||||||||
| 188 | 'year' => _MD_EXTCAL_NAV_YEAR, |
||||||||
| 189 | 'month' => _MD_EXTCAL_NAV_MONTH, |
||||||||
| 190 | 'week' => _MD_EXTCAL_NAV_WEEK, |
||||||||
| 191 | 'day' => _MD_EXTCAL_NAV_DAY, |
||||||||
| 192 | 'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
||||||||
| 193 | 'agendaday' => _MD_EXTCAL_NAV_AGENDA_DAY, |
||||||||
| 194 | 'search' => _MD_EXTCAL_NAV_SEARCH, |
||||||||
| 195 | 'newevent' => _MD_EXTCAL_NAV_NEW_EVENT, |
||||||||
| 196 | ]; |
||||||||
| 197 | |||||||||
| 198 | // Assigning language data to the template |
||||||||
| 199 | $xoopsTpl->assign('lang', $lang); |
||||||||
| 200 | $xoopsTpl->assign('view', 'calmonth'); |
||||||||
| 201 | |||||||||
| 202 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||||
| 203 |