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 | }; |
||||
| 8 | use Xmf\Request; |
||||
| 9 | |||||
| 10 | require_once __DIR__ . '/include/constantes.php'; |
||||
| 11 | $params = ['view' => _EXTCAL_NAV_MONTH, 'file' => _EXTCAL_FILE_MONTH]; |
||||
| 12 | $GLOBALS['xoopsOption']['template_main'] = "extcal_view_{$params['view']}.tpl"; |
||||
| 13 | require_once __DIR__ . '/header.php'; |
||||
| 14 | |||||
| 15 | global $xoopsUser, $xoopsTpl; |
||||
| 16 | |||||
| 17 | /** @var Time $timeHandler */ |
||||
| 18 | /** @var CategoryHandler $categoryHandler */ |
||||
| 19 | /** @var EventHandler $eventHandler */ |
||||
| 20 | /** @var Helper $helper */ |
||||
| 21 | $helper = Helper::getInstance(); |
||||
| 22 | |||||
| 23 | /* ========================================================================== */ |
||||
| 24 | $year = Request::getInt('year', date('Y'), 'GET'); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 25 | $month = Request::getInt('month', date('n'), 'GET'); |
||||
| 26 | $cat = Request::getInt('cat', 0, 'GET'); |
||||
| 27 | /* ========================================================================== */ |
||||
| 28 | |||||
| 29 | $form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get'); |
||||
| 30 | $form->addElement(getListYears($year, $helper->getConfig('agenda_nb_years_before'), $helper->getConfig('agenda_nb_years_after'))); |
||||
| 31 | $form->addElement(getListMonths($month)); |
||||
| 32 | $form->addElement(Utility::getListCategories($cat)); |
||||
| 33 | $form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit')); |
||||
| 34 | |||||
| 35 | // Assigning the form to the template |
||||
| 36 | $form->assign($xoopsTpl); |
||||
| 37 | |||||
| 38 | /**********************************************************************/ |
||||
| 39 | // Retriving events and formatting them |
||||
| 40 | //$events = $eventHandler->objectToArray($eventHandler->getEventMonth($month, $year, $cat), array('cat_id')); |
||||
| 41 | $criteres = [ |
||||
| 42 | 'periode' => _EXTCAL_EVENTS_MONTH, |
||||
| 43 | 'month' => $month, |
||||
| 44 | 'year' => $year, |
||||
| 45 | 'cat' => $cat, |
||||
| 46 | 'externalKeys' => 'cat_id', |
||||
| 47 | ]; |
||||
| 48 | $events = $eventHandler->getEventsOnPeriode($criteres); |
||||
| 49 | /**********************************************************************/ |
||||
| 50 | $eventsArray = $events; |
||||
| 51 | |||||
| 52 | // Formating date |
||||
| 53 | //$eventHandler->formatEventsDate($events, $helper->getConfig('event_date_year')); |
||||
| 54 | |||||
| 55 | // Treatment for recurring event |
||||
| 56 | $startMonth = mktime(0, 0, 0, $month, 1, $year); |
||||
| 57 | $endMonth = mktime(23, 59, 59, $month, 31, $year); |
||||
| 58 | |||||
| 59 | // $eventsArray = []; |
||||
| 60 | // foreach ($events as $event) { |
||||
| 61 | // if ($event['event_isrecur']==0) { |
||||
| 62 | // // Formating date |
||||
| 63 | // $eventHandler->formatEventDate($event, $helper->getConfig('event_date_week')); |
||||
| 64 | // $eventsArray[] = $event; |
||||
| 65 | // } else { |
||||
| 66 | // //$recurEvents = $eventHandler->getRecurEventToDisplay($event, $startMonth, $endMonth); |
||||
| 67 | // // Formating date |
||||
| 68 | // //$eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||||
| 69 | // //$eventsArray = array_merge($eventsArray, $recurEvents); |
||||
| 70 | // $eventHandler->formatEventDate($event, $helper->getConfig('event_date_week')); |
||||
| 71 | // $eventsArray[] = $event; |
||||
| 72 | // } |
||||
| 73 | // } |
||||
| 74 | |||||
| 75 | // $criteria = new \Criteria('event_isrecur',1); |
||||
| 76 | // $recurrents = $eventHandler->getAllEvents($criteria, false); |
||||
| 77 | // //echoArray($recurrents,false,'<b>Evennements reccurents</b>'); |
||||
| 78 | // |
||||
| 79 | // for ($h=0,$count=count($recurrents);$h<$count;++$h) { |
||||
| 80 | // $recurEvents = $eventHandler->getRecurEventToDisplay($recurrents[$h], $startMonth, $endMonth); |
||||
| 81 | // // echoArray($recurEvents,false,"liste des evennements a ajouter pour " . $recurrents[$h]['event_title']); |
||||
| 82 | // // Formating date |
||||
| 83 | // $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||||
| 84 | // $eventsArray = array_merge($eventsArray, $recurEvents); |
||||
| 85 | // } |
||||
| 86 | // |
||||
| 87 | // Sort event array by event start |
||||
| 88 | //usort($eventsArray, "orderEvents"); |
||||
| 89 | //echoArray($eventsArray,false,'<b>Evennements reccurents</b>'); |
||||
| 90 | |||||
| 91 | // Assigning events to the template |
||||
| 92 | $xoopsTpl->assign('events', $eventsArray); |
||||
| 93 | |||||
| 94 | // Retriving categories |
||||
| 95 | $cats = $categoryHandler->objectToArray($categoryHandler->getAllCat($xoopsUser)); |
||||
| 96 | // Assigning categories to the template |
||||
| 97 | $xoopsTpl->assign('cats', $cats); |
||||
| 98 | |||||
| 99 | // Making navig data |
||||
| 100 | $monthCalObj = new Calendar_Month_Weekdays($year, $month); |
||||
| 101 | $pMonthCalObj = $monthCalObj->prevMonth('object'); |
||||
| 102 | $nMonthCalObj = $monthCalObj->nextMonth('object'); |
||||
| 103 | $navig = [ |
||||
| 104 | 'prev' => [ |
||||
| 105 | '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...
|
|||||
| 106 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $pMonthCalObj->getTimestamp()), |
||||
| 107 | ], |
||||
| 108 | 'this' => [ |
||||
| 109 | 'uri' => 'year=' . $monthCalObj->thisYear() . '&month=' . $monthCalObj->thisMonth(), |
||||
| 110 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $monthCalObj->getTimestamp()), |
||||
| 111 | ], |
||||
| 112 | 'next' => [ |
||||
| 113 | '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...
|
|||||
| 114 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_month'), $nMonthCalObj->getTimestamp()), |
||||
| 115 | ], |
||||
| 116 | ]; |
||||
| 117 | |||||
| 118 | // Title of the page |
||||
| 119 | $xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . $navig['this']['name']); |
||||
| 120 | |||||
| 121 | // Assigning navig data to the template |
||||
| 122 | $xoopsTpl->assign('navig', $navig); |
||||
| 123 | |||||
| 124 | //Display tooltip |
||||
| 125 | $xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle')); |
||||
| 126 | $xoopsTpl->assign('showId', $helper->getConfig('showId')); |
||||
| 127 | |||||
| 128 | // Assigning current form navig data to the template |
||||
| 129 | $xoopsTpl->assign('selectedCat', $cat); |
||||
| 130 | $xoopsTpl->assign('year', $year); |
||||
| 131 | $xoopsTpl->assign('month', $month); |
||||
| 132 | |||||
| 133 | $xoopsTpl->assign('params', $params); |
||||
| 134 | |||||
| 135 | $tNavBar = getNavBarTabs($params['view']); |
||||
| 136 | $xoopsTpl->assign('tNavBar', $tNavBar); |
||||
| 137 | $xoopsTpl->assign('list_position', $helper->getConfig('list_position')); |
||||
| 138 | // echoArray($tNavBar,true); |
||||
| 139 | |||||
| 140 | //--------------------------------------------------------------- |
||||
| 141 | if ($xoopsUser) { |
||||
| 142 | $xoopsTpl->assign('isAdmin', $xoopsUser->isAdmin()); |
||||
| 143 | $canEdit = false; |
||||
| 144 | /* todo |
||||
| 145 | $canEdit |
||||
| 146 | = |
||||
| 147 | $permHandler->isAllowed($xoopsUser, 'extcal_cat_edit', $event['cat']['cat_id']) |
||||
| 148 | && $xoopsUser->getVar('uid') == $event['user']['uid']; |
||||
| 149 | $xoopsTpl->assign('canEdit', $canEdit); |
||||
| 150 | */ |
||||
| 151 | } else { |
||||
| 152 | $xoopsTpl->assign('isAdmin', false); |
||||
| 153 | $xoopsTpl->assign('canEdit', false); |
||||
| 154 | } |
||||
| 155 | |||||
| 156 | //mb missing for xBootstrap templates by Angelo |
||||
| 157 | $lang = [ |
||||
| 158 | 'start' => _MD_EXTCAL_START, |
||||
| 159 | 'end' => _MD_EXTCAL_END, |
||||
| 160 | 'calmonth' => _MD_EXTCAL_NAV_CALMONTH, |
||||
| 161 | 'calweek' => _MD_EXTCAL_NAV_CALWEEK, |
||||
| 162 | 'year' => _MD_EXTCAL_NAV_YEAR, |
||||
| 163 | 'month' => _MD_EXTCAL_NAV_MONTH, |
||||
| 164 | 'week' => _MD_EXTCAL_NAV_WEEK, |
||||
| 165 | 'day' => _MD_EXTCAL_NAV_DAY, |
||||
| 166 | 'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
||||
| 167 | 'agendaday' => _MD_EXTCAL_NAV_AGENDA_DAY, |
||||
| 168 | 'search' => _MD_EXTCAL_NAV_SEARCH, |
||||
| 169 | 'newevent' => _MD_EXTCAL_NAV_NEW_EVENT, |
||||
| 170 | ]; |
||||
| 171 | |||||
| 172 | // Assigning language data to the template |
||||
| 173 | $xoopsTpl->assign('lang', $lang); |
||||
| 174 | $xoopsTpl->assign('view', 'month'); |
||||
| 175 | |||||
| 176 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 177 |