/** * The UI to show a video. * * @param ?string Alternate category name to use (NULL: use standard one). This is useful if you are overriding this code to show images in virtual galleries. * @param ?tempcode Breadcrumbs (NULL: derive in this function). * @return tempcode The UI */ function show_video($category_name = NULL, $tree = NULL) { $id = get_param_integer('id'); if (get_param_integer('ajax', 0) == 1) { header('Content-type: text/xml'); } list($sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos) = $this->get_sort_order(); if (addon_installed('awards')) { require_code('awards'); $awards = find_awards_for('video', strval($id)); } else { $awards = array(); } // Pic up some info $rows = $GLOBALS['SITE_DB']->query_select('videos', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { return warn_screen(get_page_title('ERROR_OCCURRED'), do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $rows[0]; $url = $myrow['url']; if (url_is_local($url)) { $url = get_custom_base_url() . '/' . $url; } $cat = $myrow['cat']; $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=galleries&filter=' . urlencode($cat); if (get_value('no_individual_gallery_view') === '1' && $GLOBALS['SITE_DB']->query_value('galleries', 'flow_mode_interface', array('name' => $cat)) == '1') { require_code('site2'); assign_refresh(build_url(array('page' => '_SELF', 'type' => 'misc', 'id' => $cat, 'probe_id' => $id, 'probe_type' => 'video'), '_SELF'), 0.0); } $true_category_name = get_translated_text($GLOBALS['SITE_DB']->query_value('galleries', 'fullname', array('name' => $cat))); if (is_null($category_name)) { $category_name = $true_category_name; } if (get_param_integer('slideshow', 0) == 1) { $title = get_page_title('VIEW_SLIDESHOW', true, array(escape_html($category_name))); global $EXTRA_HEAD; $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />'); // XHTMLXHTML } else { $title = get_page_title(get_translated_text($myrow['title']) == '' ? 'VIEW_VIDEO' : '_VIEW_VIDEO', true, array(escape_html(get_translated_text($myrow['title']))), NULL, $awards); } $root = get_param('root', 'root'); seo_meta_load_for('video', strval($id)); $thumb_url = $myrow['thumb_url']; if (url_is_local($thumb_url)) { $thumb_url = get_custom_base_url() . '/' . $thumb_url; } if (!has_category_access(get_member(), 'galleries', $cat)) { access_denied('CATEGORY_ACCESS'); } // Views if (get_db_type() != 'xml') { $myrow['video_views']++; $GLOBALS['SITE_DB']->query_update('videos', array('video_views' => $myrow['video_views']), array('id' => $id), '', 1, NULL, false, true); } list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems('videos', strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], $myrow['validated'], $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'video', 'id' => $id), '_SELF', NULL, false, false, true), get_translated_text($myrow['title']) == '' ? do_lang('VIEW_VIDEO_IN', $true_category_name) : get_translated_text($myrow['title']), get_value('comment_forum__videos')); // Validation if ($myrow['validated'] == 0) { if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) { access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated'); } $warning_details = do_template('WARNING_TABLE', array('_GUID' => 'b32faacba974e648a67e5e91ffd3d8e5', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT'))); } else { $warning_details = new ocp_tempcode(); } // Comments $comments = get_translated_tempcode($myrow['comments']); if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_edit_permission('mid', get_member(), $myrow['submitter'], 'cms_galleries', array('galleries', $cat))) { $edit_url = build_url(array('page' => 'cms_galleries', 'type' => '_ev', 'id' => $id), get_module_zone('cms_galleries')); } else { $edit_url = new ocp_tempcode(); } $add_date = get_timezoned_date($myrow['add_date']); $edit_date = is_null($myrow['edit_date']) ? '' : get_timezoned_date($myrow['edit_date']); // Video HTML $video = show_gallery_media($url, $thumb_url, $myrow['video_width'], $myrow['video_height'], $myrow['video_length']); $extension = get_file_extension($url); require_code('mime_types'); $mime_type = get_mime_type($extension); list($n, $x, $nav) = $this->build_set_navigation(db_string_equal_to('cat', $cat), '', $category_name, $id, $root, 'video', get_param_integer('slideshow', 0), get_param_integer('wide_high', 0), get_param_integer('start', 0), get_param_integer('max', get_default_gallery_max()), $cat, $sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos, get_param('select', '*'), get_param('video_select', '*')); $member_id = get_member_id_from_gallery_name($cat, NULL, true); if (get_forum_type() == 'ocf') { require_code('ocf_members'); require_code('ocf_members2'); } $member_details = is_null($member_id) || get_forum_type() != 'ocf' ? new ocp_tempcode() : ocf_show_member_box($member_id); $video_details = show_video_details($myrow); if (is_null($tree)) { $tree = gallery_breadcrumbs($cat, $root, false, get_module_zone('galleries')); } breadcrumb_add_segment($tree, do_lang_tempcode('VIEW_VIDEO')); $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Video', 'title' => get_translated_text($myrow['title']), 'identifier' => '_SEARCH:galleries:video:' . strval($id), 'description' => get_translated_text($myrow['comments']), 'image' => $thumb_url, 'video' => $url, 'video:height' => strval($myrow['video_height']), 'video:width' => strval($myrow['video_width']), 'video:type' => $mime_type); return do_template('GALLERY_ENTRY_SCREEN', array('_GUID' => '91e231906ed899513ec2db8a2974dddf', 'MEDIA_TYPE' => 'video', 'E_TITLE' => get_translated_text($myrow['title']), 'CAT' => $cat, 'SLIDESHOW' => get_param_integer('slideshow', 0) == 1, 'TRUE_GALLERY_TITLE' => $true_category_name, 'GALLERY_TITLE' => $category_name, 'MEMBER_ID' => is_null($member_id) ? '' : strval($member_id), 'ID' => strval($id), 'TAGS' => get_loaded_tags('videos'), 'TITLE' => $title, 'SUBMITTER' => strval($myrow['submitter']), 'URL' => $url, 'VIDEO_DETAILS' => $video_details, 'MEMBER_DETAILS' => $member_details, 'X' => integer_format($x), 'N' => integer_format($n), 'VIEWS' => integer_format($myrow['video_views']), 'ADD_DATE_RAW' => strval($myrow['add_date']), 'EDIT_DATE_RAW' => is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']), 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'RATING_DETAILS' => $rating_details, 'TRACKBACK_DETAILS' => $trackback_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'NAV' => $nav, 'COMMENTS' => $comments, 'VIDEO' => $video, 'WARNING_DETAILS' => $warning_details)); }
/** * The UI to view an IOTD. * * @return tempcode The UI */ function view() { $title = get_page_title('IOTD'); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('IOTD_ARCHIVE')))); $id = get_param_integer('id'); $rows = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { return warn_screen($title, do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $rows[0]; list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], is_null($myrow['date_and_time']) && $myrow['used'] == 0 ? 0 : 1, $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF', NULL, false, false, true), get_translated_text($myrow['i_title']), get_value('comment_forum__iotds')); $date_raw = strval($myrow['date_and_time']); $add_date_raw = strval($myrow['add_date']); $edit_date_raw = is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']); $date = get_timezoned_date($myrow['date_and_time']); $add_date = get_timezoned_date($myrow['add_date']); $edit_date = get_timezoned_date($myrow['edit_date']); // Views if (get_db_type() != 'xml') { $myrow['iotd_views']++; $GLOBALS['SITE_DB']->query_update('iotd', array('iotd_views' => $myrow['iotd_views']), array('id' => $id), '', 1, NULL, false, true); } if (has_actual_page_access(NULL, 'cms_iotds', NULL, NULL) && has_edit_permission('high', get_member(), $myrow['submitter'], 'cms_iotds')) { $edit_url = build_url(array('page' => 'cms_iotds', 'type' => '_ed', 'id' => $id), get_module_zone('cms_iotds')); } else { $edit_url = new ocp_tempcode(); } $url = $myrow['url']; if (url_is_local($url)) { $url = get_custom_base_url() . '/' . $url; } $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Poll', 'title' => get_translated_text($myrow['i_title']), 'identifier' => '_SEARCH:iotds:view:' . strval($id), 'description' => '', 'image' => $url); return do_template('IOTD_VIEW_SCREEN', array('_GUID' => 'f508d483459b88fab44cd8b9f4db780b', 'TITLE' => $title, 'SUBMITTER' => strval($myrow['submitter']), 'I_TITLE' => get_translated_tempcode($myrow['i_title']), 'CAPTION' => get_translated_tempcode($myrow['caption']), 'DATE_RAW' => $date_raw, 'ADD_DATE_RAW' => $add_date_raw, 'EDIT_DATE_RAW' => $edit_date_raw, 'DATE' => $date, 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'VIEWS' => integer_format($myrow['iotd_views']), 'TRACKBACK_DETAILS' => $trackback_details, 'RATING_DETAILS' => $rating_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'URL' => $url)); }
/** * The UI to view a download. * * @return tempcode The UI */ function dloadinfo_screen() { $id = get_param_integer('id'); $root = get_param_integer('root', db_get_first_id(), true); // Basic Init $rows = $GLOBALS['SITE_DB']->query_select('download_downloads', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { return warn_screen(get_page_title('SECTION_DOWNLOADS'), do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $rows[0]; $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=downloads&filter=' . strval($myrow['category_id']); if (!has_category_access(get_member(), 'downloads', strval($myrow['category_id']))) { access_denied('CATEGORY_ACCESS'); } $name = get_translated_text($myrow['name']); list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], $myrow['validated'], $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'entry', 'id' => $id), '_SELF', NULL, false, false, true), $name, get_value('comment_forum__downloads')); // Views if (get_db_type() != 'xml') { $myrow['download_views']++; $GLOBALS['SITE_DB']->query_update('download_downloads', array('download_views' => $myrow['download_views']), array('id' => $id), '', 1, NULL, false, true); } // Tree $tree = download_breadcrumbs($myrow['category_id'], $root, false, get_zone_name()); $title_to_use = do_lang_tempcode('DOWNLOAD_TITLE', escape_html($name)); $title_to_use_2 = do_lang('DOWNLOAD_TITLE', $name); if (addon_installed('awards')) { require_code('awards'); $awards = find_awards_for('download', strval($id)); } else { $awards = array(); } $title = get_page_title($title_to_use, false, NULL, NULL, $awards); seo_meta_load_for('downloads_download', strval($id), $title_to_use_2); $warning_details = new ocp_tempcode(); // Validation if ($myrow['validated'] == 0) { if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) { access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated'); } $warning_details->attach(do_template('WARNING_TABLE', array('_GUID' => '5b1781b8fbb1ef9b8f47693afcff02b9', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')))); } // Cost warning if ($myrow['download_cost'] != 0 && addon_installed('points')) { require_lang('points'); $warning_details->attach(do_template('WARNING_TABLE', array('_GUID' => '05fc448bf79b373385723c5af5ec93af', 'WARNING' => do_lang_tempcode('WILL_COST', integer_format($myrow['download_cost']))))); } // Admin functions $edit_url = new ocp_tempcode(); $add_img_url = new ocp_tempcode(); if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_edit_permission('mid', get_member(), $myrow['submitter'], 'cms_downloads', array('downloads', $myrow['category_id']))) { $edit_url = build_url(array('page' => 'cms_downloads', 'type' => '_ed', 'id' => $id), get_module_zone('cms_downloads')); } if (addon_installed('galleries')) { if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_edit_permission('mid', get_member(), $myrow['submitter'], 'cms_galleries', array('galleries', 'download_' . strval($id)))) { require_lang('galleries'); $add_img_url = build_url(array('page' => 'cms_galleries', 'type' => 'ad', 'cat' => 'download_' . strval($id)), get_module_zone('cms_galleries')); } } // Outmoding if (!is_null($myrow['out_mode_id'])) { $outmode_url = build_url(array('page' => '_SELF', 'type' => 'entry', 'id' => $myrow['out_mode_id'], 'root' => $root == db_get_first_id() ? NULL : $root), '_SELF'); } else { $outmode_url = new ocp_tempcode(); } // Stats $add_date = get_timezoned_date($myrow['add_date'], false); // Additional information $additional_details = get_translated_tempcode($myrow['comments']); // Edit date if (!is_null($myrow['edit_date'])) { $edit_date = make_string_tempcode(get_timezoned_date($myrow['edit_date'], false)); } else { $edit_date = new ocp_tempcode(); } $images_details = new ocp_tempcode(); $image_url = ''; $counter = 0; if (addon_installed('galleries')) { // Images require_lang('galleries'); $cat = 'download_' . strval($id); $map = array('cat' => $cat); if (!has_specific_permission(get_member(), 'see_unvalidated')) { $map['validated'] = 1; } $rows = $GLOBALS['SITE_DB']->query_select('images', array('*'), $map, 'ORDER BY id', 200); $div = 2; $_out = new ocp_tempcode(); $_row = new ocp_tempcode(); require_code('images'); while (array_key_exists($counter, $rows)) { $row = $rows[$counter]; // $view_url=build_url(array('page'=>'galleries','type'=>'image','wide'=>1,'id'=>$row['id']),get_module_zone('galleries')); $view_url = $row['url']; if ($image_url == '') { $image_url = $row['url']; } if (url_is_local($view_url)) { $view_url = get_custom_base_url() . '/' . $view_url; } $thumb_url = ensure_thumbnail($row['url'], $row['thumb_url'], 'galleries', 'images', $row['id']); $comment = get_translated_tempcode($row['comments']); $thumb = do_image_thumb($thumb_url, ''); if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_edit_permission('mid', get_member(), $row['submitter'], 'cms_galleries', array('galleries', 'download_' . strval($id)))) { $iedit_url = build_url(array('page' => 'cms_galleries', 'type' => '_ed', 'id' => $row['id']), get_module_zone('cms_galleries')); } else { $iedit_url = new ocp_tempcode(); } $_content = do_template('DOWNLOAD_SCREEN_IMAGE', array('_GUID' => 'fba0e309aa0ae04891e32c65a625b177', 'ID' => strval($row['id']), 'VIEW_URL' => $view_url, 'EDIT_URL' => $iedit_url, 'THUMB' => $thumb, 'COMMENT' => $comment)); $_row->attach(do_template('DOWNLOAD_GALLERY_IMAGE_CELL', array('_GUID' => '8400a832dbed64bb63f264eb3a038895', 'CONTENT' => $_content))); if ($counter % $div == 1 && $counter != 0) { $_out->attach(do_template('DOWNLOAD_GALLERY_ROW', array('_GUID' => '205c4f5387e98c534d5be1bdfcccdd7d', 'CELLS' => $_row))); $_row = new ocp_tempcode(); } $counter++; } if (!$_row->is_empty()) { $_out->attach(do_template('DOWNLOAD_GALLERY_ROW', array('_GUID' => 'e9667ca2545ac72f85a873f236cbbd6f', 'CELLS' => $_row))); } $images_details = $_out; } // Download link $author = $myrow['author']; $author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $author), get_module_zone('authors')) : new ocp_tempcode(); // Licence $licence_title = NULL; $licence_url = NULL; $licence_hyperlink = NULL; $licence = $myrow['download_licence']; if (!is_null($licence)) { $licence_title = $GLOBALS['SITE_DB']->query_value_null_ok('download_licences', 'l_title', array('id' => $licence)); if (!is_null($licence_title)) { $keep = symbol_tempcode('KEEP'); $licence_url = find_script('download_licence') . '?id=' . strval($licence) . $keep->evaluate(); $licence_hyperlink = do_template('HYPERLINK_POPUP_WINDOW', array('_GUID' => '10582f28c37ee7e9e462fdbd6a2cb8dd', 'TITLE' => '', 'CAPTION' => $licence_title, 'URL' => $licence_url, 'WIDTH' => '600', 'HEIGHT' => '500', 'REL' => 'license')); } else { $licence = NULL; // Orphaned } } breadcrumb_add_segment($tree, $title_to_use); $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => $myrow['author'], 'publisher' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Download', 'title' => get_translated_text($myrow['name']), 'identifier' => '_SEARCH:downloads:view:' . strval($id), 'description' => get_translated_text($myrow['description']), 'image' => $image_url); return do_template('DOWNLOAD_SCREEN', array('_GUID' => 'a9af438f84783d0d38c20b5f9a62dbdb', 'ORIGINAL_FILENAME' => $myrow['original_filename'], 'URL' => $myrow['url'], 'NUM_IMAGES' => strval($counter), 'TAGS' => get_loaded_tags('downloads'), 'LICENCE' => is_null($licence) ? NULL : strval($licence), 'LICENCE_TITLE' => $licence_title, 'LICENCE_HYPERLINK' => $licence_hyperlink, 'SUBMITTER' => strval($myrow['submitter']), 'EDIT_DATE' => $edit_date, 'EDIT_DATE_RAW' => is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']), 'VIEWS' => integer_format($myrow['download_views']), 'NAME' => $name, 'DATE' => $add_date, 'DATE_RAW' => strval($myrow['add_date']), 'NUM_DOWNLOADS' => integer_format($myrow['num_downloads']), 'TITLE' => $title, 'OUTMODE_URL' => $outmode_url, 'WARNING_DETAILS' => $warning_details, 'EDIT_URL' => $edit_url, 'ADD_IMG_URL' => $add_img_url, 'DESCRIPTION' => get_translated_tempcode($myrow['description']), 'ADDITIONAL_DETAILS' => $additional_details, 'IMAGES_DETAILS' => $images_details, 'ID' => strval($id), 'FILE_SIZE' => clean_file_size($myrow['file_size']), 'AUTHOR_URL' => $author_url, 'AUTHOR' => $author, 'TRACKBACK_DETAILS' => $trackback_details, 'RATING_DETAILS' => $rating_details, 'COMMENTS_DETAILS' => $comment_details)); }
/** * Get a map of the fields for the given entry. * * @param array A database row of the entry we are working with * @param ?array A database row of the catalogue we are working with (NULL: read it in here) * @param ID_TEXT The view type we're doing * @set PAGE SEARCH CATEGORY * @param ID_TEXT The template set we are rendering this category using * @param ?AUTO_LINK The virtual root for display of this category (NULL: none) * @param ?array The database rows for the fields for this catalogue (NULL: find them) * @param ?array A list of fields that we are limiting ourselves to (NULL: get ALL fields) * @param boolean Whether to grab the feedback details * @param boolean Whether to grab the tree details * @param ?integer Field index to order by (NULL: none) * @return array A map of information relating to the entry. The map contains 'FIELDS' (tempcode for all accumulated fields), 'FIELD_x' (for each field x applying to the entry), STAFF_DETAILS, COMMENT_DETAILS, RATING_DETAILS, VIEW_URL, TREE (tempcode category tree to this entry) */ function get_catalogue_entry_map($entry, $catalogue, $view_type, $tpl_set, $root = NULL, $fields = NULL, $only_fields = NULL, $feedback_details = false, $tree_details = false, $order_by = NULL) { $id = $entry['id']; if (is_null($catalogue)) { $catalogue_rows = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $entry['c_name']), '', 1); if (!array_key_exists(0, $catalogue_rows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $catalogue = $catalogue_rows[0]; } // Views if (get_db_type() != 'xml') { $entry['ce_views']++; } $catalogue_name = $catalogue['c_name']; $fields = get_catalogue_entry_field_values($catalogue_name, $entry, $only_fields, $fields, false, $view_type); $map = array(); $map['FIELDS'] = new ocp_tempcode(); $map['FIELDS_TABLE'] = new ocp_tempcode(); $map['fields'] = $fields; $fields_1d = array(); $fields_2d = array(); $all_visible = true; require_code('fields'); foreach ($fields as $i => $field) { if (!array_key_exists('effective_value', $field)) { $all_visible = false; continue; } $ev = $field['effective_value']; $dereference_ev = is_object($field['effective_value']) ? $field['effective_value']->evaluate() : $field['effective_value']; $use_ev = $dereference_ev; $ob = get_fields_hook($field['cf_type']); $use_ev = $ob->render_field_value($field, $ev, $i, $only_fields); if ($i == 0 && $catalogue['c_display_type'] == 1) { //$use_ev=hyperlink(build_url(array('page'=>'catalogues','type'=>'entry','id'=>$id,'root'=>$root),get_module_zone('catalogues')),$ev,false,!is_object($ev)); $use_ev = $ev; } //Set image thumbnail in to the map array if ($field['cf_type'] == 'picture') { if (!is_null($ev) && $dereference_ev != '') { require_code('images'); $map['FIELD_' . strval($i) . '_THUMB'] = do_image_thumb($dereference_ev, $i == 0 ? '' : (is_object($map['FIELD_0']) ? $map['FIELD_0']->evaluate() : $map['FIELD_0']), false, false, 100, 100); } else { $map['FIELD_' . strval($i) . '_THUMB'] = new ocp_tempcode(); } $map['_FIELD_' . strval($field['id']) . '_THUMB'] = $map['FIELD_' . strval($i) . '_THUMB']; } $map['FIELD_' . strval($i)] = $use_ev; $map['_FIELD_' . strval($field['id'])] = $use_ev; $map['FIELD_' . strval($i) . '_PLAIN'] = $ev; $map['_FIELD_' . strval($field['id']) . '_PLAIN'] = $ev; if (array_key_exists('effective_value_pure', $field)) { $map['FIELD_' . strval($i) . '_PURE'] = $field['effective_value_pure']; $map['_FIELD_' . strval($field['id']) . '_PURE'] = $field['effective_value_pure']; } $field_name = get_translated_text($field['cf_name']); $map['FIELDNAME_' . strval($i)] = $field_name; $fields_2d[] = array('NAME' => $field_name, 'VALUE' => $use_ev); $field_type = $field['cf_type']; $map['FIELDTYPE_' . strval($i)] = $field_type; if ($view_type == 'PAGE' || $field['cf_put_in_category'] == 1 && $view_type == 'CATEGORY' || $field['cf_put_in_search'] == 1 && $view_type == 'SEARCH') { $use_ev_enhanced = $use_ev; /*if (($view_type!='PAGE') && ($i==0) && (($field['cf_type']=='short_trans') || ($field['cf_type']=='short_text'))) { foreach ($fields as $field_temp) { if ((array_key_exists('effective_value',$field_temp)) && ($field_temp['cf_type']=='url') && (!((($field_temp['cf_put_in_category']==1) && ($view_type=='CATEGORY')) || (($field_temp['cf_put_in_search']==1) && ($view_type=='SEARCH')))) && ($field_temp['cf_visible']==1)) { if ($field_temp['effective_value']!='') { $use_ev_enhanced=hyperlink($field_temp['effective_value'],$use_ev,true); break; } } } }*/ if ($field['cf_visible'] == 1 || $i == 0) { $_field = do_template('CATALOGUE_' . $tpl_set . '_ENTRY_FIELD', array('ENTRYID' => strval($id), 'CATALOGUE' => $catalogue_name, 'TYPE' => $field['cf_type'], 'FIELD' => $field_name, 'FIELDID' => strval($i), '_FIELDID' => strval($field['id']), 'FIELDTYPE' => $field_type, 'VALUE_PLAIN' => $ev, 'VALUE' => $use_ev_enhanced), NULL, false, 'CATALOGUE_DEFAULT_ENTRY_FIELD'); if (!is_string($ev) || $ev != '') { $map['FIELDS']->attach($_field); } $_field = do_template('CATALOGUE_' . $tpl_set . '_TAB_FIELD', array('ENTRYID' => strval($id), 'CATALOGUE' => $catalogue_name, 'TYPE' => $field['cf_type'], 'FIELD' => $field_name, 'FIELDID' => strval($i), '_FIELDID' => strval($field['id']), 'FIELDTYPE' => $field_type, 'VALUE_PLAIN' => $ev, 'VALUE' => $use_ev_enhanced), NULL, false, 'CATALOGUE_DEFAULT_TAB_FIELD'); $map['FIELDS_TABLE']->attach($_field); } } else { $all_visible = false; } $fields_1d[] = $field; if (!($field['cf_visible'] == 1 || $i == 0 || $order_by === $i)) { $all_visible = false; } } $map['FIELDS_1D'] = $fields_1d; $map['FIELDS_2D'] = $fields_2d; // Admin functions if (has_actual_page_access(NULL, 'cms_catalogues', NULL, NULL) && has_edit_permission('mid', get_member(), $entry['ce_submitter'], 'cms_catalogues', array('catalogues_catalogue', $catalogue_name, 'catalogues_category', $entry['cc_id']))) { $map['EDIT_URL'] = build_url(array('page' => 'cms_catalogues', 'type' => '_edit_entry', 'catalogue_name' => $catalogue_name, 'id' => $id), get_module_zone('cms_catalogues')); } else { $map['EDIT_URL'] = ''; } $map['SUBMITTER'] = strval($entry['ce_submitter']); $map['VIEWS'] = strval($entry['ce_views']); $map['ADD_DATE_RAW'] = strval($entry['ce_add_date']); $map['EDIT_DATE_RAW'] = is_null($entry['ce_edit_date']) ? '' : strval($entry['ce_edit_date']); $map['ADD_DATE'] = get_timezoned_date($entry['ce_add_date']); $map['EDIT_DATE'] = get_timezoned_date($entry['ce_edit_date']); $map['ID'] = strval($id); if (get_option('is_on_comments') == '1' && !has_no_forum() && $entry['allow_comments'] >= 1) { $map['COMMENT_COUNT'] = '1'; } // Feedback //Set basic rating display of item to the map array require_code('feedback'); $c_value = array_key_exists('FIELD_0_PLAIN_PURE', $map) ? $map['FIELD_0_PLAIN_PURE'] : $map['FIELD_0_PLAIN']; if (is_object($c_value)) { $c_value = $c_value->evaluate(); } $self_url = build_url(array('page' => 'catalogues', 'type' => 'entry', 'id' => $id), get_module_zone('catalogues'), NULL, false, false, true); if ($feedback_details || $only_fields !== array(0)) { $map['RATING'] = $entry['allow_rating'] == 1 ? display_rating($self_url, $c_value, 'catalogues__' . $catalogue_name, strval($id), 'RATING_INLINE_STATIC', $entry['ce_submitter']) : new ocp_tempcode(); } if ($feedback_details) { list($map['RATING_DETAILS'], $map['COMMENT_DETAILS'], $map['TRACKBACK_DETAILS']) = embed_feedback_systems('catalogues__' . $catalogue_name, strval($id), $entry['allow_rating'], $entry['allow_comments'], $entry['allow_trackbacks'], $entry['ce_validated'], $entry['ce_submitter'], $self_url, $c_value, get_value('comment_forum__catalogues__' . $catalogue_name)); } if (get_option('is_on_comments') == '1' && $entry['allow_comments'] >= 1 || get_option('is_on_rating') == '1' && $entry['allow_rating'] == 1 || get_option('is_on_trackbacks') == '1' && $entry['allow_trackbacks'] == 1 || !$all_visible) { $map['VIEW_URL'] = $tpl_set == 'WML' ? make_string_tempcode('wap.php?page=catalogues&type=entry&id=' . strval($id)) : build_url(array('page' => 'catalogues', 'type' => 'entry', 'id' => $id, 'root' => $root == -1 ? NULL : $root), get_module_zone('catalogues')); } else { $map['VIEW_URL'] = ''; } if ($tree_details) { $map['TREE'] = ''; if ($catalogue['c_is_tree'] == 1 && is_null($only_fields)) { $tree = catalogue_category_breadcrumbs($entry['cc_id'], $root, false); $map['TREE'] = $tree; } } $map['CATALOGUE'] = $catalogue_name; $map['CAT'] = strval($entry['cc_id']); return $map; }
/** * View an event. * * @return tempcode The UI */ function view_event() { check_specific_permission('view_calendar'); global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'back'; $id = get_param_integer('id'); $filter = $this->get_filter(); $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=calendar&filter=' . implode(',', $this->get_and_filter()); $rows = $GLOBALS['SITE_DB']->query_select('calendar_events e LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'calendar_types t ON t.id=e.e_type', array('*'), array('e.id' => $id), '', 1); if (!array_key_exists(0, $rows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $event = $rows[0]; if ($event['e_is_public'] == 0) { enforce_personal_access($event['e_submitter'], 'view_personal_events'); } if (!has_category_access(get_member(), 'calendar', strval($event['e_type']))) { access_denied('CATEGORY_ACCESS'); } // Validation $warning_details = new ocp_tempcode(); if ($event['validated'] == 0 && $event['e_is_public'] == 1) { if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) { access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated'); } $warning_details->attach(do_template('WARNING_TABLE', array('_GUID' => '332faacba974e648a67e5e91ffd3d8e5', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')))); } if (addon_installed('awards')) { require_code('awards'); $awards = find_awards_for('event', strval($id)); } else { $awards = array(); } $_title = get_translated_text($event['e_title']); $title_to_use = do_lang_tempcode('CALENDAR_EVENT_VCAL', escape_html($_title)); $title_to_use_2 = do_lang('CALENDAR_EVENT', $_title); $title = get_page_title($title_to_use, false, NULL, NULL, $awards); seo_meta_load_for('event', strval($id), $title_to_use_2); $content = $event['e_type'] == db_get_first_id() ? make_string_tempcode(get_translated_text($event['e_content'])) : get_translated_tempcode($event['e_content']); $type = get_translated_text($event['t_title']); $subscribed = new ocp_tempcode(); if (has_specific_permission(get_member(), 'view_event_subscriptions') && cron_installed()) { $subscriptions = $GLOBALS['SITE_DB']->query_select('calendar_reminders', array('DISTINCT n_member_id'), array('e_id' => $id), '', 100); if (count($subscriptions) < 100) { foreach ($subscriptions as $subscription) { $username = $GLOBALS['FORUM_DRIVER']->get_username($subscription['n_member_id']); if (!is_null($username)) { $member_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($subscription['n_member_id'], false, true); $subscribed->attach(do_template('CALENDAR_SCREEN_SUBSCRIPTION', array('_GUID' => 'c756b8b3f0c57494fd46a94e9abce029', 'MEMBER_URL' => $member_url, 'USERNAME' => $username))); } } } } $__first_date = mktime($event['e_start_hour'], $event['e_start_minute'], 0, $event['e_start_month'], $event['e_start_day'], $event['e_start_year']); $_first_date = cal_utctime_to_usertime($__first_date, $event['e_timezone'], $event['e_do_timezone_conv'] == 1); $first_date = date('Y-m-d', $_first_date); $date = get_param('date', $first_date); // It's year 10,000 compliant when it comes to year display ;). $back_type = get_param('back', 'day'); $map = array_merge($filter, array('page' => '_SELF', 'type' => 'misc', 'view' => $back_type, 'id' => $date)); if (get_param_integer('member_id', get_member()) != get_member()) { $map['member_id'] = get_param_integer('member_id'); } $back_url = build_url($map, '_SELF'); list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems('events', strval($id) . ($event['e_seg_recurrences'] == 1 ? '_' . $date : ''), $event['allow_rating'], $event['allow_comments'], $event['allow_trackbacks'], get_option('is_on_strong_forum_tie') == '0' || $event['e_is_public'] == 1 ? 1 : 0, $event['e_submitter'], build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF', NULL, false, false, true), $_title, get_value('comment_forum__calendar')); $_subscriptions = new ocp_tempcode(); if (is_guest() || !cron_installed()) { $subscribe_url = new ocp_tempcode(); } else { $subscriptions = $GLOBALS['SITE_DB']->query_select('calendar_reminders', array('id', 'n_seconds_before'), array('e_id' => $id, 'n_member_id' => get_member())); foreach ($subscriptions as $subscription) { $time = display_time_period(intval($subscription['n_seconds_before'])); $unsubscribe_url = build_url(array('page' => '_SELF', 'type' => 'unsubscribe_event', 'id' => $id, 'reminder_id' => $subscription['id']), '_SELF'); $_subscriptions->attach(do_template('CALENDAR_SCREEN_PERSONAL_SUBSCRIPTION', array('_GUID' => 'cc36c75ea516abfab1c65328c0e290fc', 'UNSUBSCRIBE_URL' => $unsubscribe_url, 'TIME' => $time))); } $subscribe_url = build_url(array('page' => '_SELF', 'type' => 'subscribe_event', 'id' => $id), '_SELF'); } if (has_actual_page_access(NULL, 'cms_calendar', NULL, NULL) && has_edit_permission($event['e_is_public'] == 0 ? 'low' : 'mid', get_member(), $event['e_submitter'], 'cms_calendar', array('calendar', $event['e_type']))) { $edit_url = build_url(array('page' => 'cms_calendar', 'type' => '_ed', 'id' => $id), get_module_zone('cms_calendar')); } else { $edit_url = new ocp_tempcode(); } if ($event['e_seg_recurrences'] == 0) { $NON_CANONICAL_PARAMS[] = 'day'; $NON_CANONICAL_PARAMS[] = 'date'; } $day = get_param('day', ''); if ($day != '') { $explode = explode('-', $day); if (count($explode) == 3) { if (is_null($event['e_start_hour'])) { if (is_null($event['e_end_year']) || is_null($event['e_end_month']) || is_null($event['e_end_day'])) { $event['e_end_day'] = $event['e_start_day']; $event['e_end_month'] = $event['e_start_month']; $event['e_end_year'] = $event['e_start_year']; } } if (!is_null($event['e_end_year']) && !is_null($event['e_end_month']) && !is_null($event['e_end_day'])) { $event['e_end_year'] += intval($explode[0]) - $event['e_start_year']; $event['e_end_month'] += intval($explode[1]) - $event['e_start_month']; $event['e_end_day'] += intval($explode[2]) - $event['e_start_day']; } $event['e_start_year'] = intval($explode[0]); $event['e_start_month'] = intval($explode[1]); $event['e_start_day'] = intval($explode[2]); } } $time_raw = cal_get_start_utctime_for_event($event['e_timezone'], $event['e_start_year'], $event['e_start_month'], $event['e_start_day'], $event['e_start_hour'], $event['e_start_minute'], $event['e_do_timezone_conv'] == 1); $from = cal_utctime_to_usertime($time_raw, $event['e_timezone'], $event['e_do_timezone_conv'] == 1); $day_formatted = locale_filter(date(do_lang('calendar_date'), $from)); if (!is_null($event['e_end_year']) && !is_null($event['e_end_month']) && !is_null($event['e_end_day'])) { $to_raw = cal_get_end_utctime_for_event($event['e_timezone'], $event['e_end_year'], $event['e_end_month'], $event['e_end_day'], $event['e_end_hour'], $event['e_end_minute'], $event['e_do_timezone_conv'] == 1); $to = cal_utctime_to_usertime($to_raw, $event['e_timezone'], $event['e_do_timezone_conv'] == 1); $to_day_formatted = locale_filter(date(do_lang('calendar_date'), $to)); $time2 = date_range($from, $to, !is_null($event['e_start_hour'])); } else { $to_raw = NULL; $time2 = is_null($event['e_start_hour']) ? '' : locale_filter(my_strftime(do_lang('calendar_minute'), $from)); $to = NULL; $to_day_formatted = NULL; } $priority = $event['e_priority']; $is_public = $event['e_is_public'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO'); $recurrence = do_lang_tempcode('NA_EM'); if ($event['e_recurrence'] != 'none' && $event['e_recurrence'] != '') { $l_code = explode(' ', strtoupper($event['e_recurrence'])); $recurrence = do_lang_tempcode($l_code[0]); if (!is_null($event['e_recurrences'])) { $recurrence = do_lang_tempcode('RECURRENCE_ITERATION', $recurrence, make_string_tempcode(integer_format($event['e_recurrences']))); } } elseif ($day == '') { $day = $first_date; } $priority_lang = do_lang_tempcode('PRIORITY_' . strval($priority)); // Views if (get_db_type() != 'xml') { $event['e_views']++; $GLOBALS['SITE_DB']->query_update('calendar_events', array('e_views' => $event['e_views']), array('id' => $id), '', 1, NULL, false, true); } breadcrumb_set_parents(array(array($back_url, do_lang_tempcode('CALENDAR')))); $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $event['e_add_date']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($event['e_submitter']), 'publisher' => '', 'modified' => is_null($event['e_edit_date']) ? '' : date('Y-m-d', $event['e_edit_date']), 'type' => 'Calendar event', 'title' => get_translated_text($event['e_title']), 'identifier' => '_SEARCH:calendar:view:' . strval($id), 'description' => get_translated_text($event['e_content']), 'image' => find_theme_image('bigicons/calendar')); $map = array('TITLE' => $title, '_TITLE' => get_translated_text($event['e_title']), 'ID' => strval($id), 'TAGS' => get_loaded_tags('calendar'), 'WARNING_DETAILS' => $warning_details, 'SUBMITTER' => strval($event['e_submitter']), 'ADD_DATE' => get_timezoned_date($event['e_add_date']), 'ADD_DATE_RAW' => strval($event['e_add_date']), 'EDIT_DATE_RAW' => is_null($event['e_edit_date']) ? '' : strval($event['e_edit_date']), 'VIEWS' => integer_format($event['e_views']), 'LOGO' => $event['t_logo'], 'DAY' => $day_formatted, 'TO_DAY' => $to_day_formatted, 'RECURRENCE' => $recurrence, 'IS_PUBLIC' => $is_public, 'PRIORITY' => strval($priority), 'PRIORITY_LANG' => $priority_lang, 'TYPE' => $type, 'TIME' => $time2, 'TIME_RAW' => strval($time_raw), 'TIME_VCAL' => date('Y-m-d', $time_raw) . ' ' . date('H:i:s', $time_raw), 'TO_TIME_VCAL' => is_null($to_raw) ? NULL : date('Y-m-d', $to_raw) . ' ' . date('H:i:s', $to_raw), 'EDIT_URL' => $edit_url, 'SUBSCRIPTIONS' => $_subscriptions, 'SUBSCRIBE_URL' => $subscribe_url, 'BACK_URL' => $back_url, 'CONTENT' => $content, 'SUBSCRIBED' => $subscribed, 'RATING_DETAILS' => $rating_details, 'TRACKBACK_DETAILS' => $trackback_details, 'COMMENT_DETAILS' => $comment_details, '_GUID' => '602e6f86f586ef0a24efed950eafd426'); if ($event['e_do_timezone_conv'] == 0) { $timezone_map = get_timezone_list(); $map['TIMEZONE'] = $timezone_map[$event['e_timezone']]; } return do_template('CALENDAR_SCREEN', $map); }
/** * The UI to view a poll. * * @return tempcode The UI */ function view() { $title = get_page_title('POLL'); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('POLL_ARCHIVE')))); $id = get_param_integer('id'); $_GET['poll_id'] = strval($id); $rows = $GLOBALS['SITE_DB']->query_select('poll', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { return warn_screen($title, do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $rows[0]; // Views if (get_db_type() != 'xml') { $myrow['poll_views']++; $GLOBALS['SITE_DB']->query_update('poll', array('poll_views' => $myrow['poll_views']), array('id' => $id), '', 1, NULL, false, true); } $date_raw = is_null($myrow['date_and_time']) ? '' : strval($myrow['date_and_time']); $add_date_raw = strval($myrow['add_time']); $edit_date_raw = is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']); $date = get_timezoned_date($myrow['date_and_time']); $add_date = get_timezoned_date($myrow['add_time']); $edit_date = get_timezoned_date($myrow['edit_date']); $_title = get_translated_text($myrow['question']); list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], is_null($myrow['date_and_time']) ? 0 : 1, $myrow['submitter'], build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF', NULL, false, false, true), $_title, get_value('comment_forum__polls')); if (has_actual_page_access(NULL, 'cms_polls', NULL, NULL) && has_edit_permission('high', get_member(), $myrow['submitter'], 'cms_polls')) { $edit_url = build_url(array('page' => 'cms_polls', 'type' => '_ed', 'id' => $id), get_module_zone('cms_polls')); } else { $edit_url = new ocp_tempcode(); } $poll_details = do_block('main_poll'); $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_time']), 'creator' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'publisher' => '', 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'Poll', 'title' => $_title, 'identifier' => '_SEARCH:polls:view:' . strval($id), 'description' => '', 'image' => find_theme_image('bigicons/polls')); return do_template('POLL_SCREEN', array('_GUID' => '1463a42354c3ad154e2c6bb0c96be3b9', 'TITLE' => $title, 'ID' => strval($id), 'DATE_RAW' => $date_raw, 'ADD_DATE_RAW' => $add_date_raw, 'EDIT_DATE_RAW' => $edit_date_raw, 'DATE' => $date, 'ADD_DATE' => $add_date, 'EDIT_DATE' => $edit_date, 'VIEWS' => integer_format($myrow['poll_views']), 'TRACKBACK_DETAILS' => $trackback_details, 'RATING_DETAILS' => $rating_details, 'COMMENT_DETAILS' => $comment_details, 'EDIT_URL' => $edit_url, 'POLL_DETAILS' => $poll_details)); }
/** * The UI to view a news entry. * * @return tempcode The UI */ function view_news() { $id = get_param_integer('id'); $blog = get_param_integer('blog', NULL); $filter = get_param('filter', '*'); $filter_and = get_param('filter_and', '*'); if ($blog === 1) { $first_bc = array('_SELF:_SELF:blog_select', do_lang_tempcode('BLOGS')); } elseif ($blog === 0) { $first_bc = array('_SELF:_SELF:cat_select', do_lang_tempcode('JUST_NEWS_CATEGORIES')); } else { $first_bc = array('_SELF:_SELF:select', do_lang_tempcode('NEWS_CATEGORIES')); } if ($blog === 1) { $parent_title = do_lang_tempcode('BLOG_NEWS_ARCHIVE'); } else { if (is_numeric($filter)) { $news_cat_title = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title'), array('id' => intval($filter)), '', 1); if (array_key_exists(0, $news_cat_title)) { $news_cat_title[0]['text_original'] = get_translated_text($news_cat_title[0]['nc_title']); $parent_title = make_string_tempcode(escape_html($news_cat_title[0]['text_original'])); } else { $parent_title = do_lang_tempcode('NEWS_ARCHIVE'); } } else { $parent_title = do_lang_tempcode('NEWS_ARCHIVE'); } } breadcrumb_set_parents(array($first_bc, array('_SELF:_SELF:misc' . ($blog === 1 ? ':blog=1' : ($blog === 0 ? ':blog=0' : '')) . ($filter == '*' ? '' : (is_numeric($filter) ? ':id=' . $filter : ':filter=' . $filter)) . ($filter_and == '*' ? '' : ':filter_and=' . $filter_and), $parent_title))); $rows = $GLOBALS['SITE_DB']->query_select('news', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { return warn_screen(get_page_title('NEWS'), do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $rows[0]; if (!has_category_access(get_member(), 'news', strval($myrow['news_category']))) { access_denied('CATEGORY_ACCESS'); } if (addon_installed('awards')) { require_code('awards'); $awards = find_awards_for('news', strval($id)); } else { $awards = array(); } $_title = get_translated_tempcode($myrow['title']); $title_to_use = do_lang_tempcode($blog === 1 ? 'BLOG__NEWS' : '_NEWS', $_title); $title = get_page_title($title_to_use, false, NULL, NULL, $awards); seo_meta_load_for('news', strval($id), do_lang($blog === 1 ? 'BLOG__NEWS' : '_NEWS', get_translated_text($myrow['title']))); // Rating and comments $self_url_map = array('page' => '_SELF', 'type' => 'view', 'id' => $id); /*if ($filter!='*') $self_url_map['filter']=$filter; Potentially makes URL too long for content topic to store, and we probably don't want to store this assumptive context anyway if (($filter_and!='*') && ($filter_and!='')) $self_url_map['filter_and']=$filter_and;*/ if (!is_null($blog)) { $self_url_map['blog'] = $blog; } list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), strval($id), $myrow['allow_rating'], $myrow['allow_comments'], $myrow['allow_trackbacks'], $myrow['validated'], $myrow['submitter'], build_url($self_url_map, '_SELF', NULL, false, false, true), get_translated_text($myrow['title']), get_value('comment_forum__news')); $date = get_timezoned_date($myrow['date_and_time']); $author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $myrow['author']), get_module_zone('authors')) : new ocp_tempcode(); $author = $myrow['author']; $news_full = get_translated_tempcode($myrow['news_article']); $news_full_plain = get_translated_text($myrow['news_article']); if ($news_full->is_empty()) { $news_full = get_translated_tempcode($myrow['news']); $news_full_plain = get_translated_text($myrow['news']); } if (has_actual_page_access(NULL, $blog === 1 ? 'cms_blogs' : 'cms_news', NULL, NULL) && has_edit_permission('high', get_member(), $myrow['submitter'], $blog === 1 ? 'cms_blogs' : 'cms_news', array('news', $myrow['news_category']))) { $edit_url = build_url(array('page' => $blog === 1 ? 'cms_blogs' : 'cms_news', 'type' => '_ed', 'id' => $id), get_module_zone($blog === 1 ? 'cms_blogs' : 'cms_news')); } else { $edit_url = new ocp_tempcode(); } $tmp = array('page' => '_SELF', 'type' => 'misc'); if ($filter != '*') { $tmp[is_numeric($filter) ? 'id' : 'filter'] = $filter; } if ($filter_and != '*' && $filter_and != '') { $tmp['filter_and'] = $filter_and; } if (!is_null($blog)) { $tmp['blog'] = $blog; } $archive_url = build_url($tmp, '_SELF'); // Validation if ($myrow['validated'] == 0) { if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) { access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated'); } $warning_details = do_template('WARNING_TABLE', array('_GUID' => '5fd82328dc2ac9695dc25646237065b0', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT'))); } else { $warning_details = new ocp_tempcode(); } // Views if (get_db_type() != 'xml') { $myrow['news_views']++; $GLOBALS['SITE_DB']->query_update('news', array('news_views' => $myrow['news_views']), array('id' => $id), '', 1, NULL, false, true); } if (($blog !== 1 || has_specific_permission(get_member(), 'have_personal_category', 'cms_news')) && has_actual_page_access(NULL, $blog === 1 ? 'cms_blogs' : 'cms_news', NULL, NULL) && has_submit_permission('high', get_member(), get_ip_address(), 'cms_news', array('news', $myrow['news_category']))) { $map = array('page' => $blog === 1 ? 'cms_blogs' : 'cms_news', 'type' => 'ad'); if (is_numeric($filter)) { $map['cat'] = $filter; } $submit_url = build_url($map, get_module_zone('cms_news')); } else { $submit_url = new ocp_tempcode(); } $news_cats = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'news_categories WHERE nc_owner IS NULL OR id=' . strval($myrow['news_category'])); $news_cats = list_to_map('id', $news_cats); $img = find_theme_image($news_cats[$myrow['news_category']]['nc_img']); if (is_null($img)) { $img = ''; } if ($myrow['news_image'] != '') { $img = $myrow['news_image']; if (url_is_local($img)) { $img = get_custom_base_url() . '/' . $img; } } $category = get_translated_text($news_cats[$myrow['news_category']]['nc_title']); $categories = array(strval($myrow['news_category']) => $category); $all_categories_for_this = $GLOBALS['SITE_DB']->query_select('news_category_entries', array('*'), array('news_entry' => $id)); $NEWS_CATS = array(); foreach ($all_categories_for_this as $category_for_this) { if (!array_key_exists($category_for_this['news_entry_category'], $news_cats)) { $_news_cats = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('id' => $category_for_this['news_entry_category']), '', 1); if (array_key_exists(0, $_news_cats)) { $NEWS_CATS[$category_for_this['news_entry_category']] = $_news_cats[0]; } } if (array_key_exists($category_for_this['news_entry_category'], $news_cats)) { $categories[strval($category_for_this['news_entry_category'])] = get_translated_text($news_cats[$category_for_this['news_entry_category']]['nc_title']); } } $newsletter_url = new ocp_tempcode(); if (addon_installed('newsletter')) { require_lang('newsletter'); if (has_actual_page_access(get_member(), 'admin_newsletter')) { $newsletter_url = build_url(array('page' => 'admin_newsletter', 'type' => 'new', 'from_news' => $id), get_module_zone('admin_newsletter')); } } breadcrumb_set_self(get_translated_tempcode($myrow['title'])); $GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['date_and_time']), 'creator' => $myrow['author'], 'publisher' => $GLOBALS['FORUM_DRIVER']->get_username($myrow['submitter']), 'modified' => is_null($myrow['edit_date']) ? '' : date('Y-m-d', $myrow['edit_date']), 'type' => 'News article', 'title' => get_translated_text($myrow['title']), 'identifier' => '_SEARCH:news:view:' . strval($id), 'image' => $img, 'description' => strip_comcode(get_translated_text($myrow['news']))); return do_template('NEWS_FULL_SCREEN', array('_GUID' => '7686b23934e22c493d4ac10ba6c475c4', 'ID' => strval($id), 'CATEGORY_ID' => strval($myrow['news_category']), 'BLOG' => $blog === 1, '_TITLE' => $_title, 'TAGS' => get_loaded_tags('news'), 'CATEGORIES' => $categories, 'NEWSLETTER_URL' => $newsletter_url, 'ADD_DATE_RAW' => strval($myrow['date_and_time']), 'EDIT_DATE_RAW' => is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']), 'SUBMITTER' => strval($myrow['submitter']), 'CATEGORY' => $category, 'IMG' => $img, 'TITLE' => $title, 'VIEWS' => integer_format($myrow['news_views']), 'COMMENT_DETAILS' => $comment_details, 'RATING_DETAILS' => $rating_details, 'TRACKBACK_DETAILS' => $trackback_details, 'DATE' => $date, 'AUTHOR' => $author, 'AUTHOR_URL' => $author_url, 'NEWS_FULL' => $news_full, 'NEWS_FULL_PLAIN' => $news_full_plain, 'EDIT_URL' => $edit_url, 'ARCHIVE_URL' => $archive_url, 'SUBMIT_URL' => $submit_url, 'WARNING_DETAILS' => $warning_details)); }