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 Xmf\Request; |
||||||
| 21 | use XoopsModules\Extcal\{Helper, |
||||||
| 22 | CategoryHandler, |
||||||
| 23 | EventHandler, |
||||||
| 24 | Utility |
||||||
| 25 | }; |
||||||
| 26 | |||||||
| 27 | require_once __DIR__ . '/include/constantes.php'; |
||||||
| 28 | $params = ['view' => _EXTCAL_NAV_YEAR, 'file' => _EXTCAL_FILE_YEAR]; |
||||||
| 29 | $GLOBALS['xoopsOption']['template_main'] = "extcal_view_{$params['view']}.tpl"; |
||||||
| 30 | require_once __DIR__ . '/header.php'; |
||||||
| 31 | |||||||
| 32 | global $xoopsUser, $xoopsTpl; |
||||||
| 33 | |||||||
| 34 | /** @var Helper $helper */ |
||||||
| 35 | $helper = Helper::getInstance(); |
||||||
| 36 | |||||||
| 37 | /* ========================================================================== */ |
||||||
| 38 | $year = \Xmf\Request::getInt('year', date('Y'), 'GET'); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 39 | $cat = \Xmf\Request::getInt('cat', 0, 'GET'); |
||||||
| 40 | |||||||
| 41 | // Getting eXtCal object's handler |
||||||
| 42 | $categoryHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT); |
||||||
| 43 | $eventHandler = Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
||||||
| 44 | |||||||
| 45 | // Tooltips include |
||||||
| 46 | /** @var xos_opal_Theme $xoTheme */ |
||||||
| 47 | $xoTheme->addScript('modules/extcal/assets/js/ToolTips.js'); |
||||||
| 48 | $xoTheme->addStylesheet('modules/extcal/assets/css/infobulle.css'); |
||||||
| 49 | |||||||
| 50 | $form = new \XoopsSimpleForm('', 'navigSelectBox', $params['file'], 'get'); |
||||||
| 51 | $form->addElement(getListYears($year, $helper->getConfig('agenda_nb_years_before'), $helper->getConfig('agenda_nb_years_after'))); |
||||||
| 52 | |||||||
| 53 | $form->addElement(Utility::getListCategories($cat)); |
||||||
| 54 | $form->addElement(new \XoopsFormButton('', 'form_submit', _SUBMIT, 'submit')); |
||||||
| 55 | |||||||
| 56 | // Assigning the form to the template |
||||||
| 57 | $form->assign($xoopsTpl); |
||||||
| 58 | |||||||
| 59 | /**********************************************************************/ |
||||||
| 60 | // Retriving events and formatting them |
||||||
| 61 | //$events = $eventHandler->objectToArray($eventHandler->getEventYear($year, $cat), array('cat_id')); |
||||||
| 62 | $criteres = [ |
||||||
| 63 | 'periode' => _EXTCAL_EVENTS_YEAR, |
||||||
| 64 | 'year' => $year, |
||||||
| 65 | 'cat' => $cat, |
||||||
| 66 | 'externalKeys' => 'cat_id', |
||||||
| 67 | ]; |
||||||
| 68 | $events = $eventHandler->getEventsOnPeriode($criteres); |
||||||
|
0 ignored issues
–
show
The method
getEventsOnPeriode() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 69 | /**********************************************************************/ |
||||||
| 70 | $eventsArray = $events; |
||||||
| 71 | // Formating date |
||||||
| 72 | // $eventHandler->formatEventsDate($events, $helper->getConfig('event_date_year')); |
||||||
| 73 | // |
||||||
| 74 | // // Treatment for recurring event |
||||||
| 75 | // $startYear = mktime(0, 0, 0, 1, 1, $year); |
||||||
| 76 | // $endYear = mktime(23, 59, 59, 12, 31, $year); |
||||||
| 77 | // |
||||||
| 78 | // $eventsArray = []; |
||||||
| 79 | // foreach ($events as $event) { |
||||||
| 80 | // if (!$event['event_isrecur']) { |
||||||
| 81 | // // Formating date |
||||||
| 82 | // $eventHandler->formatEventDate($event, $helper->getConfig('event_date_week')); |
||||||
| 83 | // $eventsArray[] = $event; |
||||||
| 84 | // } else { |
||||||
| 85 | // $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startYear, $endYear); |
||||||
| 86 | // // Formating date |
||||||
| 87 | // $eventHandler->formatEventsDate($recurEvents, $helper->getConfig('event_date_week')); |
||||||
| 88 | // $eventsArray = array_merge($eventsArray, $recurEvents); |
||||||
| 89 | // } |
||||||
| 90 | // } |
||||||
| 91 | // |
||||||
| 92 | // // Sort event array by event start |
||||||
| 93 | // usort($eventsArray, "orderEvents"); |
||||||
| 94 | |||||||
| 95 | // $t=print_r($eventsArray,true); |
||||||
| 96 | // echo "<pre>{$t}</pre>"; |
||||||
| 97 | |||||||
| 98 | // Assigning events to the template |
||||||
| 99 | $xoopsTpl->assign('events', $eventsArray); |
||||||
| 100 | |||||||
| 101 | // Retriving categories |
||||||
| 102 | $cats = $categoryHandler->objectToArray($categoryHandler->getAllCat($xoopsUser)); |
||||||
|
0 ignored issues
–
show
The method
objectToArray() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The method
getAllCat() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 103 | |||||||
| 104 | // Assigning categories to the template |
||||||
| 105 | $xoopsTpl->assign('cats', $cats); |
||||||
| 106 | |||||||
| 107 | $prevYear = $year - 1; |
||||||
| 108 | $nexYear = $year + 1; |
||||||
| 109 | // Making navig data |
||||||
| 110 | $navig = [ |
||||||
| 111 | 'prev' => [ |
||||||
| 112 | 'uri' => 'year=' . $prevYear, |
||||||
| 113 | 'name' => $prevYear, |
||||||
| 114 | ], |
||||||
| 115 | 'this' => [ |
||||||
| 116 | 'uri' => 'year=' . $year, |
||||||
| 117 | 'name' => $year, |
||||||
| 118 | ], |
||||||
| 119 | 'next' => [ |
||||||
| 120 | 'uri' => 'year=' . $nexYear, |
||||||
| 121 | 'name' => $nexYear, |
||||||
| 122 | ], |
||||||
| 123 | ]; |
||||||
| 124 | |||||||
| 125 | // Title of the page |
||||||
| 126 | $xoopsTpl->assign('xoops_pagetitle', $helper->getModule()->getVar('name') . ' ' . $navig['this']['name']); |
||||||
| 127 | |||||||
| 128 | // Assigning navig data to the template |
||||||
| 129 | $xoopsTpl->assign('navig', $navig); |
||||||
| 130 | |||||||
| 131 | //Display tooltip |
||||||
| 132 | $xoopsTpl->assign('showInfoBulle', $helper->getConfig('showInfoBulle')); |
||||||
| 133 | $xoopsTpl->assign('showId', $helper->getConfig('showId')); |
||||||
| 134 | |||||||
| 135 | // Assigning current form navig data to the template |
||||||
| 136 | $xoopsTpl->assign('selectedCat', $cat); |
||||||
| 137 | $xoopsTpl->assign('year', $year); |
||||||
| 138 | $xoopsTpl->assign('params', $params); |
||||||
| 139 | |||||||
| 140 | $tNavBar = getNavBarTabs($params['view']); |
||||||
| 141 | $xoopsTpl->assign('tNavBar', $tNavBar); |
||||||
| 142 | $xoopsTpl->assign('list_position', $helper->getConfig('list_position')); |
||||||
| 143 | // echoArray($tNavBar,true); |
||||||
| 144 | |||||||
| 145 | //--------------------------------------------------------------- |
||||||
| 146 | if ($xoopsUser) { |
||||||
| 147 | $xoopsTpl->assign('isAdmin', $xoopsUser->isAdmin()); |
||||||
| 148 | $canEdit = false; |
||||||
| 149 | /* todo |
||||||
| 150 | $canEdit |
||||||
| 151 | = |
||||||
| 152 | $permHandler->isAllowed($xoopsUser, 'extcal_cat_edit', $event['cat']['cat_id']) |
||||||
| 153 | && $xoopsUser->getVar('uid') == $event['user']['uid']; |
||||||
| 154 | $xoopsTpl->assign('canEdit', $canEdit); |
||||||
| 155 | */ |
||||||
| 156 | } else { |
||||||
| 157 | $xoopsTpl->assign('isAdmin', false); |
||||||
| 158 | $xoopsTpl->assign('canEdit', false); |
||||||
| 159 | } |
||||||
| 160 | |||||||
| 161 | //mb missing for xBootstrap templates by Angelo |
||||||
| 162 | $lang = [ |
||||||
| 163 | 'start' => _MD_EXTCAL_START, |
||||||
| 164 | 'end' => _MD_EXTCAL_END, |
||||||
| 165 | 'calmonth' => _MD_EXTCAL_NAV_CALMONTH, |
||||||
| 166 | 'calweek' => _MD_EXTCAL_NAV_CALWEEK, |
||||||
| 167 | 'year' => _MD_EXTCAL_NAV_YEAR, |
||||||
| 168 | 'month' => _MD_EXTCAL_NAV_MONTH, |
||||||
| 169 | 'week' => _MD_EXTCAL_NAV_WEEK, |
||||||
| 170 | 'day' => _MD_EXTCAL_NAV_DAY, |
||||||
| 171 | 'agendaweek' => _MD_EXTCAL_NAV_AGENDA_WEEK, |
||||||
| 172 | 'agendaday' => _MD_EXTCAL_NAV_AGENDA_DAY, |
||||||
| 173 | 'search' => _MD_EXTCAL_NAV_SEARCH, |
||||||
| 174 | 'newevent' => _MD_EXTCAL_NAV_NEW_EVENT, |
||||||
| 175 | ]; |
||||||
| 176 | // Assigning language data to the template |
||||||
| 177 | $xoopsTpl->assign('lang', $lang); |
||||||
| 178 | $xoopsTpl->assign('view', 'year'); |
||||||
| 179 | |||||||
| 180 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||
| 181 |