if (empty($scriptProperties['startdate_date'])) { $modx->error->addField('startdate_date', $modx->lexicon('mxcalendars.err_event_req_startdate')); } if (empty($scriptProperties['startdate_time'])) { $modx->error->addField('startdate_time', $modx->lexicon('mxcalendars.err_event_req_starttime')); } if (empty($scriptProperties['enddate_date'])) { $modx->error->addField('enddate_date', $modx->lexicon('mxcalendars.err_event_req_enddate')); } if (empty($scriptProperties['enddate_time'])) { $modx->error->addField('enddate_time', $modx->lexicon('mxcalendars.err_event_req_endtime')); } //-- Both date and time are always posted back $scriptProperties['startdate'] = tstamptotime($scriptProperties['startdate_date'], $scriptProperties['startdate_time'], true); $scriptProperties['enddate'] = tstamptotime($scriptProperties['enddate_date'], $scriptProperties['enddate_time'], true); $scriptProperties['repeatenddate'] = !empty($scriptProperties['repeatenddate']) ? tstamptotime($scriptProperties['repeatenddate'], $scriptProperties['enddate_time'], true) : null; if ($scriptProperties['repeating'] == 1) { //-- Do some error checking just for repeating dates if (empty($scriptProperties['repeattype'])) { $modx->error->addField('repeattype', $modx->lexicon('mxcalendars.err_event_req_repeattype')); } else { if (empty($scriptProperties['repeaton'])) { $modx->error->addField('repeaton', $modx->lexicon('mxcalendars.err_event_req_repeaton')); } } if (empty($scriptProperties['repeatfrequency'])) { $modx->error->addField('repeatfrequency', $modx->lexicon('mxcalendars.err_event_req_repeatfrequency')); } if (empty($scriptProperties['repeatenddate'])) { $modx->error->addField('repeatenddate', $modx->lexicon('mxcalendars.err_event_req_repeatenddate')); }
} if (!$modx->user->isMember('Administrator') && empty($_DATA['context'])) { return $modx->error->failure($modx->lexicon('mxcalendars.err_event_req_context')); } // Check for external source flag if ($_DATA['feeds_id'] || $_DATA['source'] != 'local' || $_DATA['feeds_id']) { //-- Allow only the actual active flag to be updated $mxcalendar->set('active', $_DATA['active']); if ($_DATA['source'] == 'feed') { $mxcalendar->set('source', 'feed-manual-change'); } } else { //-- Both date and time are always posted back $_DATA['startdate'] = tstamptotime($_DATA['startdate_date'], $_DATA['startdate_time'], true); $_DATA['enddate'] = tstamptotime($_DATA['enddate_date'], $_DATA['enddate_time'], true); $_DATA['repeatenddate'] = !empty($_DATA['repeatenddate']) ? tstamptotime($_DATA['repeatenddate'], $_DATA['enddate_time'], true) : null; if ($_DATA['repeating'] == 1) { //-- Do some error checking just for repeating dates if (empty($_DATA['repeattype'])) { $modx->error->addField('repeattype', $modx->lexicon('mxcalendars.err_event_req_repeattype')); } else { if (empty($_DATA['repeaton'])) { $modx->error->addField('repeaton', $modx->lexicon('mxcalendars.err_event_req_repeaton')); } } if (empty($_DATA['repeatfrequency'])) { $modx->error->addField('repeatfrequency', $modx->lexicon('mxcalendars.err_event_req_repeatfrequency')); } if (empty($_DATA['repeatenddate'])) { $modx->error->addField('repeatenddate', $modx->lexicon('mxcalendars.err_event_req_repeatenddate')); }