/** * The UI to show a virtual forum. * * @param SHORT_TEXT The title to show for the v-forum * @param mixed The condition (a fragment of an SQL query that gets embedded in the context of a topic selection query). May be string, or array of strings (separate queries to run and merge; done for performance reasons relating to DB indexing) * @param string The ordering of the results * @param boolean Whether to not show pinning in a separate section * @return tempcode The UI */ function _vforum($title, $condition, $order, $no_pin = false) { $max = get_param_integer('max', intval(get_option('forum_topics_per_page'))); $start = get_param_integer('start', 0); $type = get_param('type', 'misc'); $forum_name = do_lang_tempcode('VIRTUAL_FORUM'); // Find topics $extra = ''; if (!has_specific_permission(get_member(), 'see_unvalidated')) { $extra = 't_validated=1'; } if (!$GLOBALS['FORUM_DRIVER']->is_super_admin(get_member())) { $groups = $GLOBALS['FORUM_DRIVER']->get_members_groups(get_member(), false, true); $group_or_list = ''; foreach ($groups as $group) { if ($group_or_list != '') { $group_or_list .= ' OR '; } $group_or_list .= 'group_id=' . strval((int) $group); } if ($extra != '') { $extra .= ' AND '; } $or_list = ''; global $SITE_INFO; if (isset($SITE_INFO['mysql_old']) && $SITE_INFO['mysql_old'] == '1' || !isset($SITE_INFO['mysql_old']) && is_file(get_file_base() . '/mysql_old')) { $forum_access = $GLOBALS['FORUM_DB']->query('SELECT category_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'group_category_access WHERE (' . $group_or_list . ') AND ' . db_string_equal_to('module_the_name', 'forums'), NULL, NULL, false, true); } else { $forum_access = $GLOBALS['FORUM_DB']->query('SELECT category_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'group_category_access WHERE (' . $group_or_list . ') AND ' . db_string_equal_to('module_the_name', 'forums') . ' UNION ALL SELECT category_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'member_category_access WHERE (member_id=' . strval((int) get_member()) . ' AND active_until>' . strval(time()) . ') AND ' . db_string_equal_to('module_the_name', 'forums'), NULL, NULL, false, true); } foreach ($forum_access as $access) { if ($or_list != '') { $or_list .= ' OR '; } $or_list .= 't_forum_id=' . strval((int) $access['category_name']); } $extra .= '(' . $or_list . ')'; } if ($extra != '') { $extra = ' AND (' . $extra . ') '; } $max_rows = 0; $topic_rows = array(); foreach (is_array($condition) ? $condition : array($condition) as $_condition) { $query = ' FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics top LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (top.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND top.t_cache_first_post=t.id WHERE ((' . $_condition . ')' . $extra . ') AND t_forum_id IS NOT NULL ORDER BY ' . $order; $topic_rows = array_merge($topic_rows, $GLOBALS['FORUM_DB']->query('SELECT top.*,t.text_parsed AS _trans_post,l_time' . $query, $max, $start)); //if (($start==0) && (count($topic_rows)<$max)) $max_rows+=$max; // We know that they're all on this screen /*else */ $max_rows += $GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) ' . $query); } $hot_topic_definition = intval(get_option('hot_topic_definition')); $or_list = ''; foreach ($topic_rows as $topic_row) { if ($or_list != '') { $or_list .= ' OR '; } $or_list .= 'p_topic_id=' . strval((int) $topic_row['id']); } if ($or_list != '') { $involved = $GLOBALS['FORUM_DB']->query('SELECT DISTINCT p_topic_id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE (' . $or_list . ') AND p_poster=' . strval((int) get_member())); $involved = collapse_1d_complexity('p_topic_id', $involved); } $topics_array = array(); foreach ($topic_rows as $topic_row) { $topics_array[] = ocf_get_topic_array($topic_row, get_member(), $hot_topic_definition, in_array($topic_row['id'], $involved)); } // Display topics $topics = new ocp_tempcode(); $pinned = false; require_code('templates_results_browser'); $topic_wrapper = new ocp_tempcode(); $forum_name_map = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0')); foreach ($topics_array as $topic) { if (!$no_pin && $pinned && !in_array('pinned', $topic['modifiers'])) { $topics->attach(do_template('OCF_PINNED_DIVIDER')); } $pinned = in_array('pinned', $topic['modifiers']); $forum_id = array_key_exists('forum_id', $topic) ? $topic['forum_id'] : NULL; $_forum_name = array_key_exists($forum_id, $forum_name_map) ? $forum_name_map[$forum_id] : do_lang_tempcode('PERSONAL_TOPICS'); $topics->attach(ocf_render_topic($topic, true, false, $_forum_name)); } $tree = ocf_forum_breadcrumbs(db_get_first_id(), $title, get_param_integer('keep_forum_root', db_get_first_id())); if (!$topics->is_empty()) { $results_browser = results_browser(do_lang_tempcode('FORUM_TOPICS'), NULL, $start, 'start', $max, 'max', $max_rows, NULL, $type, true); $moderator_actions = ''; $moderator_actions .= '<option value="mark_topics_read">' . do_lang('MARK_READ') . '</option>'; if ($title != do_lang('TOPICS_UNREAD')) { $moderator_actions .= '<option value="mark_topics_unread">' . do_lang('MARK_UNREAD') . '</option>'; } if ($GLOBALS['XSS_DETECT']) { ocp_mark_as_escaped($moderator_actions); } $action_url = build_url(array('page' => 'topics', 'redirect' => get_self_url(true)), get_module_zone('topics')); $topic_wrapper = do_template('OCF_FORUM_TOPIC_WRAPPER', array('_GUID' => '67356b4daacbed3e3d960d89a57d0a4a', 'MAX' => strval($max), 'ORDER' => '', 'MAY_CHANGE_MAX' => false, 'TREE' => $tree, 'BUTTONS' => '', 'STARTER_TITLE' => '', 'RESULTS_BROWSER' => $results_browser, 'MODERATOR_ACTIONS' => $moderator_actions, 'ACTION_URL' => $action_url, 'TOPICS' => $topics, 'FORUM_NAME' => $forum_name)); } $_buttons = new ocp_tempcode(); $archive_url = $GLOBALS['FORUM_DRIVER']->forum_url(db_get_first_id(), true); $_buttons->attach(do_template('SCREEN_BUTTON', array('TITLE' => do_lang_tempcode('ROOT_FORUM'), 'IMG' => 'all', 'IMMEDIATE' => false, 'URL' => $archive_url))); breadcrumb_add_segment($tree); return do_template('OCF_FORUM', array('_GUID' => 'd3fa84575727af935eadb2ce2b7c7b3e', 'FILTERS' => '', 'FORUM_NAME' => $forum_name, 'STARTER_TITLE' => '', 'BUTTONS' => $_buttons, 'TOPIC_WRAPPER' => $topic_wrapper, 'CATEGORIES' => '')); }
/** * Get a map of details relating to the view of a certain forum of a certain member. * * @param integer The start row for getting details of topics in the forum (i.e. 0 is newest, higher is starting further back in time). * @param ?integer The maximum number of topics to get detail of (NULL: default). * @param ?MEMBER The member viewing (NULL: current member). * @return array The details. */ function ocf_get_forum_view($start = 0, $max = NULL, $forum_id = NULL) { if (is_null($max)) { $max = intval(get_option('forum_topics_per_page')); } $member_id = get_member(); load_up_all_module_category_permissions($member_id, 'forums'); if (is_null($forum_id)) { /*$forum_info[0]['f_name']=do_lang('ROOT_FORUM'); This optimisation was more trouble that it was worth, and constraining $forum_info[0]['f_description']=''; $forum_info[0]['f_parent_forum']=NULL;*/ $forum_id = db_get_first_id(); } $forum_info = $GLOBALS['FORUM_DB']->query_select('f_forums f', array('f_redirection', 'f_intro_question', 'f_intro_answer', 'f_order_sub_alpha', 'f_parent_forum', 'f_name', 'f_description', 'f_order'), array('f.id' => $forum_id), '', 1, NULL, false, array('f_description', 'f_intro_question')); if (!array_key_exists(0, $forum_info)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } if ($forum_info[0]['f_redirection'] != '' && looks_like_url($forum_info[0]['f_redirection'])) { header('Location: ' . $forum_info[0]['f_redirection']); exit; } if (!is_null($forum_id)) { if (!has_category_access($member_id, 'forums', strval($forum_id))) { access_denied('CATEGORY_ACCESS_LEVEL'); } // We're only allowed to view it existing from a parent forum, or nothing at all -- so access denied brother! } // Find our subforums first $order = $forum_info[0]['f_order_sub_alpha'] ? 'f_name' : 'f_position'; $_max_forum_detail = get_value('max_forum_detail'); $max_forum_detail = is_null($_max_forum_detail) ? 100 : intval($_max_forum_detail); $huge_forums = $GLOBALS['FORUM_DB']->query_value('f_forums', 'COUNT(*)') > $max_forum_detail; if ($huge_forums) { $_max_forum_inspect = get_value('max_forum_inspect'); $max_forum_inspect = is_null($_max_forum_inspect) ? 300 : intval($_max_forum_inspect); $subforum_rows = $GLOBALS['FORUM_DB']->query('SELECT f.* FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums f WHERE f.id=' . strval($forum_id) . ' OR f_parent_forum=' . strval($forum_id) . ' ORDER BY f_parent_forum,' . $order, $max_forum_inspect, NULL, false, false, array('f_description', 'f_intro_question')); if (count($subforum_rows) == $max_forum_inspect) { $subforum_rows = array(); } // Will cause performance breakage } else { $subforum_rows = $GLOBALS['FORUM_DB']->query_select('f_forums f', array('f.*'), NULL, 'ORDER BY f_parent_forum,' . $order, NULL, NULL, false, array('f_description', 'f_intro_question')); } $unread_forums = array(); if (!is_null($forum_id) && get_member() != $GLOBALS['OCF_DRIVER']->get_guest_id()) { // Where are there unread topics in subforums? $tree = array(); $subforum_rows_copy = $subforum_rows; $tree = ocf_organise_into_tree($subforum_rows_copy, $forum_id); if ($forum_id != db_get_first_id()) { $child_or_list = ocf_get_all_subordinate_forums($forum_id, 't_forum_id', $tree); } else { $child_or_list = ''; } if ($child_or_list != '') { $child_or_list .= ' AND '; } $query = 'SELECT DISTINCT t_forum_id,t.id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics t LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (t.id=l_topic_id AND l_member_id=' . strval((int) get_member()) . ') WHERE ' . $child_or_list . 't_cache_last_time>' . strval(time() - 60 * 60 * 24 * intval(get_option('post_history_days'))) . ' AND (l_time<t_cache_last_time OR l_time IS NULL)'; if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) { $query .= ' AND t_validated=1'; } $unread_forums = collapse_2d_complexity('t_forum_id', 'id', $GLOBALS['FORUM_DB']->query($query)); } // Find all the categories that are used $categories = array(); $or_list = ''; foreach ($subforum_rows as $tmp_key => $subforum_row) { if ($subforum_row['f_parent_forum'] != $forum_id) { continue; } if (!has_category_access($member_id, 'forums', strval($subforum_row['id']))) { unset($subforum_rows[$tmp_key]); continue; } $category_id = $subforum_row['f_category_id']; if (!array_key_exists($category_id, $categories)) { $categories[$category_id] = array('subforums' => array()); if ($or_list != '') { $or_list .= ' OR '; } $or_list .= 'id=' . strval((int) $category_id); } } if ($or_list != '') { $category_rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_categories WHERE ' . $or_list); foreach ($category_rows as $category_row) { $category_id = $category_row['id']; $title = $category_row['c_title']; $description = $category_row['c_description']; $expanded_by_default = $category_row['c_expanded_by_default']; $categories[$category_id]['title'] = $title; $categories[$category_id]['description'] = $description; $categories[$category_id]['expanded_by_default'] = $expanded_by_default; } $categories[NULL]['title'] = ''; $categories[NULL]['description'] = ''; $categories[NULL]['expanded_by_default'] = true; foreach ($subforum_rows as $subforum_row) { if ($subforum_row['f_parent_forum'] != $forum_id) { continue; } $category_id = $subforum_row['f_category_id']; // if (!array_key_exists('position',$categories[$category_id])) $categories[$category_id]['position']=$subforum_row['f_position']; $subforum = array(); $subforum['id'] = $subforum_row['id']; $subforum['name'] = $subforum_row['f_name']; $subforum['description'] = get_translated_tempcode($subforum_row['f_description'], $GLOBALS['FORUM_DB']); $subforum['redirection'] = $subforum_row['f_redirection']; $subforum['intro_question'] = get_translated_tempcode($subforum_row['f_intro_question'], $GLOBALS['FORUM_DB']); $subforum['intro_answer'] = $subforum_row['f_intro_answer']; if (is_numeric($subforum_row['f_redirection'])) { $subforum_row = $GLOBALS['FORUM_DB']->query_select('f_forums', array('*'), array('id' => intval($subforum_row['f_redirection'])), '', 1); $subforum_row = $subforum_row[0]; } if ($subforum_row['f_redirection'] == '' || is_numeric($subforum_row['f_redirection'])) { $subforum['num_topics'] = $subforum_row['f_cache_num_topics']; $subforum['num_posts'] = $subforum_row['f_cache_num_posts']; $subforum['has_new'] = false; if (get_member() != $GLOBALS['OCF_DRIVER']->get_guest_id()) { $subforums_recurse = ocf_get_all_subordinate_forums($subforum['id'], NULL, $tree[$subforum['id']]['children']); foreach ($subforums_recurse as $subforum_potential) { if (array_key_exists($subforum_potential, $unread_forums)) { $subforum['has_new'] = true; } } } if (is_null($subforum_row['f_cache_last_forum_id']) || has_category_access($member_id, 'forums', strval($subforum_row['f_cache_last_forum_id']))) { $subforum['last_topic_id'] = $subforum_row['f_cache_last_topic_id']; $subforum['last_title'] = $subforum_row['f_cache_last_title']; $subforum['last_time'] = $subforum_row['f_cache_last_time']; $subforum['last_username'] = $subforum_row['f_cache_last_username']; $subforum['last_member_id'] = $subforum_row['f_cache_last_member_id']; $subforum['last_forum_id'] = $subforum_row['f_cache_last_forum_id']; } else { $subforum['protected_last_post'] = true; } // Subsubforums $subforum['children'] = array(); foreach ($subforum_rows as $tmp_key_2 => $subforum_row2) { if ($subforum_row2['f_parent_forum'] == $subforum_row['id'] && has_category_access($member_id, 'forums', strval($subforum_row2['id']))) { $subforum['children'][$subforum_row2['f_name'] . '__' . strval($subforum_row2['id'])] = array('id' => $subforum_row2['id'], 'name' => $subforum_row2['f_name'], 'redirection' => $subforum_row2['f_redirection']); } } global $M_SORT_KEY; $M_SORT_KEY = 'name'; uasort($subforum['children'], 'multi_sort'); } $categories[$category_id]['subforums'][] = $subforum; } } // Find topics $extra = ''; if (!has_specific_permission(get_member(), 'see_unvalidated') && !ocf_may_moderate_forum($forum_id, $member_id)) { $extra = 't_validated=1 AND '; } if (is_null($forum_info[0]['f_parent_forum'])) { $where = $extra . ' (t_forum_id=' . strval((int) $forum_id) . ')'; } else { $extra2 = ''; $parent_or_list = ocf_get_forum_parent_or_list($forum_id, $forum_info[0]['f_parent_forum']); if ($parent_or_list != '') { $extra2 = 'AND (' . $parent_or_list . ')'; } $where = $extra . ' (t_forum_id=' . strval((int) $forum_id) . ' OR (t_cascading=1 ' . $extra2 . '))'; } $order = get_param('order', $forum_info[0]['f_order']); $order2 = 't_cache_last_time DESC'; if ($order == 'first_post') { $order2 = 't_cache_first_time DESC'; } elseif ($order == 'title') { $order2 = 't_cache_first_title ASC'; } if (get_value('disable_sunk') !== '1') { $order2 = 't_sunk ASC,' . $order2; } if (is_guest()) { $query = 'SELECT ttop.*,t.text_parsed AS _trans_post,NULL AS l_time FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics ttop LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND ttop.t_cache_first_post=t.id WHERE ' . $where . ' ORDER BY t_cascading DESC,t_pinned DESC,' . $order2; } else { $query = 'SELECT ttop.*,t.text_parsed AS _trans_post,l_time FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics ttop LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (ttop.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND ttop.t_cache_first_post=t.id WHERE ' . $where . ' ORDER BY t_cascading DESC,t_pinned DESC,' . $order2; } $topic_rows = $GLOBALS['FORUM_DB']->query($query, $max, $start); if ($start == 0 && count($topic_rows) < $max) { $max_rows = $max; } else { $max_rows = $GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE ' . $where); } $topics = array(); $hot_topic_definition = intval(get_option('hot_topic_definition')); $or_list = ''; foreach ($topic_rows as $topic_row) { if ($or_list != '') { $or_list .= ' OR '; } $or_list .= 'p_topic_id=' . strval((int) $topic_row['id']); } if ($or_list != '' && !is_guest()) { $involved = $GLOBALS['FORUM_DB']->query('SELECT DISTINCT p_topic_id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE (' . $or_list . ') AND p_poster=' . strval((int) get_member())); $involved = collapse_1d_complexity('p_topic_id', $involved); } else { $involved = array(); } foreach ($topic_rows as $topic_row) { $topics[] = ocf_get_topic_array($topic_row, $member_id, $hot_topic_definition, in_array($topic_row['id'], $involved)); } $description = get_translated_tempcode($forum_info[0]['f_description'], $GLOBALS['FORUM_DB']); $description_text = get_translated_text($forum_info[0]['f_description'], $GLOBALS['FORUM_DB']); $out = array('name' => $forum_info[0]['f_name'], 'description' => $description, 'categories' => $categories, 'topics' => $topics, 'max_rows' => $max_rows, 'order' => $order, 'parent_forum' => $forum_info[0]['f_parent_forum']); $GLOBALS['META_DATA'] += array('created' => '', 'creator' => '', 'publisher' => '', 'modified' => '', 'type' => 'Forum', 'title' => $forum_info[0]['f_name'], 'identifier' => '_SEARCH:forumview:misc:' . strval($forum_id), 'description' => $description_text, 'image' => find_theme_image('bigicons/forums')); // Is there a question/answer situation? $question = get_translated_tempcode($forum_info[0]['f_intro_question'], $GLOBALS['FORUM_DB']); if (!$question->is_empty()) { $is_guest = $member_id == $GLOBALS['OCF_DRIVER']->get_guest_id(); $test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forum_intro_ip', 'i_ip', array('i_forum_id' => $forum_id, 'i_ip' => get_ip_address(3))); if (is_null($test) && !$is_guest) { $test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forum_intro_member', 'i_member_id', array('i_forum_id' => $forum_id, 'i_member_id' => $member_id)); } if (is_null($test)) { $out['question'] = $question; $out['answer'] = $forum_info[0]['f_intro_answer']; } } if (ocf_may_post_topic($forum_id, $member_id)) { $out['may_post_topic'] = 1; } if (ocf_may_moderate_forum($forum_id, $member_id)) { $out['may_change_max'] = 1; $out['may_move_topics'] = 1; if (has_specific_permission(get_member(), 'multi_delete_topics')) { $out['may_delete_topics'] = 1; } // Only super admins can casually delete topics - other staff are expected to trash them. At least deleted posts or trashed topics can be restored! } return $out; }
/** * Standard modular render function for profile tab hooks. * * @param MEMBER The ID of the member who is being viewed * @param MEMBER The ID of the member who is doing the viewing * @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later * @return array A triple: The tab title, the tab contents, the suggested tab order */ function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false) { $title = do_lang_tempcode('FORUM_POSTS'); $order = 20; if ($leave_to_ajax_if_possible) { return array($title, NULL, $order); } require_code('ocf_topics'); require_code('ocf_general'); require_lang('ocf'); $topics = new ocp_tempcode(); if (!has_no_forum()) { require_code('ocf_forumview'); global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'post_start'; $NON_CANONICAL_PARAMS[] = 'post_max'; // Last 15 topics that member contributed to $n = get_param_integer('post_max', 10); $start = get_param_integer('post_start', 0); $forum1 = NULL; //$GLOBALS['FORUM_DRIVER']->forum_id_from_name(get_option('comments_forum_name')); $tf = get_option('ticket_forum_name', true); if (!is_null($tf)) { $forum2 = $GLOBALS['FORUM_DRIVER']->forum_id_from_name($tf); } else { $forum2 = NULL; } $where_more = ''; if (!is_null($forum1)) { $where_more .= ' AND p_cache_forum_id<>' . strval((int) $forum1); } if (!is_null($forum2)) { $where_more .= ' AND p_cache_forum_id<>' . strval((int) $forum2); } $rows = $GLOBALS['FORUM_DB']->query('SELECT DISTINCT p_topic_id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_poster=' . strval((int) $member_id_of) . $where_more . ' ORDER BY p_time DESC', $n, $start); if (count($rows) != 0) { $max_rows = $GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(DISTINCT p_topic_id) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_poster=' . strval((int) $member_id_of) . $where_more); $where = ''; foreach ($rows as $row) { if ($where != '') { $where .= ' OR '; } $where .= 't.id=' . strval((int) $row['p_topic_id']); } $topic_rows = $GLOBALS['FORUM_DB']->query('SELECT t.*,lan.text_parsed AS _trans_post,l_time FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics t LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (t.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate lan ON t.t_cache_first_post=lan.id WHERE ' . $where); $topic_rows_map = array(); foreach ($topic_rows as $topic_row) { if (has_category_access(get_member(), 'forums', strval($topic_row['t_forum_id']))) { $topic_rows_map[$topic_row['id']] = $topic_row; } } $hot_topic_definition = intval(get_option('hot_topic_definition')); foreach ($rows as $row) { if (array_key_exists($row['p_topic_id'], $topic_rows_map)) { $topics->attach(ocf_render_topic(ocf_get_topic_array($topic_rows_map[$row['p_topic_id']], get_member(), $hot_topic_definition, true), false)); } } if (!$topics->is_empty()) { $forum_name = do_lang_tempcode('TOPICS_PARTICIPATED_IN', integer_format($start + 1) . '-' . integer_format($start + $n)); $marker = ''; $tree = new ocp_tempcode(); require_code('templates_results_browser'); $results_browser = results_browser(do_lang_tempcode('FORUM_TOPICS'), NULL, $start, 'post_start', $n, 'post_max', $max_rows, NULL, 'view', true, false, 7, NULL, 'tab__posts'); $topics = do_template('OCF_FORUM_TOPIC_WRAPPER', array('_GUID' => '8723270b128b4eea47ab3c756b342e14', 'ORDER' => '', 'MAX' => '15', 'MAY_CHANGE_MAX' => false, 'TREE' => $tree, 'ACTION_URL' => get_self_url(), 'BUTTONS' => '', 'STARTER_TITLE' => '', 'MARKER' => $marker, 'FORUM_NAME' => $forum_name, 'TOPICS' => $topics, 'RESULTS_BROWSER' => $results_browser, 'MODERATOR_ACTIONS' => '')); } } } $content = do_template('OCF_MEMBER_PROFILE_POSTS', array('MEMBER_ID' => strval($member_id_of), 'TOPICS' => $topics)); return array($title, $content, $order); }