$task = $cron->find_task('cron.task.core.prune_shadow_topics'); $task->set_forum_data($forum_data); if ($task->is_ready()) { $url = $task->get_url(); $template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="cron" />'); } } } // Forum rules and subscription info $s_watching_forum = array('link' => '', 'link_toggle' => '', 'title' => '', 'title_toggle' => '', 'is_watching' => false); if ($config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS)) { $notify_status = isset($forum_data['notify_status']) ? $forum_data['notify_status'] : NULL; watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status, $start, $forum_data['forum_name']); } $s_forum_rules = ''; gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']); // Topic ordering options $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => $auth->acl_get('m_approve', $forum_id) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved', 's' => 'LOWER(t.topic_title)', 'v' => 't.topic_views'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); // Limit topics to certain time frame, obtain correct topic count if ($sort_days) { $min_post_time = time() - $sort_days * 86400; $sql = 'SELECT COUNT(topic_id) AS num_topics FROM ' . TOPICS_TABLE . "\n\t\tWHERE forum_id = {$forum_id}\n\t\t\tAND (topic_last_post_time >= {$min_post_time}\n\t\t\t\tOR topic_type = " . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ') AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id); $result = $db->sql_query($sql); $topics_count = (int) $db->sql_fetchfield('num_topics');
} $highlight = urlencode($hilit_words); } // General Viewtopic URL for return links $viewtopic_url = "Forums&file=viewtopic&t={$topic_id}&start={$start}&{$u_sort_param}" . ($highlight_match ? "&hilit={$highlight}" : ''); // Grab ranks $ranks = obtain_ranks(); // Grab icons $icons = obtain_icons(); // Moderators $forum_moderators = get_moderators($forum_id); // Generate Navigation links generate_forum_nav($topic_data); // Generate Forum Rules generate_forum_rules($topic_data); gen_forum_auth_level('topic', $forum_id); // Does this topic contain a poll? if (!empty($poll_start)) { $sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid FROM ' . FORUMS_POLL_OPTIONS_TABLE . ' o, ' . FORUMS_POSTS_TABLE . " p\n\t\tWHERE o.topic_id = {$topic_id} \n\t\t\tAND p.post_id = {$topic_first_post_id}\n\t\t\tAND p.topic_id = o.topic_id\n\t\tORDER BY o.poll_option_id"; $result = $_CLASS['core_db']->query($sql); $poll_info = array(); while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) { $poll_info[] = $row; } $_CLASS['core_db']->free_result($result); $cur_voted_id = array(); if ($_CLASS['core_user']->is_user) { $sql = 'SELECT poll_option_id FROM ' . FORUMS_POLL_VOTES_TABLE . ' WHERE topic_id = ' . $topic_id . '
} meta_refresh(3, $viewtopic_url); trigger_error($message); } // Grab ranks $ranks = $cache->obtain_ranks(); // Grab icons $icons = $cache->obtain_icons(); // Grab extensions $extensions = array(); if ($topic_data['topic_attachment']) { $extensions = $cache->obtain_attach_extensions($forum_id); } // Forum rules listing $s_forum_rules = ''; gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); // Quick mod tools $allow_change_type = $auth->acl_get('m_', $forum_id) || $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] ? true : false; $s_quickmod_action = append_sid("{$phpbb_root_path}mcp.{$phpEx}", array('f' => $forum_id, 't' => $topic_id, 'start' => $start, 'quickmod' => 1, 'redirect' => urlencode(str_replace('&', '&', $viewtopic_url))), true, $user->session_id); $quickmod_array = array('lock' => array('LOCK_TOPIC', $topic_data['topic_status'] == ITEM_UNLOCKED && ($auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])), 'unlock' => array('UNLOCK_TOPIC', $topic_data['topic_status'] != ITEM_UNLOCKED && $auth->acl_get('m_lock', $forum_id)), 'delete_topic' => array('DELETE_TOPIC', $auth->acl_get('m_delete', $forum_id) || $topic_data['topic_visibility'] != ITEM_DELETED && $auth->acl_get('m_softdelete', $forum_id)), 'restore_topic' => array('RESTORE_TOPIC', $topic_data['topic_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $forum_id)), 'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED), 'split' => array('SPLIT_TOPIC', $auth->acl_get('m_split', $forum_id)), 'merge' => array('MERGE_POSTS', $auth->acl_get('m_merge', $forum_id)), 'merge_topic' => array('MERGE_TOPIC', $auth->acl_get('m_merge', $forum_id)), 'fork' => array('FORK_TOPIC', $auth->acl_get('m_move', $forum_id)), 'make_normal' => array('MAKE_NORMAL', $allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', 'f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_NORMAL), 'make_sticky' => array('MAKE_STICKY', $allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY), 'make_announce' => array('MAKE_ANNOUNCE', $allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE), 'make_global' => array('MAKE_GLOBAL', $allow_change_type && $auth->acl_get('f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL), 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id))); foreach ($quickmod_array as $option => $qm_ary) { if (!empty($qm_ary[1])) { phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]); } } // Navigation links generate_forum_nav($topic_data); // Forum Rules generate_forum_rules($topic_data); // Moderators $forum_moderators = array();
{ auto_prune($forum_id, 'posted', $forum_data['forum_flags'], $forum_data['prune_days'], $forum_data['prune_freq']); } if ($forum_data['prune_viewed']) { auto_prune($forum_id, 'viewed', $forum_data['forum_flags'], $forum_data['prune_viewed'], $forum_data['prune_freq']); } } */ if ($_CLASS['auth']->acl_get('f_subscribe', $forum_id)) { $notify_status = isset($forum_data['notify_status']) ? $forum_data['notify_status'] : null; $s_watching_forum = watch_topic_forum('forum', $_CLASS['core_user']->data['user_id'], $forum_id, 0, $notify_status); } else { $s_watching_forum['link'] = $s_watching_forum['title'] = ''; } gen_forum_auth_level('forum', $forum_id); // Topic ordering options $limit_days = array(0 => $_CLASS['core_user']->lang['ALL_TOPICS'], 1 => $_CLASS['core_user']->lang['1_DAY'], 7 => $_CLASS['core_user']->lang['7_DAYS'], 14 => $_CLASS['core_user']->lang['2_WEEKS'], 30 => $_CLASS['core_user']->lang['1_MONTH'], 90 => $_CLASS['core_user']->lang['3_MONTHS'], 180 => $_CLASS['core_user']->lang['6_MONTHS'], 364 => $_CLASS['core_user']->lang['1_YEAR']); $sort_by_text = array('a' => $_CLASS['core_user']->lang['AUTHOR'], 't' => $_CLASS['core_user']->lang['POST_TIME'], 'r' => $_CLASS['core_user']->lang['REPLIES'], 's' => $_CLASS['core_user']->lang['SUBJECT'], 'v' => $_CLASS['core_user']->lang['VIEWS']); $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); $sort_key = !in_array($sort_key, array('a', 't', 'r', 's', 'v')) ? 't' : $sort_key; $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); // Limit topics to certain time frame, obtain correct topic count if ($sort_days) { $min_post_time = $_CLASS['core_user']->time - $sort_days * 86400; $sql = 'SELECT COUNT(topic_id) AS num_topics FROM ' . FORUMS_TOPICS_TABLE . "\n\t\tWHERE forum_id = {$forum_id}\n\t\t\tAND topic_type <> " . POST_ANNOUNCE . " \n\t\t\tAND topic_last_post_time >= {$min_post_time}\n\t\t" . ($_CLASS['auth']->acl_get('m_approve', $forum_id) ? '' : 'AND topic_approved = 1'); $result = $_CLASS['core_db']->query($sql); if (isset($_POST['sort'])) { $start = 0;