/** * Standard aed_module add actualiser. * * @return array A pair: the entry added, and a description */ function add_actualisation() { list($type, $recurrence, $recurrences, $title, $content, $priority, $is_public, $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, $timezone, $do_timezone_conv) = $this->get_event_parameters(); $allow_trackbacks = post_param_integer('allow_trackbacks', 0); $allow_rating = post_param_integer('allow_rating', 0); $allow_comments = post_param_integer('allow_comments', 0); $notes = post_param('notes', ''); $validated = post_param_integer('validated', 0); $seg_recurrences = post_param_integer('seg_recurrences', 0); $id = add_calendar_event($type, $recurrence, $recurrences, $seg_recurrences, $title, $content, $priority, $is_public, $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, $timezone, $do_timezone_conv, $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes); // Reminders if (function_exists('set_time_limit')) { @set_time_limit(0); } $rem_groups = array(); if (has_specific_permission(get_member(), 'add_public_events') && array_key_exists('sign_up_reminder_groups', $_POST)) { $all_groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true); $multi_code = read_multi_code('sign_up_reminder_groups'); // Usergroups signed up require_code('ocfiltering'); if (substr($multi_code, 0, 1) == '-' || substr($multi_code, 0, 1) == '*') { $rem_groups = $all_groups; if (get_forum_type() == 'ocf') { unset($rem_groups[db_get_first_id()]); } } foreach (explode(',', substr($multi_code, 1)) as $m) { if (substr($multi_code, 0, 1) == '-') { unset($rem_groups[intval($m)]); } elseif (substr($multi_code, 0, 1) == '+') { $rem_groups[intval($m)] = $all_groups[intval($m)]; } } $rem_groups = array_keys($rem_groups); } $start = 0; do { $members = array(); if (count($rem_groups) != 0) { $members = array_keys($GLOBALS['FORUM_DRIVER']->member_group_query($rem_groups, 300, $start)); $members = array_diff($members, array(get_member(), $GLOBALS['FORUM_DRIVER']->get_guest_id())); } if ($start == 0 && post_param_integer('sign_up_reminder', 0) == 1) { // If this member is signing up $members[] = get_member(); } if (count($members) != 0) { $secs_before = floatval(post_param('hours_before', '1.0')) * 3600.0; $filled1 = array(); for ($i = 0; $i < count($members); $i++) { $filled1[] = $id; } $filled2 = array(); for ($i = 0; $i < count($members); $i++) { $filled2[] = intval($secs_before); } $GLOBALS['SITE_DB']->query_insert('calendar_reminders', array('e_id' => $filled1, 'n_member_id' => array_values($members), 'n_seconds_before' => $filled2)); } $start += 300; } while (array_key_exists(0, $members)); if ($is_public == 1) { $start = 0; do { $members = array(); $interested = $GLOBALS['SITE_DB']->query_select('calendar_interests', array('i_member_id'), array('t_type' => $type), '', 300, $start); foreach ($interested as $int) { if (!in_array($int['i_member_id'], $members)) { $members[] = $int['i_member_id']; } } $members = array_diff($members, array(get_member(), $GLOBALS['FORUM_DRIVER']->get_guest_id())); foreach ($members as $member) { $secs_before = floatval(post_param('hours_before', '1.0')) * 3600.0; $GLOBALS['SITE_DB']->query_insert('calendar_reminders', array('e_id' => $id, 'n_member_id' => $member, 'n_seconds_before' => intval($secs_before)), false, true); } $start += 300; } while (array_key_exists(0, $members)); } regenerate_event_reminder_jobs($id); $conflicts = detect_conflicts(get_member(), $id, $start_year, $start_month, $start_day, $start_hour, $start_minute, $end_year, $end_month, $end_day, $end_hour, $end_minute, $recurrence, $recurrences); $_description = is_null($conflicts) ? paragraph(do_lang_tempcode('SUBMIT_THANKYOU')) : $conflicts; $this->donext_type = $type; $this->donext_date = strval($start_year) . '-' . strval($start_month) . '-' . strval($start_day); if ($validated == 1 || !addon_installed('unvalidated')) { if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'calendar') && has_category_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'calendar', strval($type))) { $_from = cal_get_start_utctime_for_event($timezone, $start_year, $start_month, $start_day, $start_hour, $start_minute, true); $from = cal_utctime_to_usertime($_from, $timezone, false); $to = mixed(); if (!is_null($end_year) && !is_null($end_month) && !is_null($end_day)) { $_to = cal_get_end_utctime_for_event($timezone, $end_year, $end_month, $end_day, $end_hour, $end_minute, true); $to = cal_utctime_to_usertime($_to, $timezone, false); } syndicate_described_activity('calendar:ACTIVITY_CALENDAR_EVENT', $title, date_range($from, $to, !is_null($start_hour)), '', '_SEARCH:calendar:view:' . strval($id), '', '', 'calendar', 1, NULL, true); } } return array(strval($id), $_description); }
/** * Standard aed_module edit actualiser. * * @param ID_TEXT The entry being edited */ function edit_actualisation($id) { ocf_edit_multi_moderation(intval($id), post_param('name'), post_param('post_text'), post_param_integer('move_to', NULL), post_param_integer('pin_state', 0), post_param_integer('sink_state', 0), post_param_integer('open_state', 0), read_multi_code('forum_multi_code'), post_param('title_suffix')); }
/** * Standard aed_module edit actualiser. * * @param ID_TEXT The entry being edited */ function edit_actualisation($id) { ocf_edit_post_template(intval($id), post_param('title'), post_param('text'), read_multi_code('forum_multi_code'), post_param_integer('use_default_forums', 0)); }