/** * Edit an IOTD. * * @param AUTO_LINK The ID of the IOTD to edit * @param SHORT_TEXT The IOTD title * @param LONG_TEXT The IOTD caption * @param URLPATH The URL to the IOTD image * @param URLPATH The URL to the IOTD thumbnail image * @param BINARY Whether the IOTD may be rated * @param SHORT_INTEGER Whether comments are allowed (0=no, 1=yes, 2=review style) * @param BINARY Whether the IOTD may be trackbacked * @param LONG_TEXT Notes for the IOTD */ function edit_iotd($id, $title, $caption, $thumb_url, $url, $allow_rating, $allow_comments, $allow_trackbacks, $notes) { $_caption = $GLOBALS['SITE_DB']->query_value('iotd', 'caption', array('id' => $id)); $_title = $GLOBALS['SITE_DB']->query_value('iotd', 'i_title', array('id' => $id)); require_code('files2'); delete_upload('uploads/iotds', 'iotd', 'url', 'id', $id, $url); delete_upload('uploads/iotds_thumbs', 'iotd', 'thumb_url', 'id', $id, $thumb_url); $GLOBALS['SITE_DB']->query_update('iotd', array('i_title' => lang_remap_comcode($_title, $title), 'edit_date' => time(), 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'allow_trackbacks' => $allow_trackbacks, 'notes' => $notes, 'caption' => lang_remap_comcode($_caption, $caption), 'thumb_url' => $thumb_url, 'url' => $url), array('id' => $id), '', 1); require_code('urls2'); suggest_new_idmoniker_for('iotds', 'view', strval($id), $title); log_it('EDIT_IOTD', strval($id), get_translated_text($_caption)); decache('main_iotd'); require_code('feedback'); update_spacer_post($allow_comments != 0, 'videos', strval($id), build_url(array('page' => 'iotds', 'type' => 'view', 'id' => $id), get_module_zone('iotds'), NULL, false, false, true), $title, get_value('comment_forum__iotds')); }
/** * Edit a gallery. * * @param ID_TEXT The old gallery codename (in case we are renaming) * @param ID_TEXT The gallery codename (maybe the same as the old one) * @param SHORT_TEXT The full human-readeable name of the gallery * @param LONG_TEXT The description of the gallery * @param SHORT_TEXT Teaser text for the gallery * @param LONG_TEXT Hidden notes associated with the gallery * @param ?ID_TEXT The parent gallery (NULL: no parent) * @param BINARY Whether images may be put in this gallery * @param BINARY Whether videos may be put in this gallery * @param BINARY Whether the gallery serves as a container for automatically created member galleries * @param BINARY Whether the gallery uses the flow mode interface * @param URLPATH The representative image of the gallery (blank: none) * @param URLPATH Watermark (blank: none) * @param URLPATH Watermark (blank: none) * @param URLPATH Watermark (blank: none) * @param URLPATH Watermark (blank: none) * @param ?SHORT_TEXT Meta keywords for this resource (NULL: do not edit) * @param ?LONG_TEXT Meta description for this resource (NULL: do not edit) * @param BINARY Whether rating are allowed * @param BINARY Whether comments are allowed * @param ?MEMBER The gallery owner (NULL: nobody) */ function edit_gallery($old_name, $name, $fullname, $description, $teaser, $notes, $parent_id = NULL, $accept_images = 1, $accept_videos = 1, $is_member_synched = 0, $flow_mode_interface = 0, $rep_image = '', $watermark_top_left = '', $watermark_top_right = '', $watermark_bottom_left = '', $watermark_bottom_right = '', $meta_keywords = NULL, $meta_description = NULL, $allow_rating = 1, $allow_comments = 1, $g_owner = NULL) { require_code('urls2'); suggest_new_idmoniker_for('galleries', 'misc', $name, $fullname); $under_category_id = $parent_id; while ($under_category_id != '' && $under_category_id != STRING_MAGIC_NULL) { if ($name == $under_category_id) { warn_exit(do_lang_tempcode('OWN_PARENT_ERROR')); } $under_category_id = $GLOBALS['SITE_DB']->query_value('galleries', 'parent_id', array('name' => $under_category_id)); } if (is_null($parent_id)) { $parent_id = ''; } require_code('seo2'); if ($old_name != $name) { require_code('type_validation'); if (!is_alphanumeric($name, true)) { warn_exit(do_lang_tempcode('BAD_CODENAME')); } $test = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'name', array('name' => $name)); if (!is_null($test)) { warn_exit(do_lang_tempcode('ALREADY_EXISTS', escape_html($name))); } seo_meta_erase_storage('gallery', $old_name); $GLOBALS['SITE_DB']->query_update('images', array('cat' => $name), array('cat' => $old_name)); $GLOBALS['SITE_DB']->query_update('videos', array('cat' => $name), array('cat' => $old_name)); $GLOBALS['SITE_DB']->query_update('galleries', array('parent_id' => $name), array('parent_id' => $old_name)); if (addon_installed('awards')) { $types = $GLOBALS['SITE_DB']->query_select('award_types', array('id'), array('a_content_type' => 'gallery')); foreach ($types as $type) { $GLOBALS['SITE_DB']->query_update('award_archive', array('content_id' => $name), array('content_id' => $old_name, 'a_type_id' => $type['id'])); } } } if (!is_null($meta_keywords)) { seo_meta_set_for_explicit('gallery', $name, $meta_keywords, $meta_description); } $myrows = $GLOBALS['SITE_DB']->query_select('galleries', array('fullname', 'description', 'teaser'), array('name' => $old_name), '', 1); if (!array_key_exists(0, $myrows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $myrows[0]; $map = array('name' => $name, 'notes' => $notes, 'fullname' => lang_remap($myrow['fullname'], $fullname), 'description' => lang_remap_comcode($myrow['description'], $description), 'teaser' => lang_remap_comcode($myrow['teaser'], $teaser), 'parent_id' => $parent_id, 'accept_images' => $accept_images, 'accept_videos' => $accept_videos, 'is_member_synched' => $is_member_synched, 'flow_mode_interface' => $flow_mode_interface, 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'g_owner' => $g_owner); require_code('files2'); if (!is_null($rep_image)) { $map['rep_image'] = $rep_image; delete_upload('uploads/grepimages', 'galleries', 'rep_image', 'name', $old_name, $rep_image); } if (!is_null($watermark_top_left)) { $map['watermark_top_left'] = $watermark_top_left; delete_upload('uploads/watermarks', 'galleries', 'watermark_top_left', 'name', $old_name, $watermark_top_left); } if (!is_null($watermark_top_right)) { $map['watermark_top_right'] = $watermark_top_right; delete_upload('uploads/watermarks', 'galleries', 'watermark_top_right', 'name', $old_name, $watermark_top_right); } if (!is_null($watermark_bottom_left)) { $map['watermark_bottom_left'] = $watermark_bottom_left; delete_upload('uploads/watermarks', 'galleries', 'watermark_bottom_left', 'name', $old_name, $watermark_bottom_left); } if (!is_null($watermark_bottom_right)) { $map['watermark_bottom_right'] = $watermark_bottom_right; delete_upload('uploads/watermarks', 'galleries', 'watermark_bottom_right', 'name', $old_name, $watermark_bottom_right); } $GLOBALS['SITE_DB']->query_update('galleries', $map, array('name' => $old_name), '', 1); log_it('EDIT_GALLERY', $name, $fullname); $GLOBALS['SITE_DB']->query_update('group_category_access', array('category_name' => $name), array('module_the_name' => 'galleries', 'category_name' => $old_name)); decache('main_top_galleries'); decache('main_recent_galleries'); decache('main_root_galleries'); decache('side_root_galleries'); require_code('feedback'); update_spacer_post($allow_comments != 0, 'galleries', $name, build_url(array('page' => 'galleries', 'type' => 'misc', 'id' => $name), get_module_zone('galleries'), NULL, false, false, true), $fullname, get_value('comment_forum__galleries')); }
/** * Edit a download. * * @param AUTO_LINK The ID of the download to edit * @param AUTO_LINK The ID of the category the download is to be in * @param SHORT_TEXT The name of the download * @param URLPATH The URL to the download * @param LONG_TEXT The description of the download * @param ID_TEXT The author of the download (not necessarily same as the submitter) * @param LONG_TEXT The comments for the download * @param AUTO_LINK The out-mode-id (the ID of a download that this download is an old version of). Often people wonder why this is specified with the old version, and not the opposite with the new version - it is because statistically, we perceive more chance of downloads merging than splitting * @param integer The ordered number of the gallery image to use as the download representative image * @param BINARY Whether the download has been validated * @param BINARY Whether the download may be rated * @param SHORT_INTEGER Whether comments are allowed (0=no, 1=yes, 2=review style) * @param BINARY Whether the download may be trackbacked * @param LONG_TEXT Hidden notes pertaining to the download * @param SHORT_TEXT The downloads original filename (the URL may be obfuscated) * @param integer The file size of the download (we can't really detect this in real-time for remote URLs) * @param integer The cost of the download that members will have to pay to get it * @param BINARY Whether the submitter gets the points for the download (they are selling it) (otherwise they are just thrown out, which is an alternative model - one of enforcing community point building) * @param ?AUTO_LINK The licence to use (NULL: none) * @param SHORT_TEXT Meta keywords * @param LONG_TEXT Meta description */ function edit_download($id, $category_id, $name, $url, $description, $author, $comments, $out_mode_id, $default_pic, $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes, $original_filename, $file_size, $cost, $submitter_gets_points, $licence, $meta_keywords, $meta_description) { require_code('urls2'); suggest_new_idmoniker_for('downloads', 'view', strval($id), $name); if ($file_size == 0 || url_is_local($url)) { if (url_is_local($url)) { $file_size = filesize(get_custom_file_base() . '/' . rawurldecode($url)); } else { $file_size = @filesize($url) or $file_size = NULL; } } $myrows = $GLOBALS['SITE_DB']->query_select('download_downloads', array('name', 'description', 'comments'), array('id' => $id), '', 1); if (!array_key_exists(0, $myrows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $myrows[0]; require_code('seo2'); seo_meta_set_for_explicit('downloads_download', strval($id), $meta_keywords, $meta_description); require_code('files2'); delete_upload('uploads/downloads', 'download_downloads', 'url', 'id', $id, $url); $met = @ini_get('max_execution_time'); $data_mash = create_data_mash($url, NULL, get_file_extension($original_filename)); if (function_exists('set_time_limit')) { @set_time_limit($met); } if (!addon_installed('unvalidated')) { $validated = 1; } require_code('submit'); $just_validated = !content_validated('download', strval($id)) && $validated == 1; if ($just_validated) { send_content_validated_notification('download', strval($id)); } $map = array('download_data_mash' => $data_mash, 'download_licence' => $licence, 'original_filename' => $original_filename, 'download_submitter_gets_points' => $submitter_gets_points, 'download_cost' => $cost, 'edit_date' => time(), 'file_size' => $file_size, 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'allow_trackbacks' => $allow_trackbacks, 'notes' => $notes, 'name' => lang_remap($myrow['name'], $name), 'description' => lang_remap_comcode($myrow['description'], $description), 'comments' => lang_remap_comcode($myrow['comments'], $comments), 'validated' => $validated, 'category_id' => $category_id, 'url' => $url, 'author' => $author, 'default_pic' => $default_pic, 'out_mode_id' => $out_mode_id); $GLOBALS['SITE_DB']->query_update('download_downloads', $map, array('id' => $id), '', 1); $self_url = build_url(array('page' => 'downloads', 'type' => 'entry', 'id' => $id), get_module_zone('downloads'), NULL, false, false, true); if ($just_validated) { require_lang('downloads'); require_code('notifications'); $subject = do_lang('DOWNLOAD_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $name); $mail = do_lang('DOWNLOAD_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($name), array(comcode_escape($self_url->evaluate()))); dispatch_notification('download', strval($category_id), $subject, $mail); } log_it('EDIT_DOWNLOAD', strval($id), get_translated_text($myrow['name'])); if (addon_installed('galleries')) { // Change its gallery require_code('galleries2'); $download_gallery_root = get_option('download_gallery_root'); if (is_null($download_gallery_root)) { $download_gallery_root = 'root'; } $test = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'parent_id', array('name' => 'download_' . strval($id))); if (!is_null($test)) { edit_gallery('download_' . strval($id), 'download_' . strval($id), do_lang('GALLERY_FOR_DOWNLOAD', $name), '', '', '', $download_gallery_root); } } decache('main_recent_downloads'); decache('main_top_downloads'); decache('main_download_category'); decache('main_download_tease'); require_code('feedback'); update_spacer_post($allow_comments != 0, 'downloads', strval($id), $self_url, $name, get_value('comment_forum__downloads')); }
/** * Edit a news entry. * * @param AUTO_LINK The ID of the news to edit * @param SHORT_TEXT The news title * @param LONG_TEXT The news summary (or if not an article, the full news) * @param ID_TEXT The news author (possibly, a link to an existing author in the system, but does not need to be) * @param BINARY Whether the news has been validated * @param BINARY Whether the news may be rated * @param SHORT_INTEGER Whether comments are allowed (0=no, 1=yes, 2=review style) * @param BINARY Whether the news may have trackbacks * @param LONG_TEXT Notes for the news * @param LONG_TEXT The news entry (blank means no entry) * @param AUTO_LINK The primary news category (NULL: personal) * @param ?array The IDs of the news categories that this is in (NULL: do not change) * @param SHORT_TEXT Meta keywords * @param LONG_TEXT Meta description * @param ?URLPATH URL to the image for the news entry (blank: use cat image) (NULL: don't delete existing) * @param ?TIME Recorded add time (NULL: leave alone) */ function edit_news($id, $title, $news, $author, $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes, $news_article, $main_news_category, $news_category, $meta_keywords, $meta_description, $image, $time = NULL) { $rows = $GLOBALS['SITE_DB']->query_select('news', array('title', 'news', 'news_article', 'submitter'), array('id' => $id), '', 1); $_title = $rows[0]['title']; $_news = $rows[0]['news']; $_news_article = $rows[0]['news_article']; require_code('urls2'); suggest_new_idmoniker_for('news', 'view', strval($id), $title); require_code('attachments2'); require_code('attachments3'); if (!addon_installed('unvalidated')) { $validated = 1; } require_code('submit'); $just_validated = !content_validated('news', strval($id)) && $validated == 1; if ($just_validated) { send_content_validated_notification('news', strval($id)); } $map = array('news_category' => $main_news_category, 'news_article' => update_lang_comcode_attachments($_news_article, $news_article, 'news', strval($id), NULL, false, $rows[0]['submitter']), 'edit_date' => time(), 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'allow_trackbacks' => $allow_trackbacks, 'notes' => $notes, 'validated' => $validated, 'title' => lang_remap_comcode($_title, $title), 'news' => lang_remap_comcode($_news, $news), 'author' => $author); if (!is_null($time)) { $map['date_and_time'] = $time; } if (!is_null($image)) { $map['news_image'] = $image; require_code('files2'); delete_upload('uploads/grepimages', 'news', 'news_image', 'id', $id, $image); } /*$news_categories=$news_category[0]; foreach ($news_category as $key=>$value) { if($key>0) $news_categories.=','.$value; }*/ if (!is_null($news_category)) { $GLOBALS['SITE_DB']->query_delete('news_category_entries', array('news_entry' => $id)); foreach ($news_category as $value) { $GLOBALS['SITE_DB']->query_insert('news_category_entries', array('news_entry' => $id, 'news_entry_category' => $value)); } } log_it('EDIT_NEWS', strval($id), $title); $GLOBALS['SITE_DB']->query_update('news', $map, array('id' => $id), '', 1); $self_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $id), get_module_zone('news'), NULL, false, false, true); if ($just_validated) { dispatch_news_notification($id, $title, $main_news_category); } require_code('seo2'); seo_meta_set_for_explicit('news', strval($id), $meta_keywords, $meta_description); decache('main_news'); decache('side_news'); decache('side_news_archive'); decache('bottom_news'); if ($validated == 1 && has_category_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'news', strval($main_news_category))) { $_ping_url = str_replace('{url}', urlencode(get_base_url()), str_replace('{rss}', urlencode(find_script('backend')), str_replace('{title}', urlencode(get_site_name()), get_option('ping_url')))); $ping_urls = explode(',', $_ping_url); foreach ($ping_urls as $ping_url) { $ping_url = trim($ping_url); if ($ping_url != '') { http_download_file($ping_url, NULL, false); } } } require_code('feedback'); update_spacer_post($allow_comments != 0, 'news', strval($id), $self_url, $title, get_value('comment_forum__news')); }
/** * Edit a poll. * * @param AUTO_LINK The ID of the poll to edit * @param SHORT_TEXT The question * @param SHORT_TEXT The first choice * @range 1 max * @param SHORT_TEXT The second choice * @range 1 max * @param SHORT_TEXT The third choice (blank means not a choice) * @param SHORT_TEXT The fourth choice (blank means not a choice) * @param SHORT_TEXT The fifth choice (blank means not a choice) * @param SHORT_TEXT The sixth choice (blank means not a choice) * @param SHORT_TEXT The seventh choice (blank means not a choice) * @param SHORT_TEXT The eighth choice (blank means not a choice) * @param SHORT_TEXT The ninth choice (blank means not a choice) * @param SHORT_TEXT The tenth choice (blank means not a choice) * @param integer The number of choices * @param BINARY Whether to allow rating of this poll * @param SHORT_INTEGER Whether comments are allowed (0=no, 1=yes, 2=review style) * @param BINARY Whether to allow trackbacking on this poll * @param LONG_TEXT Notes about this poll */ function edit_poll($id, $question, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $a10, $num_options, $allow_rating, $allow_comments, $allow_trackbacks, $notes) { log_it('EDIT_POLL', strval($id), $question); persistant_cache_delete('POLL'); $rows = $GLOBALS['SITE_DB']->query_select('poll', array('*'), array('id' => $id), '', 1); $_question = $rows[0]['question']; $_a1 = $rows[0]['option1']; $_a2 = $rows[0]['option2']; $_a3 = $rows[0]['option3']; $_a4 = $rows[0]['option4']; $_a5 = $rows[0]['option5']; $_a6 = $rows[0]['option6']; $_a7 = $rows[0]['option7']; $_a8 = $rows[0]['option8']; $_a9 = $rows[0]['option9']; $_a10 = $rows[0]['option10']; $GLOBALS['SITE_DB']->query_update('poll', array('edit_date' => time(), 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'allow_trackbacks' => $allow_trackbacks, 'notes' => $notes, 'num_options' => $num_options, 'question' => lang_remap_comcode($_question, $question), 'option1' => lang_remap_comcode($_a1, $a1), 'option2' => lang_remap_comcode($_a2, $a2), 'option3' => lang_remap_comcode($_a3, $a3), 'option4' => lang_remap_comcode($_a4, $a4), 'option5' => lang_remap_comcode($_a5, $a5), 'option6' => lang_remap_comcode($_a6, $a6), 'option7' => lang_remap_comcode($_a7, $a7), 'option8' => lang_remap_comcode($_a8, $a8), 'option9' => lang_remap_comcode($_a9, $a9), 'option10' => lang_remap_comcode($_a10, $a10)), array('id' => $id), '', 1); decache('main_poll'); require_code('urls2'); suggest_new_idmoniker_for('polls', 'view', strval($id), $question); require_code('feedback'); update_spacer_post($allow_comments != 0, 'polls', strval($id), build_url(array('page' => 'polls', 'type' => 'view', 'id' => $id), get_module_zone('polls'), NULL, false, false, true), $question, get_value('comment_forum__polls')); }
/** * Edit a calendar event. * * @param AUTO_LINK The ID of the event * @param ?AUTO_LINK The event type (NULL: default) * @param SHORT_TEXT The recurrence code * @param ?integer The number of recurrences (NULL: none/infinite) * @param BINARY Whether to segregate the comment-topics/rating/trackbacks per-recurrence * @param SHORT_TEXT The title of the event * @param LONG_TEXT The full text describing the event * @param integer The priority * @range 1 5 * @param BINARY Whether it is a public event * @param ?integer The year the event starts at (NULL: default) * @param ?integer The month the event starts at (NULL: default) * @param ?integer The day the event starts at (NULL: default) * @param ?integer The hour the event starts at (NULL: default) * @param ?integer The minute the event starts at (NULL: default) * @param ?integer The year the event ends at (NULL: not a multi day event) * @param ?integer The month the event ends at (NULL: not a multi day event) * @param ?integer The day the event ends at (NULL: not a multi day event) * @param ?integer The hour the event ends at (NULL: not a multi day event) * @param ?integer The minute the event ends at (NULL: not a multi day event) * @param ?ID_TEXT The timezone for the event (NULL: current user's timezone) * @param BINARY Whether the time should be presented in the viewer's own timezone * @param SHORT_TEXT Meta keywords * @param LONG_TEXT Meta description * @param BINARY Whether the download has been validated * @param BINARY Whether the download may be rated * @param SHORT_INTEGER Whether comments are allowed (0=no, 1=yes, 2=review style) * @param BINARY Whether the download may be trackbacked * @param LONG_TEXT Hidden notes pertaining to the download */ function edit_calendar_event($id, $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, $meta_keywords, $meta_description, $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes) { $myrows = $GLOBALS['SITE_DB']->query_select('calendar_events', array('e_title', 'e_content', 'e_submitter'), array('id' => $id), '', 1); $myrow = $myrows[0]; require_code('urls2'); suggest_new_idmoniker_for('calendar', 'view', strval($id), $title); require_code('seo2'); seo_meta_set_for_explicit('event', strval($id), $meta_keywords, $meta_description); require_code('attachments2'); require_code('attachments3'); if (!addon_installed('unvalidated')) { $validated = 1; } require_code('submit'); $just_validated = !content_validated('event', strval($id)) && $validated == 1; if ($just_validated) { send_content_validated_notification('event', strval($id)); } $GLOBALS['SITE_DB']->query_update('calendar_events', array('e_title' => lang_remap($myrow['e_title'], $title), 'e_content' => update_lang_comcode_attachments($myrow['e_content'], $content, 'calendar', strval($id), NULL, false, $myrow['e_submitter']), 'e_edit_date' => time(), 'e_recurrence' => $recurrence, 'e_recurrences' => $recurrences, 'e_seg_recurrences' => $seg_recurrences, 'e_start_year' => $start_year, 'e_start_month' => $start_month, 'e_start_day' => $start_day, 'e_start_hour' => $start_hour, 'e_start_minute' => $start_minute, 'e_end_year' => $end_year, 'e_end_month' => $end_month, 'e_end_day' => $end_day, 'e_end_hour' => $end_hour, 'e_end_minute' => $end_minute, 'e_timezone' => $timezone, 'e_do_timezone_conv' => $do_timezone_conv, 'e_is_public' => $is_public, 'e_priority' => $priority, 'e_type' => $type, 'validated' => $validated, 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'allow_trackbacks' => $allow_trackbacks, 'notes' => $notes), array('id' => $id), '', 1); $self_url = build_url(array('page' => 'calendar', 'type' => 'view', 'id' => $id), get_module_zone('calendar'), NULL, false, false, true); if ($just_validated) { require_lang('calendar'); require_code('notifications'); $subject = do_lang('CALENDAR_EVENT_NOTIFICATION_MAIL_SUBJECT', get_site_name(), strip_comcode($title)); $mail = do_lang('CALENDAR_EVENT_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($title), array($self_url->evaluate())); dispatch_notification('calendar_event', strval($type), $subject, $mail); } decache('side_calendar'); require_code('feedback'); update_spacer_post($allow_comments != 0, 'events', strval($id), $self_url, $title, get_value('comment_forum__calendar')); log_it('EDIT_CALENDAR_EVENT', strval($id), $title); }
/** * Edit the specified catalogue entry * * @param AUTO_LINK The ID of the entry being edited * @param AUTO_LINK The ID of the category that the entry is in * @param BINARY Whether the entry has been validated * @param LONG_TEXT Hidden notes pertaining to the entry * @param BINARY Whether the entry may be rated * @param SHORT_INTEGER Whether comments are allowed (0=no, 1=yes, 2=review style) * @param BINARY Whether the entry may be trackbacked * @param array A map of field IDs, to values, that defines the entries settings * @param ?SHORT_TEXT Meta keywords for this resource (NULL: do not edit) * @param ?LONG_TEXT Meta description for this resource (NULL: do not edit) */ function actual_edit_catalogue_entry($id, $category_id, $validated, $notes, $allow_rating, $allow_comments, $allow_trackbacks, $map, $meta_keywords = '', $meta_description = '') { $catalogue_name = $GLOBALS['SITE_DB']->query_value('catalogue_categories', 'c_name', array('id' => $category_id)); $catalogue_title = get_translated_text($GLOBALS['SITE_DB']->query_value('catalogues', 'c_title', array('c_name' => $catalogue_name))); $_fields = list_to_map('id', $GLOBALS['SITE_DB']->query_select('catalogue_fields', array('id', 'cf_type'), array('c_name' => $catalogue_name))); $fields = collapse_2d_complexity('id', 'cf_type', $_fields); $original_submitter = $GLOBALS['SITE_DB']->query_value('catalogue_entries', 'ce_submitter', array('id' => $id)); $old_category_id = $GLOBALS['SITE_DB']->query_value('catalogue_entries', 'cc_id', array('id' => $id)); if (!addon_installed('unvalidated')) { $validated = 1; } require_code('submit'); $was_validated = content_validated('catalogue_entry', strval($id)); $just_validated = !$was_validated && $validated == 1; if ($just_validated) { send_content_validated_notification('catalogue_entry', strval($id)); } $GLOBALS['SITE_DB']->query_update('catalogue_entries', array('ce_edit_date' => time(), 'cc_id' => $category_id, 'ce_validated' => $validated, 'notes' => $notes, 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'allow_trackbacks' => $allow_trackbacks), array('id' => $id), '', 1); require_code('fields'); $title = NULL; foreach ($map as $field_id => $val) { if (is_null($title)) { $title = $val; } $type = $fields[$field_id]; $ob = get_fields_hook($type); list(, , $sup_table_name) = $ob->get_field_value_row_bits($_fields[$field_id]); if (substr($sup_table_name, -6) == '_trans') { $_val = $GLOBALS['SITE_DB']->query_value_null_ok('catalogue_efv_' . $sup_table_name, 'cv_value', array('cf_id' => $field_id, 'ce_id' => $id)); if (is_null($_val)) { $_val = insert_lang_comcode($val, 3); } else { if ($type == 'posting_field') { require_code('attachments2'); require_code('attachments3'); $_val = update_lang_comcode_attachments($_val, $val, 'catalogue_entry', strval($id), NULL, false, $original_submitter); } else { $_val = lang_remap_comcode($_val, $val); } } $GLOBALS['SITE_DB']->query_update('catalogue_efv_' . $sup_table_name, array('cv_value' => $_val), array('cf_id' => $field_id, 'ce_id' => $id), '', 1); } else { if ($sup_table_name == 'float') { $smap = array('cv_value' => is_null($val) || $val == '' ? NULL : floatval($val)); } elseif ($sup_table_name == 'integer') { $smap = array('cv_value' => is_null($val) || $val == '' ? NULL : intval($val)); } else { $smap = array('cv_value' => $val); } $GLOBALS['SITE_DB']->query_update('catalogue_efv_' . $sup_table_name, $smap, array('cf_id' => $field_id, 'ce_id' => $id), '', 1); } } require_code('urls2'); suggest_new_idmoniker_for('catalogues', 'entry', strval($id), strip_comcode($title)); require_code('seo2'); seo_meta_set_for_explicit('catalogue_entry', strval($id), $meta_keywords, $meta_description); $self_url = build_url(array('page' => 'catalogues', 'type' => 'entry', 'id' => $id), get_module_zone('catalogues'), NULL, false, false, true); if ($category_id != $old_category_id || $was_validated != ($validated == 1)) { calculate_category_child_count_cache($category_id); if ($category_id != $old_category_id) { calculate_category_child_count_cache($old_category_id); } } decache('main_cc_embed'); decache('main_recent_cc_entries'); if ($catalogue_name[0] != '_') { log_it('EDIT_CATALOGUE_ENTRY', strval($id), $title); if ($just_validated) { require_lang('catalogues'); require_code('notifications'); $subject = do_lang('CATALOGUE_ENTRY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), strip_comcode($title), array($catalogue_title)); $mail = do_lang('CATALOGUE_ENTRY_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape(strip_comcode($title)), array(comcode_escape($self_url->evaluate()), comcode_escape($catalogue_title))); dispatch_notification('catalogue_entry__' . $catalogue_name, strval($id), $subject, $mail); } } require_code('feedback'); update_spacer_post($allow_comments != 0, 'catalogues', strval($id), $self_url, $title, get_value('comment_forum__catalogues__' . $catalogue_name)); }