phpBB

Code Changes

File: viewtopic.php

  Unmodified   Added   Modified   Removed
Line 262Line 262
}

$forum_id = (int) $topic_data['forum_id'];

}

$forum_id = (int) $topic_data['forum_id'];

 

/**
* Modify the forum ID to handle the correct display of viewtopic if needed
*
* @event core.viewtopic_modify_forum_id
* @var string forum_id forum ID
* @var array topic_data array of topic's data
* @since 3.2.5-RC1
*/
$vars = array(
'forum_id',
'topic_data',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_forum_id', compact($vars)));


// If the request is missing the f parameter, the forum id in the user session data is 0 at the moment.
// Let's fix that now so that the user can't hide from the forum's Who Is Online list.


// If the request is missing the f parameter, the forum id in the user session data is 0 at the moment.
// Let's fix that now so that the user can't hide from the forum's Who Is Online list.

Line 341Line 355

// Setup look and feel
$user->setup('viewtopic', $topic_data['forum_style']);


// Setup look and feel
$user->setup('viewtopic', $topic_data['forum_style']);

 

if ($view == 'print' && !$auth->acl_get('f_print', $forum_id))
{
send_status_line(403, 'Forbidden');
trigger_error('NO_AUTH_PRINT_TOPIC');
}


$overrides_f_read_check = false;
$overrides_forum_password_check = false;


$overrides_f_read_check = false;
$overrides_forum_password_check = false;

Line 432Line 452
$join_user_sql = array('a' => true, 't' => false, 's' => false);

$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';

$join_user_sql = array('a' => true, 't' => false, 's' => false);

$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';

 

/**
* Event to add new sorting options
*
* @event core.viewtopic_gen_sort_selects_before
* @var array limit_days Limit results by time
* @var array sort_by_text Language strings for sorting options
* @var array sort_by_sql SQL conditions for sorting options
* @var array join_user_sql SQL joins required for sorting options
* @var int sort_days User selected sort days
* @var string sort_key User selected sort key
* @var string sort_dir User selected sort direction
* @var string s_limit_days Initial value of limit days selectbox
* @var string s_sort_key Initial value of sort key selectbox
* @var string s_sort_dir Initial value of sort direction selectbox
* @var string u_sort_param Initial value of sorting form action
* @since 3.2.8-RC1
*/
$vars = array(
'limit_days',
'sort_by_text',
'sort_by_sql',
'join_user_sql',
'sort_days',
'sort_key',
'sort_dir',
's_limit_days',
's_sort_key',
's_sort_dir',
'u_sort_param',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_gen_sort_selects_before', compact($vars)));


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);



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);


Line 780Line 832

'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id",
'U_FORUM' => $server_path,


'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id",
'U_FORUM' => $server_path,

	'U_VIEW_TOPIC' 			=> $viewtopic_url,

	'U_VIEW_TOPIC' 			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . (strlen($u_sort_param) ? "&$u_sort_param" : '')),

	'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_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"),

Line 998Line 1050
				'total_votes'		=> array_sum($vote_counts),
'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']),
);

				'total_votes'		=> array_sum($vote_counts),
'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']),
);

 

/**
* Event to manipulate the poll data sent by AJAX response
*
* @event core.viewtopic_modify_poll_ajax_data
* @var array data JSON response data
* @var array valid_user_votes Valid user votes
* @var array vote_counts Vote counts
* @var int forum_id Forum ID
* @var array topic_data Topic data
* @var array poll_info Array with the poll information
* @since 3.2.4-RC1
*/
$vars = array(
'data',
'valid_user_votes',
'vote_counts',
'forum_id',
'topic_data',
'poll_info',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_ajax_data', compact($vars)));


			$json_response = new \phpbb\json_response();
$json_response->send($data);
}

			$json_response = new \phpbb\json_response();
$json_response->send($data);
}

Line 1148Line 1223
		" . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . "
$limit_posts_time
ORDER BY $sql_sort_order";

		" . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . "
$limit_posts_time
ORDER BY $sql_sort_order";

 

/**
* Event to modify the SQL query that gets post_list
*
* @event core.viewtopic_modify_post_list_sql
* @var string sql The SQL query to generate the post_list
* @var int sql_limit The number of posts the query fetches
* @var int sql_start The index the query starts to fetch from
* @var string sort_key Key the posts are sorted by
* @var string sort_days Display posts of previous x days
* @var int forum_id Forum ID
* @since 3.2.4-RC1
*/
$vars = array(
'sql',
'sql_limit',
'sql_start',
'sort_key',
'sort_days',
'forum_id',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_list_sql', compact($vars)));


$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);

$i = ($store_reverse) ? $sql_limit - 1 : 0;

$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);

$i = ($store_reverse) ? $sql_limit - 1 : 0;

Line 1576Line 1674
	}
}


	}
}


 
if ($config['enable_accurate_pm_button'])
{

// Get the list of users who can receive private messages
$can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm');
$can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm'];

// Get the list of permanently banned users
$permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false);

// Get the list of users who can receive private messages
$can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm');
$can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm'];

// Get the list of permanently banned users
$permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false);

 
}
else
{
$can_receive_pm_list = array_keys($user_cache);
$permanently_banned_users = [];
}


$i_total = count($rowset) - 1;
$prev_post_id = '';


$i_total = count($rowset) - 1;
$prev_post_id = '';

Line 1938Line 2044
		'CONTACT_USER'		=> $user_cache[$poster_id]['contact_user'],

'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false),

		'CONTACT_USER'		=> $user_cache[$poster_id]['contact_user'],

'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false),

 
		'POST_DATE_RFC3339'	=> gmdate(DATE_RFC3339, $row['post_time']),

		'POST_SUBJECT'		=> $row['post_subject'],
'MESSAGE' => $message,
'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '',

		'POST_SUBJECT'		=> $row['post_subject'],
'MESSAGE' => $message,
'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '',

Line 1994Line 2101
		'S_FIRST_UNREAD'	=> $s_first_unread,
'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false,
'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false,

		'S_FIRST_UNREAD'	=> $s_first_unread,
'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false,
'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false,

 
		'S_FIRST_POST'		=> ($topic_data['topic_first_post_id'] == $row['post_id']) ? true : false,


'S_IGNORE_POST' => ($row['foe']) ? true : false,
'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '',


'S_IGNORE_POST' => ($row['foe']) ? true : false,
'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '',

Line 2060Line 2168
		array(
'ID' => 'pm',
'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'],

		array(
'ID' => 'pm',
'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'],

			'U_CONTACT'	=> $u_pm,

			'U_CONTACT'	=> $post_row['U_PM'],

		),
array(
'ID' => 'email',

		),
array(
'ID' => 'email',

Line 2240Line 2348

$qr_hidden_fields = array(
'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'],


$qr_hidden_fields = array(
'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'],

			'lastclick'				=> (int) time(),

 
			'topic_id'				=> (int) $topic_data['topic_id'],
'forum_id' => (int) $forum_id,
);

			'topic_id'				=> (int) $topic_data['topic_id'],
'forum_id' => (int) $forum_id,
);

Line 2253Line 2360
		($s_notify)						? $qr_hidden_fields['notify'] = 1				: true;
($topic_data['topic_status'] == ITEM_LOCKED) ? $qr_hidden_fields['lock_topic'] = 1 : true;


		($s_notify)						? $qr_hidden_fields['notify'] = 1				: true;
($topic_data['topic_status'] == ITEM_LOCKED) ? $qr_hidden_fields['lock_topic'] = 1 : true;


		$template->assign_vars(array(

		$tpl_ary = [

			'S_QUICK_REPLY'			=> true,
'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"),
'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields),
'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']),

			'S_QUICK_REPLY'			=> true,
'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"),
'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields),
'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']),

		));














		];

/**
* Event after the quick-reply has been setup
*
* @event core.viewtopic_modify_quick_reply_template_vars
* @var array tpl_ary Array with template data
* @var array topic_data Array with topic data
* @since 3.2.9-RC1
*/
$vars = ['tpl_ary', 'topic_data'];
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_quick_reply_template_vars', compact($vars)));

$template->assign_vars($tpl_ary);

	}
}
// now I have the urge to wash my hands :(

	}
}
// now I have the urge to wash my hands :(