/** * Shows event editor * * @param string $mode Indicates if this is a submission or a regular entry * @param array $A array holding the event's details * @param string $msg an optional error message to display * @return string HTML for event editor or error message * */ function CALENDAR_editEvent($mode, $A, $msg = '') { global $_CONF, $_GROUPS, $_TABLES, $_USER, $_CA_CONF, $LANG_CAL_1, $LANG_CAL_ADMIN, $LANG10, $LANG12, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS; // Loads jQuery UI datepicker and timepicker-addon $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider'); $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon'); $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n'); $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js'); // Add JavaScript $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js'); $langCode = COM_getLangIso639Code(); $toolTip = $MESSAGE[118]; $imgUrl = $_CONF['site_url'] . '/images/calendar.png'; $_SCRIPTS->setJavaScript("jQuery(function () {" . " geeklog.hour_mode = {$_CONF['hour_mode']};" . " geeklog.datetimepicker.options.stepMinute = 15;" . " geeklog.datetimepicker.set('start', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . " geeklog.datetimepicker.set('end', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE); $retval = ''; if (!empty($msg)) { $retval .= COM_showMessageText($msg, $LANG_CAL_ADMIN[2]); } $event_templates = COM_newTemplate(CTL_plugin_templatePath('calendar', 'admin')); $event_templates->set_file('editor', 'eventeditor.thtml'); $allowed = ''; foreach (array('plaintext', 'html') as $pm) { $allowed .= COM_allowedHTML('calendar.edit', false, 1, $pm); } $allowed .= COM_allowedAutotags(); $event_templates->set_var('lang_allowed_html', $allowed); $event_templates->set_var('lang_postmode', $LANG_CAL_ADMIN[3]); if ($mode != 'editsubmission' and !empty($A['eid'])) { // Get what level of access user has to this object $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']); if ($access == 0 or $access == 2) { // Uh, oh! User doesn't have access to this object $retval .= COM_showMessageText($LANG_CAL_ADMIN[17], $LANG_ACCESS['accessdenied']); COM_accessLog("User {$_USER['username']} tried to illegally submit or edit event {$eid}."); return $retval; } } else { if (empty($A['owner_id'])) { $A['owner_id'] = $_USER['uid']; } if (isset($_GROUPS['Calendar Admin'])) { $A['group_id'] = $_GROUPS['Calendar Admin']; } else { $A['group_id'] = SEC_getFeatureGroup('calendar.edit'); } SEC_setDefaultPermissions($A, $_CA_CONF['default_permissions']); $access = 3; } if ($mode == 'editsubmission') { $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', 'plaintext')); } else { if (!isset($A['postmode'])) { $A['postmode'] = $_CONF['postmode']; } $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', $A['postmode'])); } $token = SEC_createToken(); $retval .= COM_startBlock($LANG_CAL_ADMIN[1], '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= SEC_getTokenExpiryNotice($token); if (!empty($A['eid'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $event_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $event_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); $event_templates->set_var('allow_delete', true); $event_templates->set_var('lang_delete', $LANG_ADMIN['delete']); $event_templates->set_var('confirm_message', $MESSAGE[76]); if ($mode == 'editsubmission') { $event_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>'); } } else { // new event $A['eid'] = COM_makesid(); $A['title'] = ''; $A['description'] = ''; $A['url'] = ''; $A['hits'] = 0; // in case a start date/time has been passed from the calendar, // pick it up for the end date/time if (empty($A['dateend'])) { $A['dateend'] = $A['datestart']; } if (empty($A['timeend'])) { $A['timeend'] = $A['timestart']; } $A['event_type'] = ''; $A['location'] = ''; $A['address1'] = ''; $A['address2'] = ''; $A['city'] = ''; $A['state'] = ''; $A['zipcode'] = ''; $A['allday'] = 0; } $event_templates->set_var('lang_eventid', $LANG_CAL_ADMIN[34]); $event_templates->set_var('event_id', $A['eid']); $event_templates->set_var('lang_eventtitle', $LANG_ADMIN['title']); $A['title'] = str_replace('{', '{', $A['title']); $A['title'] = str_replace('}', '}', $A['title']); $A['title'] = str_replace('"', '"', $A['title']); $event_templates->set_var('event_title', stripslashes($A['title'])); $event_templates->set_var('lang_eventtype', $LANG_CAL_1[37]); $event_templates->set_var('lang_editeventtypes', $LANG12[50]); $event_templates->set_var('type_options', CALENDAR_eventTypeList($A['event_type'])); $event_templates->set_var('lang_eventurl', $LANG_CAL_ADMIN[4]); $event_templates->set_var('max_url_length', 255); $event_templates->set_var('event_url', $A['url']); $event_templates->set_var('lang_includehttp', $LANG_CAL_ADMIN[9]); $event_templates->set_var('lang_eventstartdate', $LANG_CAL_ADMIN[5]); //$event_templates->set_var('event_startdate', $A['datestart']); $event_templates->set_var('lang_starttime', $LANG_CAL_1[30]); // Combine date/time for easier manipulation $A['datestart'] = trim($A['datestart'] . ' ' . $A['timestart']); if (empty($A['datestart'])) { $start_stamp = time(); } else { $start_stamp = strtotime($A['datestart']); } $A['dateend'] = trim($A['dateend'] . ' ' . $A['timeend']); if (empty($A['dateend'])) { $end_stamp = time(); } else { $end_stamp = strtotime($A['dateend']); } $start_month = date('m', $start_stamp); $start_day = date('d', $start_stamp); $start_year = date('Y', $start_stamp); $end_month = date('m', $end_stamp); $end_day = date('d', $end_stamp); $end_year = date('Y', $end_stamp); $start_hour = date('H', $start_stamp); $start_minute = intval(date('i', $start_stamp) / 15) * 15; if ($start_hour >= 12) { $startampm = 'pm'; } else { $startampm = 'am'; } $start_hour_24 = $start_hour % 24; if ($start_hour > 12) { $start_hour = $start_hour - 12; } else { if ($start_hour == 0) { $start_hour = 12; } } $end_hour = date('H', $end_stamp); $end_minute = intval(date('i', $end_stamp) / 15) * 15; if ($end_hour >= 12) { $endampm = 'pm'; } else { $endampm = 'am'; } $end_hour_24 = $end_hour % 24; if ($end_hour > 12) { $end_hour = $end_hour - 12; } else { if ($end_hour == 0) { $end_hour = 12; } } $month_options = COM_getMonthFormOptions($start_month); $event_templates->set_var('startmonth_options', $month_options); $month_options = COM_getMonthFormOptions($end_month); $event_templates->set_var('endmonth_options', $month_options); $day_options = COM_getDayFormOptions($start_day); $event_templates->set_var('startday_options', $day_options); $day_options = COM_getDayFormOptions($end_day); $event_templates->set_var('endday_options', $day_options); $year_options = COM_getYearFormOptions($start_year); $event_templates->set_var('startyear_options', $year_options); $year_options = COM_getYearFormOptions($end_year); $event_templates->set_var('endyear_options', $year_options); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($start_hour_24, 24); $event_templates->set_var('starthour_options', $hour_options); $hour_options = COM_getHourFormOptions($end_hour_24, 24); $event_templates->set_var('endhour_options', $hour_options); $event_templates->set_var('hour_mode', 24); } else { $hour_options = COM_getHourFormOptions($start_hour); $event_templates->set_var('starthour_options', $hour_options); $hour_options = COM_getHourFormOptions($end_hour); $event_templates->set_var('endhour_options', $hour_options); $event_templates->set_var('hour_mode', 12); } $event_templates->set_var('startampm_selection', COM_getAmPmFormSelection('start_ampm', $startampm)); $event_templates->set_var('endampm_selection', COM_getAmPmFormSelection('end_ampm', $endampm)); $event_templates->set_var('startminute_options', COM_getMinuteFormOptions($start_minute, 15)); $event_templates->set_var('endminute_options', COM_getMinuteFormOptions($end_minute, 15)); $event_templates->set_var('lang_enddate', $LANG12[13]); $event_templates->set_var('lang_eventenddate', $LANG_CAL_ADMIN[6]); $event_templates->set_var('event_enddate', $A['dateend']); $event_templates->set_var('lang_enddate', $LANG12[13]); $event_templates->set_var('lang_endtime', $LANG_CAL_1[29]); $event_templates->set_var('lang_alldayevent', $LANG_CAL_1[31]); if ($A['allday'] == 1) { $event_templates->set_var('allday_checked', 'checked="checked"'); } $event_templates->set_var('lang_location', $LANG12[51]); $event_templates->set_var('event_location', stripslashes($A['location'])); $event_templates->set_var('lang_addressline1', $LANG12[44]); $event_templates->set_var('event_address1', stripslashes($A['address1'])); $event_templates->set_var('lang_addressline2', $LANG12[45]); $event_templates->set_var('event_address2', stripslashes($A['address2'])); $event_templates->set_var('lang_city', $LANG12[46]); $event_templates->set_var('event_city', stripslashes($A['city'])); $event_templates->set_var('lang_state', $LANG12[47]); $event_templates->set_var('state_options', ''); $event_templates->set_var('event_state', stripslashes($A['state'])); $event_templates->set_var('lang_zipcode', $LANG12[48]); $event_templates->set_var('event_zipcode', $A['zipcode']); $event_templates->set_var('lang_eventlocation', $LANG_CAL_ADMIN[7]); $event_templates->set_var('event_location', stripslashes($A['location'])); $event_templates->set_var('lang_eventdescription', $LANG_CAL_ADMIN[8]); $event_templates->set_var('event_description', stripslashes($A['description'])); $event_templates->set_var('lang_hits', $LANG10[30]); $event_templates->set_var('hits', COM_numberFormat($A['hits'])); $event_templates->set_var('lang_save', $LANG_ADMIN['save']); $event_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); // user access info $event_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $event_templates->set_var('lang_owner', $LANG_ACCESS['owner']); $ownername = COM_getDisplayName($A['owner_id']); $event_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}")); $event_templates->set_var('owner_name', $ownername); $event_templates->set_var('owner', $ownername); $event_templates->set_var('owner_id', $A['owner_id']); $event_templates->set_var('lang_group', $LANG_ACCESS['group']); $event_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access)); $event_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); $event_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']); $event_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']); $event_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $event_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']); $event_templates->set_var('gltoken_name', CSRF_TOKEN); $event_templates->set_var('gltoken', $token); $event_templates->parse('output', 'editor'); $retval .= $event_templates->finish($event_templates->get_var('output')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }
/** * Allows user to edit a personal calendar event * * @param array $A Record to display * @return string HTML for event editor * */ function editpersonalevent($A) { global $_CONF, $_CA_CONF, $LANG_CAL_1; $cal_templates = COM_newTemplate(CTL_plugin_templatePath('calendar')); $cal_templates->set_file('form', 'editpersonalevent.thtml'); $cal_templates->set_var('lang_title', $LANG_CAL_1[28]); $title = stripslashes($A['title']); $title = str_replace('{', '{', $title); $title = str_replace('}', '}', $title); $title = str_replace('"', '"', $title); $cal_templates->set_var('event_title', $title); $cal_templates->set_var('lang_eventtype', $LANG_CAL_1[37]); $type_options = CALENDAR_eventTypeList($A['event_type']); $cal_templates->set_var('type_options', $type_options); // Handle start date/time $cal_templates->set_var('lang_startdate', $LANG_CAL_1[21]); $cal_templates->set_var('lang_starttime', $LANG_CAL_1[30]); $A['startdate'] = $A['datestart'] . ' ' . $A['timestart']; $start_month = date('n', strtotime($A['startdate'])); $month_options = COM_getMonthFormOptions($start_month); $cal_templates->set_var('startmonth_options', $month_options); $start_day = date('j', strtotime($A['startdate'])); $day_options = COM_getDayFormOptions($start_day); $cal_templates->set_var('startday_options', $day_options); $start_year = date('Y', strtotime($A['startdate'])); $year_options = COM_getYearFormOptions($start_year); $cal_templates->set_var('startyear_options', $year_options); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $start_hour = date('H', strtotime($A['startdate'])); $hour_options = COM_getHourFormOptions($start_hour, 24); $cal_templates->set_var('starthour_options', $hour_options); } else { $start_hour = date('g', strtotime($A['startdate'])); $hour_options = COM_getHourFormOptions($start_hour); $cal_templates->set_var('starthour_options', $hour_options); } $startmin = intval(date('i', strtotime($A['startdate'])) / 15) * 15; $cal_templates->set_var('startminute_options', COM_getMinuteFormOptions($startmin, 15)); $ampm = date('a', strtotime($A['startdate'])); $cal_templates->set_var('startampm_selection', COM_getAmPmFormSelection('startampm_selection', $ampm)); // Handle end date/time $cal_templates->set_var('lang_enddate', $LANG_CAL_1[18]); $cal_templates->set_var('lang_endtime', $LANG_CAL_1[29]); $A['enddate'] = $A['dateend'] . ' ' . $A['timeend']; $end_month = date('n', strtotime($A['enddate'])); $month_options = COM_getMonthFormOptions($end_month); $cal_templates->set_var('endmonth_options', $month_options); $end_day = date('j', strtotime($A['enddate'])); $day_options = COM_getDayFormOptions($end_day); $cal_templates->set_var('endday_options', $day_options); $end_year = date('Y', strtotime($A['enddate'])); $year_options = COM_getYearFormOptions($end_year); $cal_templates->set_var('endyear_options', $year_options); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $end_hour = date('H', strtotime($A['enddate'])); $hour_options = COM_getHourFormOptions($end_hour, 24); $cal_templates->set_var('endhour_options', $hour_options); } else { $end_hour = date('g', strtotime($A['enddate'])); $hour_options = COM_getHourFormOptions($end_hour); $cal_templates->set_var('endhour_options', $hour_options); } $endmin = intval(date('i', strtotime($A['enddate'])) / 15) * 15; $cal_templates->set_var('endminute_options', COM_getMinuteFormOptions($endmin, 15)); $ampm = date('a', strtotime($A['enddate'])); $cal_templates->set_var('endampm_selection', COM_getAmPmFormSelection('endampm_selection', $ampm)); $cal_templates->set_var('lang_alldayevent', $LANG_CAL_1[31]); if ($A['allday'] == 1) { $cal_templates->set_var('allday_checked', 'checked="checked"'); } else { $cal_templates->set_var('allday_checked', ''); } $cal_templates->set_var('lang_location', $LANG_CAL_1[39]); $cal_templates->set_var('event_location', stripslashes($A['location'])); $cal_templates->set_var('lang_addressline1', $LANG_CAL_1[32]); $cal_templates->set_var('event_address1', stripslashes($A['address1'])); $cal_templates->set_var('lang_addressline2', $LANG_CAL_1[33]); $cal_templates->set_var('event_address2', stripslashes($A['address2'])); $cal_templates->set_var('lang_city', $LANG_CAL_1[34]); $cal_templates->set_var('event_city', stripslashes($A['city'])); $cal_templates->set_var('lang_state', $LANG_CAL_1[35]); $cal_templates->set_var('state_options', ''); $cal_templates->set_var('event_state', stripslashes($A['state'])); $cal_templates->set_var('lang_zipcode', $LANG_CAL_1[36]); $cal_templates->set_var('event_zipcode', $A['zipcode']); $cal_templates->set_var('lang_link', $LANG_CAL_1[43]); $cal_templates->set_var('event_url', $A['url']); $cal_templates->set_var('lang_description', $LANG_CAL_1[5]); $cal_templates->set_var('event_description', COM_nl2br(stripslashes($A['description']))); $cal_templates->set_var('lang_htmlnotallowed', $LANG_CAL_1[44]); $cal_templates->set_var('lang_submit', $LANG_CAL_1[45]); $cal_templates->set_var('lang_delete', $LANG_CAL_1[51]); $cal_templates->set_var('eid', $A['eid']); $cal_templates->set_var('uid', $A['uid']); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $cal_templates->set_var('hour_mode', 24); } else { $cal_templates->set_var('hour_mode', 12); } $cal_templates->set_var('gltoken_name', CSRF_TOKEN); $cal_templates->set_var('gltoken', SEC_createToken()); return $cal_templates->parse('output', 'form'); }
/** * Shows event editor * * @param string $action action we are performing: 'edit', 'clone' or 'moderate' * @param array $A array holding the event's details * @param string $msg an optional error message to display * @return string HTML for event editor or error message * */ function CALENDAR_edit($action, $A, $msg = '') { global $_CONF, $_USER, $_GROUPS, $_TABLES, $_USER, $_CA_CONF, $LANG_CAL_1, $LANG_CAL_ADMIN, $LANG10, $LANG12, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE; USES_lib_admin(); $retval = ''; $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/calendar/index.php', 'text' => $LANG_CAL_ADMIN[40]), array('url' => $_CONF['site_admin_url'] . '/moderation.php', 'text' => $LANG_ADMIN['submissions']), array('url' => $_CONF['site_admin_url'] . '/plugins/calendar/index.php?batchadmin=x', 'text' => $LANG_CAL_ADMIN[38]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home'])); switch ($action) { case 'edit': case 'clone': $blocktitle = $LANG_CAL_ADMIN[1]; // Event Editor $saveoption = $LANG_ADMIN['save']; // Save break; case 'moderate': $blocktitle = $LANG_CAL_ADMIN[37]; // Moderate Event $saveoption = $LANG_ADMIN['moderate']; // Save & Approve break; } if (!empty($msg)) { $retval .= COM_showMessageText($msg, $LANG_CAL_ADMIN[2], true); } $event_templates = new Template($_CONF['path'] . 'plugins/calendar/templates/admin'); $event_templates->set_file('editor', 'eventeditor.thtml'); $event_templates->set_var('lang_allowed_html', COM_allowedHTML(SEC_getUserPermissions(), false, 'calendar', 'description')); $event_templates->set_var('lang_postmode', $LANG_CAL_ADMIN[3]); if (!isset($A['perm_owner'])) { $A['perm_owner'][0] = "0"; } if (!isset($A['perm_group'])) { $A['perm_group'][0] = "0"; } if (!isset($A['perm_members'])) { $A['perm_members'][0] = "0"; } if (!isset($A['perm_anon'])) { $A['perm_anon'][0] = "0"; } if ($action != 'moderate' and !empty($A['eid'])) { // Get what level of access user has to this object $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']); if ($access == 0 or $access == 2) { // Uh, oh! User doesn't have access to this object $retval .= COM_showMessageText($LANG_CAL_ADMIN[17], $LANG_ACCESS['accessdenied'], true); COM_accessLog("User {$_USER['username']} tried to illegally submit or edit event {$eid}."); return $retval; } } else { if (!isset($A['owner_id']) || $A['owner_id'] == '') { $A['owner_id'] = $_USER['uid']; } if (isset($_GROUPS['Calendar Admin'])) { $A['group_id'] = $_GROUPS['Calendar Admin']; } else { $A['group_id'] = SEC_getFeatureGroup('calendar.edit'); } SEC_setDefaultPermissions($A, $_CA_CONF['default_permissions']); $access = 3; } if ($action == 'moderate') { $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', 'plaintext')); } else { if (!isset($A['postmode'])) { $A['postmode'] = $_CONF['postmode']; } $event_templates->set_var('post_options', COM_optionList($_TABLES['postmodes'], 'code,name', $A['postmode'])); } $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= ADMIN_createMenu($menu_arr, $LANG_CAL_ADMIN[41], plugin_geticon_calendar()); if (!empty($A['eid'])) { $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s/>'; $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; $event_templates->set_var('lang_delete_confirm', $MESSAGE[76]); $event_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm)); $event_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, '')); if ($action == 'moderate') { $event_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"/>'); } } else { // new event $A['eid'] = COM_makesid(); $A['status'] = 1; $A['title'] = ''; $A['description'] = ''; $A['url'] = ''; $A['hits'] = 0; // in case a start date/time has been passed from the calendar, // pick it up for the end date/time if (empty($A['dateend'])) { $A['dateend'] = $A['datestart']; } if (empty($A['timeend'])) { $A['timeend'] = $A['timestart']; } $A['event_type'] = ''; $A['location'] = ''; $A['address1'] = ''; $A['address2'] = ''; $A['city'] = ''; $A['state'] = ''; $A['zipcode'] = ''; $A['allday'] = 0; } $event_templates->set_var('event_id', $A['eid']); $event_templates->set_var('lang_eventtitle', $LANG_ADMIN['title']); $A['title'] = str_replace('{', '{', $A['title']); $A['title'] = str_replace('}', '}', $A['title']); $A['title'] = str_replace('"', '"', $A['title']); $event_templates->set_var('event_title', $A['title']); $event_templates->set_var('lang_eventtype', $LANG_CAL_1[37]); $event_templates->set_var('lang_editeventtypes', $LANG12[50]); $event_templates->set_var('type_options', CALENDAR_eventTypeList($A['event_type'])); $event_templates->set_var('status_checked', $A['status'] == 1 ? ' checked="checked"' : ''); $event_templates->set_var('lang_eventurl', $LANG_CAL_ADMIN[4]); $event_templates->set_var('max_url_length', 255); $event_templates->set_var('event_url', $A['url']); $event_templates->set_var('lang_includehttp', $LANG_CAL_ADMIN[9]); $event_templates->set_var('lang_eventstartdate', $LANG_CAL_ADMIN[5]); //$event_templates->set_var('event_startdate', $A['datestart']); $event_templates->set_var('lang_starttime', $LANG_CAL_1[30]); // Combine date/time for easier manipulation $A['datestart'] = trim($A['datestart'] . ' ' . $A['timestart']); if (empty($A['datestart'])) { $start_stamp = time(); } else { $start_stamp = strtotime($A['datestart']); } $A['dateend'] = trim($A['dateend'] . ' ' . $A['timeend']); if (empty($A['dateend'])) { $end_stamp = time(); } else { $end_stamp = strtotime($A['dateend']); } $start_month = date('m', $start_stamp); $start_day = date('d', $start_stamp); $start_year = date('Y', $start_stamp); $end_month = date('m', $end_stamp); $end_day = date('d', $end_stamp); $end_year = date('Y', $end_stamp); $start_hour = date('H', $start_stamp); $start_minute = intval(date('i', $start_stamp) / 15) * 15; if ($start_hour >= 12) { $startampm = 'pm'; } else { $startampm = 'am'; } $start_hour_24 = $start_hour % 24; if ($start_hour > 12) { $start_hour = $start_hour - 12; } else { if ($start_hour == 0) { $start_hour = 12; } } $end_hour = date('H', $end_stamp); $end_minute = intval(date('i', $end_stamp) / 15) * 15; if ($end_hour >= 12) { $endampm = 'pm'; } else { $endampm = 'am'; } $end_hour_24 = $end_hour % 24; if ($end_hour > 12) { $end_hour = $end_hour - 12; } else { if ($end_hour == 0) { $end_hour = 12; } } $month_options = COM_getMonthFormOptions($start_month); $event_templates->set_var('startmonth_options', $month_options); $month_options = COM_getMonthFormOptions($end_month); $event_templates->set_var('endmonth_options', $month_options); $day_options = COM_getDayFormOptions($start_day); $event_templates->set_var('startday_options', $day_options); $day_options = COM_getDayFormOptions($end_day); $event_templates->set_var('endday_options', $day_options); $year_options = COM_getYearFormOptions($start_year); $event_templates->set_var('startyear_options', $year_options); $year_options = COM_getYearFormOptions($end_year); $event_templates->set_var('endyear_options', $year_options); if (isset($_CA_CONF['hour_mode']) && $_CA_CONF['hour_mode'] == 24) { $hour_options = COM_getHourFormOptions($start_hour_24, 24); $event_templates->set_var('starthour_options', $hour_options); $hour_options = COM_getHourFormOptions($end_hour_24, 24); $event_templates->set_var('endhour_options', $hour_options); $event_templates->set_var('hour_mode', 24); } else { $hour_options = COM_getHourFormOptions($start_hour); $event_templates->set_var('starthour_options', $hour_options); $hour_options = COM_getHourFormOptions($end_hour); $event_templates->set_var('endhour_options', $hour_options); $event_templates->set_var('hour_mode', 12); } $event_templates->set_var('startampm_selection', CALENDAR_getAmPmFormSelection('start_ampm', $startampm, 'update_ampm()')); $event_templates->set_var('endampm_selection', CALENDAR_getAmPmFormSelection('end_ampm', $endampm)); $event_templates->set_var('startminute_options', COM_getMinuteFormOptions($start_minute, 15)); $event_templates->set_var('endminute_options', COM_getMinuteFormOptions($end_minute, 15)); $event_templates->set_var('lang_enddate', $LANG12[13]); $event_templates->set_var('lang_eventenddate', $LANG_CAL_ADMIN[6]); $event_templates->set_var('event_enddate', $A['dateend']); $event_templates->set_var('lang_enddate', $LANG12[13]); $event_templates->set_var('lang_endtime', $LANG_CAL_1[29]); $event_templates->set_var('lang_alldayevent', $LANG_CAL_1[31]); if ($A['allday'] == 1) { $event_templates->set_var('allday_checked', 'checked="checked"'); } $event_templates->set_var('lang_location', $LANG12[51]); $event_templates->set_var('event_location', $A['location']); $event_templates->set_var('lang_addressline1', $LANG12[44]); $event_templates->set_var('event_address1', $A['address1']); $event_templates->set_var('lang_addressline2', $LANG12[45]); $event_templates->set_var('event_address2', $A['address2']); $event_templates->set_var('lang_city', $LANG12[46]); $event_templates->set_var('event_city', $A['city']); $event_templates->set_var('lang_state', $LANG12[47]); $event_templates->set_var('state_options', ''); $event_templates->set_var('event_state', $A['state']); $event_templates->set_var('lang_zipcode', $LANG12[48]); $event_templates->set_var('event_zipcode', $A['zipcode']); $event_templates->set_var('lang_eventlocation', $LANG_CAL_ADMIN[7]); $event_templates->set_var('event_location', $A['location']); $event_templates->set_var('lang_eventdescription', $LANG_CAL_ADMIN[8]); $event_templates->set_var('event_description', $A['description']); $event_templates->set_var('lang_hits', $LANG10[30]); $event_templates->set_var('hits', COM_numberFormat($A['hits'])); $event_templates->set_var('lang_save', $saveoption); $event_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); // user access info $event_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']); $event_templates->set_var('lang_owner', $LANG_ACCESS['owner']); $ownername = COM_getDisplayName($A['owner_id']); $event_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}")); $event_templates->set_var('owner_name', $ownername); $event_templates->set_var('owner', $ownername); $event_templates->set_var('owner_id', $A['owner_id']); $event_templates->set_var('lang_group', $LANG_ACCESS['group']); $event_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access)); $event_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); $event_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']); $event_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])); $event_templates->set_var('gltoken_name', CSRF_TOKEN); $event_templates->set_var('gltoken', SEC_createToken()); $event_templates->parse('output', 'editor'); $retval .= $event_templates->finish($event_templates->get_var('output')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }