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 | * You may not change or alter any portion of this comment or credits |
||
| 4 | * of supporting developers from this source code or any supporting source code |
||
| 5 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | * |
||
| 7 | * This program is distributed in the hope that it will be useful, |
||
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | use XoopsModules\Extcal\{Helper, |
||
| 13 | Utility, |
||
| 14 | CategoryHandler, |
||
| 15 | EventHandler |
||
| 16 | }; |
||
| 17 | use Xmf\Request; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 21 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||
| 22 | * @package extcal |
||
| 23 | * @since |
||
| 24 | * @author XOOPS Development Team, |
||
| 25 | */ |
||
| 26 | |||
| 27 | require_once __DIR__ . '/include/constantes.php'; |
||
| 28 | $params = ['view' => _EXTCAL_NAV_DAY, 'file' => _EXTCAL_FILE_DAY]; |
||
| 29 | $GLOBALS['xoopsOption']['template_main'] = "extcal_view_{$params['view']}.tpl"; |
||
| 30 | require_once __DIR__ . '/header.php'; |
||
| 31 | |||
| 32 | global $xoopsUser, $xoopsTpl; |
||
| 33 | |||
| 34 | /** @var Time $timeHandler */ |
||
| 35 | /** @var CategoryHandler $categoryHandler */ |
||
| 36 | /** @var EventHandler $eventHandler */ |
||
| 37 | /** @var Helper $helper */ |
||
| 38 | $helper = Helper::getInstance(); |
||
| 39 | |||
| 40 | /* ========================================================================== */ |
||
| 41 | $year = Request::getInt('year', date('Y'), 'GET'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 42 | $month = Request::getInt('month', date('n'), 'GET'); |
||
| 43 | $day = Request::getInt('day', date('j'), 'GET'); |
||
| 44 | $cat = Request::getInt('cat', 0, 'GET'); |
||
| 45 | /* ========================================================================== */ |
||
| 46 | |||
| 47 | $form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get'); |
||
| 48 | $form->addElement(getListYears($year, $helper->getConfig('agenda_nb_years_before'), $helper->getConfig('agenda_nb_years_after'))); |
||
| 49 | $form->addElement(getListMonths($month)); |
||
| 50 | $form->addElement(getListDays($day)); |
||
| 51 | $form->addElement(Utility::getListCategories($cat)); |
||
| 52 | $form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit')); |
||
| 53 | |||
| 54 | // Assigning the form to the template |
||
| 55 | $form->assign($xoopsTpl); |
||
| 56 | |||
| 57 | /**********************************************************************/ |
||
| 58 | // Retriving events and formatting them |
||
| 59 | //$events = $eventHandler->objectToArray($eventHandler->getEventDay($day, $month, $year, $cat), array('cat_id')); |
||
| 60 | $criteres = [ |
||
| 61 | 'periode' => _EXTCAL_EVENTS_DAY, |
||
| 62 | 'day' => $day, |
||
| 63 | 'month' => $month, |
||
| 64 | 'year' => $year, |
||
| 65 | 'cat' => $cat, |
||
| 66 | 'externalKeys' => 'cat_id', |
||
| 67 | ]; |
||
| 68 | $events = $eventHandler->getEventsOnPeriode($criteres); |
||
| 69 | /**********************************************************************/ |
||
| 70 | $eventsArray = $events; |
||
| 71 | |||
| 72 | // Formating date |
||
| 73 | //$eventHandler->formatEventsDate($events, $helper->getConfig('event_date_year')); |
||
| 74 | |||
| 75 | // Treatment for recurring event |
||
| 76 | // $startDay = mktime(0, 0, 0, $month, $day, $year); |
||
| 77 | // $endDay = $startDay + _EXTCAL_TS_DAY; |
||
| 78 | //$eventsArray = []; |
||
| 79 | |||
| 80 | // foreach ($events as $event) { |
||
| 81 | // |
||
| 82 | // if (!$event['event_isrecur']) { |
||
| 83 | // // Formating date |
||
| 84 | // $eventHandler->formatEventDate($event, $helper->getConfig('event_date_week')); |
||
| 85 | // $eventsArray[] = $event; |
||
| 86 | // } else { |
||
| 87 | // $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startDay, $endDay); |
||
| 88 | // // Formating date |
||
| 89 | // $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||
| 90 | // $eventsArray = array_merge($eventsArray, $recurEvents); |
||
| 91 | // |
||
| 92 | // } |
||
| 93 | // |
||
| 94 | // } |
||
| 95 | |||
| 96 | // Sort event array by event start |
||
| 97 | // usort($eventsArray, "orderEvents"); |
||
| 98 | |||
| 99 | // Assigning events to the template |
||
| 100 | $xoopsTpl->assign('events', $eventsArray); |
||
| 101 | |||
| 102 | // Retriving categories |
||
| 103 | $cats = $categoryHandler->objectToArray($categoryHandler->getAllCat($xoopsUser)); |
||
| 104 | // Assigning categories to the template |
||
| 105 | $xoopsTpl->assign('cats', $cats); |
||
| 106 | |||
| 107 | // Making navig data |
||
| 108 | $dayCalObj = new Calendar_Day($year, $month, $day); |
||
| 109 | $pDayCalObj = $dayCalObj->prevDay('object'); |
||
| 110 | $nDayCalObj = $dayCalObj->nextDay('object'); |
||
| 111 | |||
| 112 | $navig = [ |
||
| 113 | 'prev' => [ |
||
| 114 | 'uri' => 'year=' . $pDayCalObj->thisYear() . '&month=' . $pDayCalObj->thisMonth() . '&day=' . $pDayCalObj->thisDay(), |
||
| 115 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_day'), $pDayCalObj->getTimestamp()), |
||
| 116 | ], |
||
| 117 | 'this' => [ |
||
| 118 | 'uri' => 'year=' . $dayCalObj->thisYear() . '&month=' . $dayCalObj->thisMonth() . '&day=' . $dayCalObj->thisDay(), |
||
| 119 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_day'), $dayCalObj->getTimestamp()), |
||
| 120 | ], |
||
| 121 | 'next' => [ |
||
| 122 | 'uri' => 'year=' . $nDayCalObj->thisYear() . '&month=' . $nDayCalObj->thisMonth() . '&day=' . $nDayCalObj->thisDay(), |
||
| 123 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_day'), $nDayCalObj->getTimestamp()), |
||
| 124 | ], |
||
| 125 | ]; |
||
| 126 | |||
| 127 | // Title of the page |
||
| 128 | $xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . $navig['this']['name']); |
||
| 129 | |||
| 130 | // Assigning navig data to the template |
||
| 131 | $xoopsTpl->assign('navig', $navig); |
||
| 132 | |||
| 133 | //Display tooltip |
||
| 134 | $xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle')); |
||
| 135 | $xoopsTpl->assign('showId', $helper->getConfig('showId')); |
||
| 136 | |||
| 137 | // Assigning current form navig data to the template |
||
| 138 | $xoopsTpl->assign('selectedCat', $cat); |
||
| 139 | $xoopsTpl->assign('year', $year); |
||
| 140 | $xoopsTpl->assign('month', $month); |
||
| 141 | $xoopsTpl->assign('day', $day); |
||
| 142 | $xoopsTpl->assign('params', $params); |
||
| 143 | |||
| 144 | $tNavBar = getNavBarTabs($params['view']); |
||
| 145 | $xoopsTpl->assign('tNavBar', $tNavBar); |
||
| 146 | $xoopsTpl->assign('list_position', $helper->getConfig('list_position')); |
||
| 147 | // echoArray($tNavBar,true); |
||
| 148 | //--------------------------------------------------------------- |
||
| 149 | if ($xoopsUser) { |
||
| 150 | $xoopsTpl->assign('isAdmin', $xoopsUser->isAdmin()); |
||
| 151 | $canEdit = false; |
||
| 152 | /* todo |
||
| 153 | $canEdit |
||
| 154 | = |
||
| 155 | $permHandler->isAllowed($xoopsUser, 'extcal_cat_edit', $event['cat']['cat_id']) |
||
| 156 | && $xoopsUser->getVar('uid') == $event['user']['uid']; |
||
| 157 | $xoopsTpl->assign('canEdit', $canEdit); |
||
| 158 | */ |
||
| 159 | } else { |
||
| 160 | $xoopsTpl->assign('isAdmin', false); |
||
| 161 | $xoopsTpl->assign('canEdit', false); |
||
| 162 | } |
||
| 163 | /** @var xos_opal_Theme $xoTheme */ |
||
| 164 | $xoTheme->addScript('browse.php?modules/extcal/assets/js/highslide.js'); |
||
| 165 | $xoTheme->addStylesheet('browse.php?modules/extcal/assets/js/highslide.css'); |
||
| 166 | |||
| 167 | //mb missing for xBootstrap templates by Angelo |
||
| 168 | $lang = [ |
||
| 169 | 'start' => _MD_EXTCAL_START, |
||
| 170 | 'end' => _MD_EXTCAL_END, |
||
| 171 | 'calmonth' => _MD_EXTCAL_NAV_CALMONTH, |
||
| 172 | 'calweek' => _MD_EXTCAL_NAV_CALWEEK, |
||
| 173 | 'year' => _MD_EXTCAL_NAV_YEAR, |
||
| 174 | 'month' => _MD_EXTCAL_NAV_MONTH, |
||
| 175 | 'week' => _MD_EXTCAL_NAV_WEEK, |
||
| 176 | 'day' => _MD_EXTCAL_NAV_DAY, |
||
| 177 | 'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
||
| 178 | 'agendaday' => _MD_EXTCAL_NAV_AGENDA_DAY, |
||
| 179 | 'search' => _MD_EXTCAL_NAV_SEARCH, |
||
| 180 | 'newevent' => _MD_EXTCAL_NAV_NEW_EVENT, |
||
| 181 | ]; |
||
| 182 | |||
| 183 | // Assigning language data to the template |
||
| 184 | $xoopsTpl->assign('lang', $lang); |
||
| 185 | $xoopsTpl->assign('view', 'day'); |
||
| 186 | |||
| 187 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 188 |