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 | /** |
||||||||
| 13 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||||||
| 14 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||||||
| 15 | * @package extcal |
||||||||
| 16 | * @since |
||||||||
| 17 | * @author XOOPS Development Team, |
||||||||
| 18 | */ |
||||||||
| 19 | |||||||||
| 20 | use XoopsModules\Extcal\{Helper, |
||||||||
| 21 | Utility, |
||||||||
| 22 | CategoryHandler, |
||||||||
| 23 | EventHandler, |
||||||||
| 24 | Time |
||||||||
| 25 | }; |
||||||||
| 26 | use Xmf\Request; |
||||||||
| 27 | |||||||||
| 28 | require_once __DIR__ . '/include/constantes.php'; |
||||||||
| 29 | $params = ['view' => _EXTCAL_NAV_WEEK, 'file' => _EXTCAL_FILE_WEEK]; |
||||||||
| 30 | $GLOBALS['xoopsOption']['template_main'] = "extcal_view_{$params['view']}.tpl"; |
||||||||
| 31 | require_once __DIR__ . '/header.php'; |
||||||||
| 32 | |||||||||
| 33 | global $xoopsUser, $xoopsTpl; |
||||||||
| 34 | /** @var CategoryHandler $categoryHandler */ |
||||||||
| 35 | /** @var EventHandler $eventHandler */ |
||||||||
| 36 | /** @var Time $timeHandler */ |
||||||||
| 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 | // Validate the date (day, month and year) |
||||||||
| 48 | $dayTS = mktime(0, 0, 0, $month, $day, $year); |
||||||||
| 49 | |||||||||
| 50 | //$offset = $helper->getConfig('week_start_day') - date('w', $dayTS); |
||||||||
| 51 | $offset = date('w', $dayTS) + 7 - $helper->getConfig('week_start_day') < 7 ? date('w', $dayTS) + 7 - $helper->getConfig('week_start_day') : 0; |
||||||||
| 52 | |||||||||
| 53 | $dayTS -= ($offset * _EXTCAL_TS_DAY); |
||||||||
| 54 | $year = date('Y', $dayTS); |
||||||||
| 55 | $month = date('n', $dayTS); |
||||||||
| 56 | $day = date('j', $dayTS); |
||||||||
| 57 | |||||||||
| 58 | $form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get'); |
||||||||
| 59 | $form->addElement(getListYears($year, $helper->getConfig('agenda_nb_years_before'), $helper->getConfig('agenda_nb_years_after'))); |
||||||||
| 60 | $form->addElement(getListMonths($month)); |
||||||||
| 61 | $form->addElement(getListDays($day)); |
||||||||
| 62 | $form->addElement(Utility::getListCategories($cat)); |
||||||||
| 63 | $form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit')); |
||||||||
| 64 | |||||||||
| 65 | // Assigning the form to the template |
||||||||
| 66 | $form->assign($xoopsTpl); |
||||||||
| 67 | |||||||||
| 68 | /**********************************************************************/ |
||||||||
| 69 | // Retriving events and formatting them |
||||||||
| 70 | //$events = $eventHandler->objectToArray($eventHandler->getEventWeek($day, $month, $year, $cat), array('cat_id')); |
||||||||
| 71 | $criteres = [ |
||||||||
| 72 | 'periode' => _EXTCAL_EVENTS_WEEK, |
||||||||
| 73 | 'day' => $day, |
||||||||
| 74 | 'month' => $month, |
||||||||
| 75 | 'year' => $year, |
||||||||
| 76 | 'cat' => $cat, |
||||||||
| 77 | 'externalKeys' => 'cat_id', |
||||||||
| 78 | ]; |
||||||||
| 79 | $events = $eventHandler->getEventsOnPeriode($criteres); |
||||||||
| 80 | /**********************************************************************/ |
||||||||
| 81 | $eventsArray = $events; |
||||||||
| 82 | // Formating date |
||||||||
| 83 | // $eventHandler->formatEventsDate($events, $helper->getConfig('event_date_year')); |
||||||||
| 84 | // |
||||||||
| 85 | // Treatment for recurring event |
||||||||
| 86 | // $startWeek = mktime(0, 0, 0, $month, $day, $year); |
||||||||
| 87 | // $endWeek = $startWeek + _EXTCAL_TS_WEEK; |
||||||||
| 88 | // |
||||||||
| 89 | // $eventsArray = []; |
||||||||
| 90 | // foreach ($events as $event) { |
||||||||
| 91 | // if (!$event['event_isrecur']) { |
||||||||
| 92 | // // Formating date |
||||||||
| 93 | // $eventHandler->formatEventDate($event, $helper->getConfig('event_date_week')); |
||||||||
| 94 | // $eventsArray[] = $event; |
||||||||
| 95 | // } else { |
||||||||
| 96 | // $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startWeek, $endWeek); |
||||||||
| 97 | // // Formating date |
||||||||
| 98 | // $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||||||||
| 99 | // $eventsArray = array_merge($eventsArray, $recurEvents); |
||||||||
| 100 | // } |
||||||||
| 101 | // } |
||||||||
| 102 | // |
||||||||
| 103 | // Sort event array by event start |
||||||||
| 104 | // usort($eventsArray, "orderEvents"); |
||||||||
| 105 | |||||||||
| 106 | // Assigning events to the template |
||||||||
| 107 | $xoopsTpl->assign('events', $eventsArray); |
||||||||
| 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
Loading history...
$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
Loading history...
$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
Loading history...
|
|||||||||
| 116 | $pWeekCalObj = $weekCalObj->prevWeek('object'); |
||||||||
| 117 | $nWeekCalObj = $weekCalObj->nextWeek('object'); |
||||||||
| 118 | $navig = [ |
||||||||
| 119 | 'prev' => [ |
||||||||
| 120 | 'uri' => 'year=' . $pWeekCalObj->thisYear() . '&month=' . $pWeekCalObj->thisMonth() . '&day=' . $pWeekCalObj->thisDay(), |
||||||||
| 121 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $pWeekCalObj->getTimestamp()), |
||||||||
| 122 | ], |
||||||||
| 123 | 'this' => [ |
||||||||
| 124 | 'uri' => 'year=' . $weekCalObj->thisYear() . '&month=' . $weekCalObj->thisMonth() . '&day=' . $weekCalObj->thisDay(), |
||||||||
| 125 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $weekCalObj->getTimestamp()), |
||||||||
| 126 | ], |
||||||||
| 127 | 'next' => [ |
||||||||
| 128 | 'uri' => 'year=' . $nWeekCalObj->thisYear() . '&month=' . $nWeekCalObj->thisMonth() . '&day=' . $nWeekCalObj->thisDay(), |
||||||||
| 129 | 'name' => $timeHandler->getFormatedDate($helper->getConfig('nav_date_week'), $nWeekCalObj->getTimestamp()), |
||||||||
| 130 | ], |
||||||||
| 131 | ]; |
||||||||
| 132 | |||||||||
| 133 | // Title of the page |
||||||||
| 134 | $xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . $navig['this']['name']); |
||||||||
| 135 | |||||||||
| 136 | // Assigning navig data to the template |
||||||||
| 137 | $xoopsTpl->assign('navig', $navig); |
||||||||
| 138 | |||||||||
| 139 | //Display tooltip |
||||||||
| 140 | $xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle')); |
||||||||
| 141 | $xoopsTpl->assign('showId', $helper->getConfig('showId')); |
||||||||
| 142 | |||||||||
| 143 | // Assigning current form navig data to the template |
||||||||
| 144 | $xoopsTpl->assign('selectedCat', $cat); |
||||||||
| 145 | $xoopsTpl->assign('year', $year); |
||||||||
| 146 | $xoopsTpl->assign('month', $month); |
||||||||
| 147 | $xoopsTpl->assign('day', $day); |
||||||||
| 148 | $xoopsTpl->assign('params', $params); |
||||||||
| 149 | |||||||||
| 150 | $tNavBar = getNavBarTabs($params['view']); |
||||||||
| 151 | $xoopsTpl->assign('tNavBar', $tNavBar); |
||||||||
| 152 | $xoopsTpl->assign('list_position', $helper->getConfig('list_position')); |
||||||||
| 153 | // echoArray($tNavBar,true); |
||||||||
| 154 | |||||||||
| 155 | //--------------------------------------------------------------- |
||||||||
| 156 | if ($xoopsUser) { |
||||||||
| 157 | $xoopsTpl->assign('isAdmin', $xoopsUser->isAdmin()); |
||||||||
| 158 | $canEdit = false; |
||||||||
| 159 | /* todo |
||||||||
| 160 | $canEdit |
||||||||
| 161 | = |
||||||||
| 162 | $permHandler->isAllowed($xoopsUser, 'extcal_cat_edit', $event['cat']['cat_id']) |
||||||||
| 163 | && $xoopsUser->getVar('uid') == $event['user']['uid']; |
||||||||
| 164 | $xoopsTpl->assign('canEdit', $canEdit); |
||||||||
| 165 | */ |
||||||||
| 166 | } else { |
||||||||
| 167 | $xoopsTpl->assign('isAdmin', false); |
||||||||
| 168 | $xoopsTpl->assign('canEdit', false); |
||||||||
| 169 | } |
||||||||
| 170 | /** @var xos_opal_Theme $xoTheme */ |
||||||||
| 171 | $xoTheme->addScript('browse.php?modules/extcal/assets/js/highslide.js'); |
||||||||
| 172 | $xoTheme->addStylesheet('browse.php?modules/extcal/assets/js/highslide.css'); |
||||||||
| 173 | |||||||||
| 174 | //mb missing for xBootstrap templates by Angelo |
||||||||
| 175 | $lang = [ |
||||||||
| 176 | 'start' => _MD_EXTCAL_START, |
||||||||
| 177 | 'end' => _MD_EXTCAL_END, |
||||||||
| 178 | 'calmonth' => _MD_EXTCAL_NAV_CALMONTH, |
||||||||
| 179 | 'calweek' => _MD_EXTCAL_NAV_CALWEEK, |
||||||||
| 180 | 'year' => _MD_EXTCAL_NAV_YEAR, |
||||||||
| 181 | 'month' => _MD_EXTCAL_NAV_MONTH, |
||||||||
| 182 | 'week' => _MD_EXTCAL_NAV_WEEK, |
||||||||
| 183 | 'day' => _MD_EXTCAL_NAV_DAY, |
||||||||
| 184 | 'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
||||||||
| 185 | 'agendaday' => _MD_EXTCAL_NAV_AGENDA_DAY, |
||||||||
| 186 | 'search' => _MD_EXTCAL_NAV_SEARCH, |
||||||||
| 187 | 'newevent' => _MD_EXTCAL_NAV_NEW_EVENT, |
||||||||
| 188 | ]; |
||||||||
| 189 | |||||||||
| 190 | // Assigning language data to the template |
||||||||
| 191 | $xoopsTpl->assign('lang', $lang); |
||||||||
| 192 | $xoopsTpl->assign('view', 'week'); |
||||||||
| 193 | |||||||||
| 194 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||||
| 195 |