mambax7 /
extcal
| 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 http://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; |
||
| 21 | |||
| 22 | include __DIR__ . '/../../mainfile.php'; |
||
| 23 | $GLOBALS['xoopsOption']['template_main'] = 'extcal_post.tpl'; |
||
| 24 | |||
| 25 | include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 26 | //include __DIR__ . '/class/form/extcalform.php'; |
||
| 27 | //include __DIR__ . '/class/perm.php'; |
||
| 28 | |||
| 29 | require_once __DIR__ . '/class/Utility.php'; |
||
| 30 | require_once __DIR__ . '/include/constantes.php'; |
||
| 31 | |||
| 32 | $permHandler = Extcal\Perm::getHandler(); |
||
| 33 | $xoopsUser = $xoopsUser ?: null; |
||
| 34 | |||
| 35 | if (!$permHandler->isAllowed($xoopsUser, 'extcal_cat_submit', (int)$_POST['cat_id'])) { |
||
| 36 | redirect_header('index.php', 3); |
||
| 37 | } |
||
| 38 | |||
| 39 | // Getting eXtCal object's handler |
||
| 40 | /** @var Extcal\EventHandler $eventHandler */ |
||
| 41 | $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT); |
||
| 42 | |||
| 43 | if (isset($_POST['form_preview'])) { |
||
| 44 | include XOOPS_ROOT_PATH . '/header.php'; |
||
| 45 | |||
| 46 | // Title of the page |
||
| 47 | $xoopsTpl->assign('xoops_pagetitle', _MI_EXTCAL_SUBMIT_EVENT); |
||
| 48 | |||
| 49 | $data = [ |
||
| 50 | 'event_title' => $_POST['event_title'], |
||
| 51 | 'cat_id' => (int)$_POST['cat_id'], |
||
| 52 | 'event_desc' => $_POST['event_desc'], |
||
| 53 | 'event_nbmember' => (int)$_POST['event_nbmember'], |
||
| 54 | 'event_contact' => $_POST['event_contact'], |
||
| 55 | 'event_url' => $_POST['event_url'], |
||
| 56 | 'event_email' => $_POST['event_email'], |
||
| 57 | 'event_address' => $_POST['event_address'], |
||
| 58 | 'event_approved' => 1, |
||
| 59 | 'event_start' => $_POST['event_start'], |
||
| 60 | 'have_end' => $_POST['have_end'], |
||
| 61 | 'event_end' => $_POST['event_end'], |
||
| 62 | 'dohtml' => (int)$xoopsModuleConfig['allow_html'], |
||
| 63 | 'event_price' => $_POST['event_price'], |
||
| 64 | 'event_organisateur' => $_POST['event_organisateur'], |
||
| 65 | 'event_icone' => $_POST['event_icone'], |
||
| 66 | ]; |
||
| 67 | |||
| 68 | if (isset($_POST['event_id'])) { |
||
| 69 | $data['event_id'] = (int)$_POST['event_id']; |
||
| 70 | } |
||
| 71 | |||
| 72 | // Creating tempory event object to apply Object data filtering |
||
| 73 | $event = $eventHandler->createEventForPreview($data); |
||
| 74 | $event = $eventHandler->objectToArray($event, ['cat_id'], 'p'); |
||
| 75 | |||
| 76 | // Adding formated date for start and end event |
||
| 77 | $eventHandler->formatEventDate($event, $xoopsModuleConfig['event_date_event']); |
||
| 78 | |||
| 79 | // Assigning event to the template |
||
| 80 | $xoopsTpl->assign('event', $event); |
||
| 81 | |||
| 82 | // $lang = array( |
||
| 83 | // 'start' => _MD_EXTCAL_START, 'end' => _MD_EXTCAL_END, 'contact_info' => _MD_EXTCAL_CONTACT_INFO, 'email' => _MD_EXTCAL_EMAIL, 'url' => _MD_EXTCAL_URL, 'whos_going' => _MD_EXTCAL_WHOS_GOING, 'whosnot_going' => _MD_EXTCAL_WHOSNOT_GOING |
||
| 84 | // ); |
||
| 85 | // // Assigning language data to the template |
||
| 86 | // $xoopsTpl->assign('lang', $lang); |
||
| 87 | |||
| 88 | $event['cat_id'] = (int)$_POST['cat_id']; |
||
| 89 | $event['have_end'] = $_POST['have_end']; |
||
| 90 | |||
| 91 | // Display the submit form |
||
| 92 | /** @var Extcal\Form\ThemeForm $form */ |
||
| 93 | $form = $eventHandler->getEventForm('user', 'preview', $event); |
||
| 94 | $formBody = $form->render(); |
||
| 95 | $xoopsTpl->assign('preview', true); |
||
| 96 | $xoopsTpl->assign('formBody', $formBody); |
||
| 97 | |||
| 98 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
| 99 | } elseif (isset($_POST['form_submit'])) { |
||
| 100 | if (!isset($_POST['rrule_weekly_interval'])) { |
||
| 101 | $_POST['rrule_weekly_interval'] = 0; |
||
| 102 | } |
||
| 103 | // Extcal\Utility::echoArray($_POST, '',true); |
||
| 104 | // exit; |
||
| 105 | // $ts = print_r($_POST,true); |
||
| 106 | // echo "<pre>{$ts}</pre>"; |
||
| 107 | // If the date format is wrong |
||
| 108 | // if ( |
||
| 109 | // !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_start']['date']) |
||
| 110 | // || !preg_match(_EXTCAL_MOTIF_DATE, $_POST['event_end']['date']) |
||
| 111 | // ) { |
||
| 112 | // redirect_header( |
||
| 113 | // 'index.php', 3, _MD_EXTCAL_WRONG_DATE_FORMAT . "<br>" |
||
| 114 | // . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()) |
||
| 115 | // ); |
||
| 116 | // exit; |
||
| 117 | // } |
||
| 118 | /////////////////////////////////////////////////////////////////////////////// |
||
| 119 | Extcal\Utility::loadImg($_REQUEST, $event_picture1, $event_picture2); |
||
| 120 | /////////////////////////////////////////////////////////////////////////////// |
||
| 121 | |||
| 122 | require_once __DIR__ . '/class/perm.php'; |
||
| 123 | |||
| 124 | /** @var Extcal\FileHandler $fileHandler */ |
||
| 125 | $fileHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_FILE); |
||
| 126 | $permHandler = Extcal\Perm::getHandler(); |
||
| 127 | $approve = $permHandler->isAllowed($xoopsUser, 'extcal_cat_autoapprove', (int)$_POST['cat_id']); |
||
| 128 | |||
| 129 | $data = [ |
||
| 130 | 'event_title' => $_POST['event_title'], |
||
| 131 | 'cat_id' => $_POST['cat_id'], |
||
| 132 | 'event_desc' => $_POST['event_desc'], |
||
| 133 | 'event_nbmember' => $_POST['event_nbmember'], |
||
| 134 | 'event_organisateur' => $_POST['event_organisateur'], |
||
| 135 | 'event_contact' => $_POST['event_contact'], |
||
| 136 | 'event_url' => $_POST['event_url'], |
||
| 137 | 'event_email' => $_POST['event_email'], |
||
| 138 | 'event_address' => $_POST['event_address'], |
||
| 139 | 'event_approved' => (false === $approve) ? 0 : 1, |
||
| 140 | 'event_start' => $_POST['event_start'], |
||
| 141 | 'have_end' => $_POST['have_end'], |
||
| 142 | 'event_end' => $_POST['event_end'], |
||
| 143 | 'event_picture1' => @$event_picture1, |
||
| 144 | 'event_picture2' => @$event_picture2, |
||
| 145 | 'event_price' => @$_POST['event_price'], |
||
| 146 | 'event_etablissement' => $_POST['event_etablissement'], |
||
| 147 | 'dohtml' => $xoopsModuleConfig['allow_html'], |
||
| 148 | 'event_icone' => $_POST['event_icone'], |
||
| 149 | |||
| 150 | ]; |
||
| 151 | |||
| 152 | if (isset($_POST['event_id'])) { |
||
| 153 | $eventHandler->modifyEvent((int)$_POST['event_id'], $data); |
||
| 154 | $fileHandler->updateEventFile((int)$_POST['event_id']); |
||
| 155 | $fileHandler->createFile((int)$_POST['event_id']); |
||
| 156 | |||
| 157 | redirect_header('event.php?event=' . $_POST['event_id'], 3, _MD_EXTCAL_EVENT_UPDATED, false); |
||
| 158 | } else { |
||
| 159 | $data['event_submitter'] = $xoopsUser ? $xoopsUser->getVar('uid') : 0; |
||
|
0 ignored issues
–
show
|
|||
| 160 | $data['event_submitdate'] = time(); |
||
| 161 | |||
| 162 | $eventHandler->createEvent($data); |
||
| 163 | $fileHandler->createFile($eventHandler->getInsertId()); |
||
| 164 | |||
| 165 | $notifyEvent = 'new_event'; |
||
| 166 | if (!$approve) { |
||
| 167 | $notifyEvent = 'new_event_pending'; |
||
| 168 | } |
||
| 169 | |||
| 170 | /** @var \XoopsNotificationHandler $notificationHandler */ |
||
| 171 | $notificationHandler = xoops_getHandler('notification'); |
||
| 172 | $notificationHandler->triggerEvent('global', 0, $notifyEvent, ['EVENT_TITLE' => $_POST['event_title']]); |
||
| 173 | if (1 == $approve) { |
||
| 174 | // $catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE); |
||
| 175 | $catHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT); |
||
| 176 | $cat = $catHandler->getCat((int)$_POST['cat_id'], $xoopsUser, 'all'); |
||
| 177 | $notificationHandler->triggerEvent('cat', (int)$_POST['cat_id'], 'new_event_cat', [ |
||
| 178 | 'EVENT_TITLE' => $_POST['event_title'], |
||
| 179 | 'CAT_NAME' => $cat->getVar('cat_name'), |
||
| 180 | ]); |
||
| 181 | } |
||
| 182 | } |
||
| 183 | |||
| 184 | if ($approve) { |
||
| 185 | redirect_header(_EXTCAL_FILE_CALMONTH, 3, _MD_EXTCAL_EVENT_CREATED, false); |
||
| 186 | } else { |
||
| 187 | redirect_header(_EXTCAL_FILE_CALMONTH, 3, _MD_EXTCAL_EVENT_PENDING, false); |
||
| 188 | } |
||
| 189 | } |
||
| 190 |
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.