Exemple #1
0
* @var	int		post_id				Post ID
* @var	array	quickmod_array		Array with quick moderation options data
* @var	int		start				Pagination information
* @var	array	topic_data			Array with topic data
* @var	int		topic_id			Topic ID
* @var	array	topic_tracking_info	Array with topic tracking data
* @var	int		total_posts			Topic total posts count
* @var	string	viewtopic_url		URL to the topic page
* @since 3.1.0-RC4
* @change 3.1.2-RC1 Added viewtopic_url
*/
$vars = array('base_url', 'forum_id', 'post_id', 'quickmod_array', 'start', 'topic_data', 'topic_id', 'topic_tracking_info', 'total_posts', 'viewtopic_url');
extract($phpbb_dispatcher->trigger_event('core.viewtopic_assign_template_vars_before', compact($vars)));
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start);
// Send vars to template
$template->assign_vars(array('FORUM_ID' => $forum_id, 'FORUM_NAME' => $topic_data['forum_name'], 'FORUM_DESC' => generate_text_for_display($topic_data['forum_desc'], $topic_data['forum_desc_uid'], $topic_data['forum_desc_bitfield'], $topic_data['forum_desc_options']), 'TOPIC_ID' => $topic_id, 'TOPIC_TITLE' => $topic_data['topic_title'], 'TOPIC_POSTER' => $topic_data['topic_poster'], 'TOPIC_AUTHOR_FULL' => get_username_string('full', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => $auth->acl_get('m_', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=main&mode=topic_view&f={$forum_id}&t={$topic_id}" . ($start == 0 ? '' : "&start={$start}") . (strlen($u_sort_param) ? "&{$u_sort_param}" : ''), true, $user->session_id) : '', 'MODERATORS' => isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', 'POST_IMG' => $topic_data['forum_status'] == ITEM_LOCKED ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), 'REPLY_IMG' => $topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'), 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'), 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'), 'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED_RESTORE'), 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'), 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER'), 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), 'S_IS_LOCKED' => $topic_data['topic_status'] == ITEM_UNLOCKED && $topic_data['forum_status'] == ITEM_UNLOCKED ? false : true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => !empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1 ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}" . ($start == 0 ? '' : "&start={$start}")), 'S_MOD_ACTION' => $s_quickmod_action, 'L_RETURN_TO_FORUM' => $user->lang('RETURN_TO', $topic_data['forum_name']), 'S_VIEWTOPIC' => true, 'S_UNREAD_VIEW' => $view == 'unread', 'S_DISPLAY_SEARCHBOX' => $auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search'] ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.{$phpEx}"), 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), 'S_DISPLAY_POST_INFO' => $topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? true : false, 'S_DISPLAY_REPLY_INFO' => $topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? true : false, 'S_ENABLE_FEEDS_TOPIC' => $config['feed_topic'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $topic_data['forum_options']) ? true : false, 'U_TOPIC' => "{$server_path}viewtopic.{$phpEx}?f={$forum_id}&t={$topic_id}", 'U_FORUM' => $server_path, 'U_VIEW_TOPIC' => $viewtopic_url, 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewtopic.{$phpEx}", "t={$topic_id}" . ($start ? "&start={$start}" : ''), true, ''), 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id), 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&view=previous"), 'U_VIEW_NEWER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&t={$topic_id}&view=next"), 'U_PRINT_TOPIC' => $auth->acl_get('f_print', $forum_id) ? $viewtopic_url . '&view=print' : '', 'U_EMAIL_TOPIC' => $auth->acl_get('f_email', $forum_id) && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&t={$topic_id}") : '', 'U_WATCH_TOPIC' => $s_watching_topic['link'], 'U_WATCH_TOPIC_TOGGLE' => $s_watching_topic['link_toggle'], 'S_WATCH_TOPIC_TITLE' => $s_watching_topic['title'], 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['title_toggle'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], 'U_BOOKMARK_TOPIC' => $user->data['is_registered'] && $config['allow_bookmarks'] ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_{$topic_id}") : '', 'S_BOOKMARK_TOPIC' => $user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked'] ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'S_BOOKMARK_TOGGLE' => !$user->data['is_registered'] || !$config['allow_bookmarks'] || !$topic_data['bookmarked'] ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'S_BOOKMARKED_TOPIC' => $user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked'] ? true : false, 'U_POST_NEW_TOPIC' => $auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=post&f={$forum_id}") : '', 'U_POST_REPLY_TOPIC' => $auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=reply&f={$forum_id}&t={$topic_id}") : '', 'U_BUMP_TOPIC' => bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=bump&f={$forum_id}&t={$topic_id}&hash=" . generate_link_hash("topic_{$topic_id}")) : ''));
// Does this topic contain a poll?
if (!empty($topic_data['poll_start'])) {
    $sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
		FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p\n\t\tWHERE o.topic_id = {$topic_id}\n\t\t\tAND p.post_id = {$topic_data['topic_first_post_id']}\n\t\t\tAND p.topic_id = o.topic_id\n\t\tORDER BY o.poll_option_id";
    $result = $db->sql_query($sql);
    $poll_info = $vote_counts = array();
    while ($row = $db->sql_fetchrow($result)) {
        $poll_info[] = $row;
        $option_id = (int) $row['poll_option_id'];
        $vote_counts[$option_id] = (int) $row['poll_option_total'];
    }
    $db->sql_freeresult($result);
    $cur_voted_id = array();
    if ($user->data['is_registered']) {
        $sql = 'SELECT poll_option_id
Exemple #2
0
    }
    if (!($post_data['post_time'] > time() - $config['edit_time'] * 60 || !$config['edit_time'])) {
        trigger_error('CANNOT_EDIT_TIME');
    }
    if ($post_data['post_edit_locked']) {
        trigger_error('CANNOT_EDIT_POST_LOCKED');
    }
}
// Handle delete mode...
if ($mode == 'delete') {
    handle_post_delete($forum_id, $topic_id, $post_id, $post_data);
    return;
}
// Handle bump mode...
if ($mode == 'bump') {
    if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id']) && check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}")) {
        $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time);
        meta_refresh(3, $meta_url);
        $message = $user->lang['TOPIC_BUMPED'] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $meta_url . '">', '</a>');
        $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id) . '">', '</a>');
        trigger_error($message);
    }
    trigger_error('BUMP_ERROR');
}
// Subject length limiting to 60 characters if first post...
if ($mode == 'post' || $mode == 'edit' && $post_data['topic_first_post_id'] == $post_data['post_id']) {
    $template->assign_var('S_NEW_MESSAGE', true);
}
// Determine some vars
if (isset($post_data['poster_id']) && $post_data['poster_id'] == ANONYMOUS) {
    $post_data['quote_username'] = !empty($post_data['post_username']) ? $post_data['post_username'] : $user->lang['GUEST'];
Exemple #3
0
$topic_mod .= $auth->acl_get('m_', $forum_id) ? '<option value="topic_logs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : '';
// If we've got a hightlight set pass it on to pagination.
$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&amp;t={$topic_id}" . (strlen($u_sort_param) ? "&amp;{$u_sort_param}" : '') . ($highlight_match ? "&amp;hilit={$highlight}" : '')), $total_posts, $config['posts_per_page'], $start);
// Navigation links
generate_forum_nav($topic_data);
// Forum Rules
generate_forum_rules($topic_data);
// Moderators
$forum_moderators = array();
get_moderators($forum_moderators, $forum_id);
// This is only used for print view so ...
$server_path = !$view ? $phpbb_root_path : generate_board_url() . '/';
// Replace naughty words in title
$topic_data['topic_title'] = censor_text($topic_data['topic_title']);
// Send vars to template
$template->assign_vars(array('FORUM_ID' => $forum_id, 'FORUM_NAME' => $topic_data['forum_name'], 'FORUM_DESC' => generate_text_for_display($topic_data['forum_desc'], $topic_data['forum_desc_uid'], $topic_data['forum_desc_bitfield'], $topic_data['forum_desc_options']), 'TOPIC_ID' => $topic_id, 'TOPIC_TITLE' => $topic_data['topic_title'], 'TOPIC_POSTER' => $topic_data['topic_poster'], 'TOPIC_AUTHOR_FULL' => get_username_string('full', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $total_posts == 1 ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts), 'U_MCP' => $auth->acl_get('m_', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=main&amp;mode=topic_view&amp;f={$forum_id}&amp;t={$topic_id}&amp;start={$start}" . (strlen($u_sort_param) ? "&amp;{$u_sort_param}" : ''), true, $user->session_id) : '', 'MODERATORS' => isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) ? implode(', ', $forum_moderators[$forum_id]) : '', 'POST_IMG' => $topic_data['forum_status'] == ITEM_LOCKED ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), 'REPLY_IMG' => $topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'), 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'), 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'), 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'), 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), 'WWW_IMG' => $user->img('icon_contact_www', 'VISIT_WEBSITE'), 'ICQ_IMG' => $user->img('icon_contact_icq', 'ICQ'), 'AIM_IMG' => $user->img('icon_contact_aim', 'AIM'), 'MSN_IMG' => $user->img('icon_contact_msnm', 'MSNM'), 'YIM_IMG' => $user->img('icon_contact_yahoo', 'YIM'), 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER'), 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), 'S_IS_LOCKED' => $topic_data['topic_status'] == ITEM_UNLOCKED ? false : true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => !empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1 ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&amp;t={$topic_id}&amp;start={$start}"), 'S_TOPIC_MOD' => $topic_mod != '' ? '<select name="action" id="quick-mod-select">' . $topic_mod . '</select>' : '', 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "f={$forum_id}&amp;t={$topic_id}&amp;quickmod=1&amp;redirect=" . urlencode(str_replace('&amp;', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, 'S_DISPLAY_SEARCHBOX' => $auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search'] ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.{$phpEx}", 't=' . $topic_id), 'S_DISPLAY_POST_INFO' => $topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? true : false, 'S_DISPLAY_REPLY_INFO' => $topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? true : false, 'U_TOPIC' => "{$server_path}viewtopic.{$phpEx}?f={$forum_id}&amp;t={$topic_id}", 'U_FORUM' => $server_path, 'U_VIEW_TOPIC' => $viewtopic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id), 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&amp;t={$topic_id}&amp;view=previous"), 'U_VIEW_NEWER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&amp;t={$topic_id}&amp;view=next"), 'U_PRINT_TOPIC' => $auth->acl_get('f_print', $forum_id) ? $viewtopic_url . '&amp;view=print' : '', 'U_EMAIL_TOPIC' => $auth->acl_get('f_email', $forum_id) && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&amp;t={$topic_id}") : '', 'U_WATCH_TOPIC' => $s_watching_topic['link'], 'L_WATCH_TOPIC' => $s_watching_topic['title'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], 'U_BOOKMARK_TOPIC' => $user->data['is_registered'] && $config['allow_bookmarks'] ? $viewtopic_url . '&amp;bookmark=1&amp;hash=' . generate_link_hash("topic_{$topic_id}") : '', 'L_BOOKMARK_TOPIC' => $user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked'] ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'U_POST_NEW_TOPIC' => $auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=post&amp;f={$forum_id}") : '', 'U_POST_REPLY_TOPIC' => $auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=reply&amp;f={$forum_id}&amp;t={$topic_id}") : '', 'U_BUMP_TOPIC' => bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=bump&amp;f={$forum_id}&amp;t={$topic_id}&amp;hash=" . generate_link_hash("topic_{$topic_id}")) : ''));
// Does this topic contain a poll?
if (!empty($topic_data['poll_start'])) {
    $sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
		FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p\n\t\tWHERE o.topic_id = {$topic_id}\n\t\t\tAND p.post_id = {$topic_data['topic_first_post_id']}\n\t\t\tAND p.topic_id = o.topic_id\n\t\tORDER BY o.poll_option_id";
    $result = $db->sql_query($sql);
    $poll_info = array();
    while ($row = $db->sql_fetchrow($result)) {
        $poll_info[] = $row;
    }
    $db->sql_freeresult($result);
    $cur_voted_id = array();
    if ($user->data['is_registered']) {
        $sql = 'SELECT poll_option_id
			FROM ' . POLL_VOTES_TABLE . '
			WHERE topic_id = ' . $topic_id . '
Exemple #4
0
	'U_VIEW_FORUM' 			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
	'U_VIEW_OLDER_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=previous"),
	'U_VIEW_NEWER_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=next"),
	'U_PRINT_TOPIC'			=> ($auth->acl_get('f_print', $forum_id)) ? $viewtopic_url . '&amp;view=print' : '',
	'U_EMAIL_TOPIC'			=> ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&amp;t=$topic_id") : '',

	'U_WATCH_TOPIC' 		=> $s_watching_topic['link'],
	'L_WATCH_TOPIC' 		=> $s_watching_topic['title'],
	'S_WATCHING_TOPIC'		=> $s_watching_topic['is_watching'],

	'U_BOOKMARK_TOPIC'		=> ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&amp;bookmark=1&amp;hash=' . generate_link_hash("topic_$topic_id") : '',
	'L_BOOKMARK_TOPIC'		=> ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'],

	'U_POST_NEW_TOPIC' 		=> ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&amp;f=$forum_id") : '',
	'U_POST_REPLY_TOPIC' 	=> ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&amp;f=$forum_id&amp;t=$topic_id") : '',
	'U_BUMP_TOPIC'			=> (bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=bump&amp;f=$forum_id&amp;t=$topic_id&amp;hash=" . generate_link_hash("topic_$topic_id")) : '')
);

// Does this topic contain a poll?
if (!empty($topic_data['poll_start']))
{
	$sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
		FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p
		WHERE o.topic_id = $topic_id
			AND p.post_id = {$topic_data['topic_first_post_id']}
			AND p.topic_id = o.topic_id
		ORDER BY o.poll_option_id";
	$result = $db->sql_query($sql);

	$poll_info = array();
	while ($row = $db->sql_fetchrow($result))
Exemple #5
0
	{
		trigger_error('CANNOT_EDIT_POST_LOCKED');
	}
}

// Handle delete mode...
if ($mode == 'delete')
{
	handle_post_delete($forum_id, $topic_id, $post_id, $post_data);
	return;
}

// Handle bump mode...
if ($mode == 'bump')
{
	if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id'])
	   && check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}"))
	{
		$meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time);
		meta_refresh(3, $meta_url);

		$message = $user->lang['TOPIC_BUMPED'] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $meta_url . '">', '</a>');
		$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>');

		trigger_error($message);
	}

	trigger_error('BUMP_ERROR');
}

// Subject length limiting to 60 characters if first post...
}
if ($mode == 'delete' && $posting_data['poster_id'] == $_CLASS['core_user']->data['user_id'] && $_CLASS['auth']->acl_get('f_delete', $forum_id) && $post_id != $topic_last_post_id) {
    trigger_error('CANNOT_DELETE_REPLIED');
}
if ($mode == 'delete') {
    trigger_error('USER_CANNOT_DELETE');
}
// HTML, BBCode, Smilies, Images and Flash status
$html_status = $config['allow_html'] && $_CLASS['auth']->acl_get('f_html', $forum_id);
$bbcode_status = $config['allow_bbcode'] && $_CLASS['auth']->acl_get('f_bbcode', $forum_id);
$smilies_status = $config['allow_smilies'] && $_CLASS['auth']->acl_get('f_smilies', $forum_id);
$img_status = $_CLASS['auth']->acl_get('f_img', $forum_id);
$flash_status = $_CLASS['auth']->acl_get('f_flash', $forum_id);
$quote_status = $_CLASS['auth']->acl_get('f_quote', $forum_id);
// Bump Topic
if ($mode == 'bump' && ($bump_time = bump_topic_allowed($forum_id, $topic_bumped, $topic_last_post_time, $topic_poster, $topic_last_poster_id))) {
    $_CLASS['core_db']->transaction();
    $_CLASS['core_db']->query('UPDATE ' . FORUMS_POSTS_TABLE . "\n\t\tSET post_time = {$current_time}\n\t\tWHERE post_id = {$topic_last_post_id}\n\t\t\tAND topic_id = {$topic_id}");
    $_CLASS['core_db']->query('UPDATE ' . FORUMS_TOPICS_TABLE . "\n\t\tSET topic_last_post_time = {$current_time},\n\t\t\ttopic_bumped = 1,\n\t\t\ttopic_bumper = " . $_CLASS['core_user']->data['user_id'] . "\n\t\tWHERE topic_id = {$topic_id}");
    $_CLASS['core_db']->query('UPDATE ' . FORUMS_FORUMS_TABLE . '
		SET ' . implode(', ', update_last_post_information('forum', $forum_id)) . "\n\t\tWHERE forum_id = {$forum_id}");
    $_CLASS['core_db']->query('UPDATE ' . USERS_TABLE . "\n\t\tSET user_last_post_time = {$current_time}\n\t\tWHERE user_id = " . $_CLASS['core_user']->data['user_id']);
    $_CLASS['core_db']->transaction('commit');
    markread('topic', $forum_id, $topic_id, $current_time);
    add_log('mod', $forum_id, $topic_id, sprintf($_CLASS['core_user']->lang['LOGM_BUMP'], $posting_data['topic_title']));
    $_CLASS['core_display']->meta_refresh(3, generate_link("Forums&amp;file=viewtopic&amp;f={$forum_id}&amp;t={$topic_id}&amp;p={$topic_last_post_id}#{$topic_last_post_id}"));
    $message = $_CLASS['core_user']->lang['TOPIC_BUMPED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['VIEW_MESSAGE'], '<a href="' . generate_link("Forums&amp;file=viewtopic&amp;f={$forum_id}&amp;t={$topic_id}&amp;p={$topic_last_post_id}#{$topic_last_post_id}") . '">', '</a>') . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_FORUM'], '<a href="' . generate_link('Forums&amp;file=viewforum&amp;f=' . $forum_id) . '">', '</a>');
    trigger_error($message);
} elseif ($mode == 'bump') {
    trigger_error('BUMP_ERROR');
}
$topic_mod = '';
$topic_mod .= $_CLASS['auth']->acl_get('m_lock', $forum_id) || $_CLASS['auth']->acl_get('f_user_lock', $forum_id) && $_CLASS['core_user']->data['user_id'] != ANONYMOUS && $_CLASS['core_user']->data['user_id'] == $topic_data['topic_poster'] ? $topic_data['topic_status'] == ITEM_UNLOCKED ? '<option value="lock">' . $_CLASS['core_user']->lang['LOCK_TOPIC'] . '</option>' : '<option value="unlock">' . $_CLASS['core_user']->lang['UNLOCK_TOPIC'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('m_delete', $forum_id) ? '<option value="delete_topic">' . $_CLASS['core_user']->lang['DELETE_TOPIC'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('m_move', $forum_id) ? '<option value="move">' . $_CLASS['core_user']->lang['MOVE_TOPIC'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('m_split', $forum_id) ? '<option value="split">' . $_CLASS['core_user']->lang['SPLIT_TOPIC'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('m_merge', $forum_id) ? '<option value="merge">' . $_CLASS['core_user']->lang['MERGE_TOPIC'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('m_', $forum_id) ? '<option value="fork">' . $_CLASS['core_user']->lang['FORK_TOPIC'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('m_', $forum_id) && $topic_data['topic_type'] != POST_NORMAL ? '<option value="make_normal">' . $_CLASS['core_user']->lang['MAKE_NORMAL'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY ? '<option value="make_sticky">' . $_CLASS['core_user']->lang['MAKE_STICKY'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE ? '<option value="make_announce">' . $_CLASS['core_user']->lang['MAKE_ANNOUNCE'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL ? '<option value="make_global">' . $_CLASS['core_user']->lang['MAKE_GLOBAL'] . '</option>' : '';
$topic_mod .= $_CLASS['auth']->acl_get('m_', $forum_id) ? '<option value="viewlogs">' . $_CLASS['core_user']->lang['VIEW_TOPIC_LOGS'] . '</option>' : '';
$pagination = generate_pagination("Forums&amp;file=viewtopic&amp;t={$topic_id}&amp;{$u_sort_param}" . ($highlight_match ? "&amp;hilit={$highlight}" : ''), $total_posts, $config['posts_per_page'], $start);
$topic_data['topic_title'] = censor_text($topic_data['topic_title']);
// Send vars to template
$_CLASS['core_template']->assign_array(array('FORUM_ID' => $forum_id, 'FORUM_NAME' => $topic_data['forum_name'], 'FORUM_DESC' => $topic_data['forum_desc'], 'TOPIC_ID' => $topic_id, 'TOPIC_TITLE' => $topic_data['topic_title'], 'PAGINATION' => $pagination['formated'], 'PAGINATION_ARRAY' => $pagination['array'], 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $total_posts == 1 ? $_CLASS['core_user']->lang['VIEW_TOPIC_POST'] : sprintf($_CLASS['core_user']->lang['VIEW_TOPIC_POSTS'], $total_posts), 'U_MCP' => $_CLASS['auth']->acl_get('m_', $forum_id) ? generate_link("Forums&amp;file=mcp&amp;mode=topic_view&amp;t={$topic_id}&amp;start={$start}&amp;{$u_sort_param}", false, false) : '', 'MODERATORS' => isset($forum_moderators[$forum_id]) && !empty($forum_moderators[$forum_id]) ? implode(', ', $forum_moderators[$forum_id]) : '', 'POST_IMG' => $topic_data['forum_status'] == ITEM_LOCKED ? $_CLASS['core_user']->img('btn_locked', 'FORUM_LOCKED') : $_CLASS['core_user']->img('btn_post', 'POST_NEW_TOPIC'), 'QUOTE_IMG' => $_CLASS['core_user']->img('btn_quote', 'REPLY_WITH_QUOTE'), 'REPLY_IMG' => $topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED ? $_CLASS['core_user']->img('btn_locked', 'TOPIC_LOCKED') : $_CLASS['core_user']->img('btn_reply', 'REPLY_TO_TOPIC'), 'EDIT_IMG' => $_CLASS['core_user']->img('btn_edit', 'EDIT_POST'), 'DELETE_IMG' => $_CLASS['core_user']->img('btn_delete', 'DELETE_POST'), 'INFO_IMG' => $_CLASS['core_user']->img('btn_info', 'VIEW_INFO'), 'PROFILE_IMG' => $_CLASS['core_user']->img('btn_profile', 'READ_PROFILE'), 'SEARCH_IMG' => $_CLASS['core_user']->img('btn_search', 'SEARCH_USER_POSTS'), 'PM_IMG' => $_CLASS['core_user']->img('btn_pm', 'SEND_PRIVATE_MESSAGE'), 'EMAIL_IMG' => $_CLASS['core_user']->img('btn_email', 'SEND_EMAIL'), 'WWW_IMG' => $_CLASS['core_user']->img('btn_www', 'VISIT_WEBSITE'), 'ICQ_IMG' => $_CLASS['core_user']->img('btn_icq', 'ICQ'), 'AIM_IMG' => $_CLASS['core_user']->img('btn_aim', 'AIM'), 'MSN_IMG' => $_CLASS['core_user']->img('btn_msnm', 'MSNM'), 'YIM_IMG' => $_CLASS['core_user']->img('btn_yim', 'YIM'), 'JABBER_IMG' => $_CLASS['core_user']->img('btn_jabber', 'JABBER'), 'REPORT_IMG' => $_CLASS['core_user']->img('btn_report', 'REPORT_POST'), 'REPORTED_IMG' => $_CLASS['core_user']->img('icon_reported', 'POST_REPORTED'), 'UNAPPROVED_IMG' => $_CLASS['core_user']->img('icon_unapproved', 'POST_UNAPPROVED'), 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_TOPIC_ACTION' => generate_link("Forums&amp;file=viewtopic&amp;t={$topic_id}&amp;start={$start}"), 'S_TOPIC_MOD' => $topic_mod ? '<select name="mode">' . $topic_mod . '</select>' : '', 'S_MOD_ACTION' => generate_link("Forums&amp;file=mcp&amp;t={$topic_id}&amp;quickmod=1", false, false), 'S_DISPLAY_SEARCHBOX' => $_CLASS['auth']->acl_get('f_search', $forum_id) ? true : false, 'S_SEARCHBOX_ACTION' => generate_link('Forums&amp;file=search&amp;search_forum[]=' . $forum_id), 'U_TOPIC' => $view == 'print' ? generate_link('Forums&amp;file=viewtopic&amp;t=' . $topic_id, array('full' => true)) : generate_link('Forums&amp;file=viewtopic&amp;t=' . $topic_id), 'U_VIEW_UNREAD_POST' => $first_unread_makred ? generate_link("Forums&amp;file=viewtopic&amp;t={$topic_id}#unread") : false, 'U_VIEW_TOPIC' => generate_link($viewtopic_url), 'U_VIEW_FORUM' => generate_link('Forums&amp;file=viewforum&amp;f=' . $forum_id), 'U_VIEW_OLDER_TOPIC' => generate_link("Forums&amp;file=viewtopic&amp;t={$topic_id}&amp;view=previous"), 'U_VIEW_NEWER_TOPIC' => generate_link("Forums&amp;file=viewtopic&amp;t={$topic_id}&amp;view=next"), 'U_PRINT_TOPIC' => $_CLASS['auth']->acl_get('f_print', $forum_id) ? generate_link($viewtopic_url . '&amp;view=print') : '', 'U_EMAIL_TOPIC' => $_CLASS['auth']->acl_get('f_email', $forum_id) && $_CORE_CONFIG['email']['email_enable'] ? generate_link('Members_List&amp;mode=email&amp;t=' . $topic_id) : '', 'S_WATCH_FORUMS' => $topic_data['watch_topic'] ? false : true, 'U_WATCH_TOPIC' => $s_watching_topic['link'], 'L_WATCH_TOPIC' => $s_watching_topic['title'], 'U_BOOKMARK_TOPIC' => $_CLASS['core_user']->is_user && $config['allow_bookmarks'] ? generate_link($viewtopic_url . '&amp;bookmark=1') : '', 'L_BOOKMARK_TOPIC' => $_CLASS['core_user']->is_user && $config['allow_bookmarks'] && $topic_data['bookmarked'] ? $_CLASS['core_user']->lang['BOOKMARK_TOPIC_REMOVE'] : $_CLASS['core_user']->lang['BOOKMARK_TOPIC'], 'U_POST_NEW_TOPIC' => generate_link('Forums&amp;file=posting&amp;mode=post&amp;f=' . $forum_id), 'U_POST_REPLY_TOPIC' => generate_link("Forums&amp;file=posting&amp;mode=reply&amp;t={$topic_id}"), 'U_BUMP_TOPIC' => bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id']) ? generate_link("Forums&amp;file=posting&amp;mode=bump&amp;t={$topic_id}") : ''));
// Update topic view and if necessary attachment view counters ... but only
// if this is the first 'page view'
//mb_strpos() should never be 0 here
if (!mb_strpos($_CLASS['core_user']->data['session_url'], '&amp;t=' . $topic_id)) {
    $sql = 'UPDATE ' . FORUMS_TOPICS_TABLE . '
		SET topic_views = topic_views + 1, topic_last_view_time = ' . $_CLASS['core_user']->time . "\n\t\tWHERE topic_id = {$topic_id}";
    $_CLASS['core_db']->query($sql);
    // Update the attachment download counts
    if (!empty($update_count)) {
        $sql = 'UPDATE ' . FORUMS_ATTACHMENTS_TABLE . ' 
			SET download_count = download_count + 1 
			WHERE attach_id IN (' . implode(', ', array_unique($update_count)) . ')';
        $_CLASS['core_db']->query($sql);
    }
}