phpBB

Code Changes

File: viewtopic.php

  Unmodified   Added   Modified   Removed
Line 32Line 32
$post_id	= $request->variable('p', 0);
$voted_id = $request->variable('vote_id', array('' => 0));


$post_id	= $request->variable('p', 0);
$voted_id = $request->variable('vote_id', array('' => 0));


$voted_id = (sizeof($voted_id) > 1) ? array_unique($voted_id) : $voted_id;

$voted_id = (count($voted_id) > 1) ? array_unique($voted_id) : $voted_id;



$start = $request->variable('start', 0);



$start = $request->variable('start', 0);

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.
$user->page['forum'] = $forum_id;


// Now we know the forum_id and can check the permissions


// Now we know the forum_id and can check the permissions

if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id))

if (!$phpbb_content_visibility->is_visible('topic', $forum_id, $topic_data))

{
trigger_error('NO_TOPIC');
}

{
trigger_error('NO_TOPIC');
}

Line 323Line 341
$topic_id = (int) $topic_data['topic_id'];
$topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1;


$topic_id = (int) $topic_data['topic_id'];
$topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1;


// Check sticky/announcement time limit
if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time())

// Check sticky/announcement/global  time limit
if (($topic_data['topic_type'] != POST_NORMAL) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time())

{
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_type = ' . POST_NORMAL . ', topic_time_limit = 0

{
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_type = ' . POST_NORMAL . ', topic_time_limit = 0

Line 337Line 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 428Line 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 703Line 759
* @var	int		total_posts			Topic total posts count
* @var string viewtopic_url URL to the topic page
* @since 3.1.0-RC4

* @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

* @changed 3.1.2-RC1 Added viewtopic_url

*/
$vars = array(
'base_url',

*/
$vars = array(
'base_url',

Line 736Line 792

'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&amp;mode=topic_view&amp;f=$forum_id&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start") . ((strlen($u_sort_param)) ? "&amp;$u_sort_param" : ''), true, $user->session_id) : '',


'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&amp;mode=topic_view&amp;f=$forum_id&amp;t=$topic_id" . (($start == 0) ? '' : "&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($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '',

	'MODERATORS'	=> (isset($forum_moderators[$forum_id]) && count($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'),


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

Line 759Line 815
	'S_SELECT_SORT_DIR' 	=> $s_sort_dir,
'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DAYS' => $s_limit_days,

	'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_SINGLE_MODERATOR'	=> (!empty($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id]) > 1) ? false : true,

	'S_TOPIC_ACTION' 		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start")),
'S_MOD_ACTION' => $s_quickmod_action,


	'S_TOPIC_ACTION' 		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start")),
'S_MOD_ACTION' => $s_quickmod_action,


Line 776Line 832

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


'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&amp;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&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start") . (strlen($u_sort_param) ? "&amp;$u_sort_param" : '')),

	'U_CANONICAL'			=> generate_board_url() . '/' . append_sid("viewtopic.$phpEx", "t=$topic_id" . (($start) ? "&amp;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&amp;t=$topic_id&amp;view=previous"),

	'U_CANONICAL'			=> generate_board_url() . '/' . append_sid("viewtopic.$phpEx", "t=$topic_id" . (($start) ? "&amp;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&amp;t=$topic_id&amp;view=previous"),

Line 852Line 908
		(($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) &&
$topic_data['topic_status'] != ITEM_LOCKED &&
$topic_data['forum_status'] != ITEM_LOCKED &&

		(($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) &&
$topic_data['topic_status'] != ITEM_LOCKED &&
$topic_data['forum_status'] != ITEM_LOCKED &&

		(!sizeof($cur_voted_id) ||

		(!count($cur_voted_id) ||

		($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false;

		($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false;

	$s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true : false;

	$s_display_results = (!$s_can_vote || ($s_can_vote && count($cur_voted_id)) || $view == 'viewpoll') ? true : false;


/**
* Event to manipulate the poll data


/**
* Event to manipulate the poll data

Line 889Line 945
	if ($update && $s_can_vote)
{


	if ($update && $s_can_vote)
{


		if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting'))

		if (!count($voted_id) || count($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting'))

		{
$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start"));

meta_refresh(5, $redirect_url);

		{
$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start"));

meta_refresh(5, $redirect_url);

			if (!sizeof($voted_id))

			if (!count($voted_id))

			{
$message = 'NO_VOTE_OPTION';
}

			{
$message = 'NO_VOTE_OPTION';
}

			else if (sizeof($voted_id) > $topic_data['poll_max_options'])

			else if (count($voted_id) > $topic_data['poll_max_options'])

			{
$message = 'TOO_MANY_VOTE_OPTIONS';
}

			{
$message = 'TOO_MANY_VOTE_OPTIONS';
}

Line 992Line 1048
				'user_votes'		=> array_flip($valid_user_votes),
'vote_counts' => $vote_counts,
'total_votes' => array_sum($vote_counts),

				'user_votes'		=> array_flip($valid_user_votes),
'vote_counts' => $vote_counts,
'total_votes' => array_sum($vote_counts),

				'can_vote'			=> !sizeof($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']),

				'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 1012Line 1091

$parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;



$parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;


	for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++)

	for ($i = 0, $size = count($poll_info); $i < $size; $i++)

	{
$poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_flags, true);
}

	{
$poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_flags, true);
}

Line 1144Line 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 1154Line 1256
}
$db->sql_freeresult($result);


}
$db->sql_freeresult($result);


if (!sizeof($post_list))

if (!count($post_list))

{
if ($sort_days)
{

{
if ($sort_days)
{

Line 1203Line 1305
* @var	int		start		Pagination information
* @var array sql_ary The SQL array to get the data of posts and posters
* @since 3.1.0-a1

* @var	int		start		Pagination information
* @var array sql_ary The SQL array to get the data of posts and posters
* @since 3.1.0-a1

* @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start

* @changed 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start

*/
$vars = array(
'forum_id',

*/
$vars = array(
'forum_id',

Line 1478Line 1580
}

// Generate online information for user

}

// Generate online information for user

if ($config['load_onlinetrack'] && sizeof($id_cache))

if ($config['load_onlinetrack'] && count($id_cache))

{
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '

{
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '

Line 1496Line 1598
unset($id_cache);

// Pull attachment data

unset($id_cache);

// Pull attachment data

if (sizeof($attach_list))

if (count($attach_list))

{
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id))
{

{
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id))
{

Line 1514Line 1616
		$db->sql_freeresult($result);

// No attachments exist, but post table thinks they do so go ahead and reset post_attach flags

		$db->sql_freeresult($result);

// No attachments exist, but post table thinks they do so go ahead and reset post_attach flags

		if (!sizeof($attachments))

		if (!count($attachments))

		{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_attachment = 0

		{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_attachment = 0

Line 1522Line 1624
			$db->sql_query($sql);

// We need to update the topic indicator too if the complete topic is now without an attachment

			$db->sql_query($sql);

// We need to update the topic indicator too if the complete topic is now without an attachment

			if (sizeof($rowset) != $total_posts)

			if (count($rowset) != $total_posts)

			{
// Not all posts are displayed so we query the db to find if there's any attachment for this topic
$sql = 'SELECT a.post_msg_id as post_id

			{
// Not all posts are displayed so we query the db to find if there's any attachment for this topic
$sql = 'SELECT a.post_msg_id as post_id

Line 1572Line 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 = sizeof($rowset) - 1;

$i_total = count($rowset) - 1;

$prev_post_id = '';

$template->assign_vars(array(
'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'],

$prev_post_id = '';

$template->assign_vars(array(
'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'],

	'S_NUM_POSTS' => sizeof($post_list))

	'S_NUM_POSTS' => count($post_list))

);

/**

);

/**

Line 1629Line 1739

// Output the posts
$first_unread = $post_unread = false;


// Output the posts
$first_unread = $post_unread = false;

for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)

for ($i = 0, $end = count($post_list); $i < $end; ++$i)

{
// A non-existing rowset only happens if there was no user present for the entered poster_id
// This could be a broken posts table.

{
// A non-existing rowset only happens if there was no user present for the entered poster_id
// This could be a broken posts table.

Line 1672Line 1782
	if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason'])
{
// Get usernames for all following posts if not already stored

	if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason'])
{
// Get usernames for all following posts if not already stored

		if (!sizeof($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']]))))

		if (!count($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']]))))

		{
// Remove all post_ids already parsed (we do not have to check them)
$post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i);

		{
// Remove all post_ids already parsed (we do not have to check them)
$post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i);

Line 1736Line 1846
	if ($row['post_visibility'] == ITEM_DELETED && $row['post_delete_user'])
{
// Get usernames for all following posts if not already stored

	if ($row['post_visibility'] == ITEM_DELETED && $row['post_delete_user'])
{
// Get usernames for all following posts if not already stored

		if (!sizeof($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']]))))

		if (!count($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']]))))

		{
// Remove all post_ids already parsed (we do not have to check them)
$post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i);

		{
// Remove all post_ids already parsed (we do not have to check them)
$post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i);

Line 1817Line 1927
		$s_first_unread = $first_unread = true;
}


		$s_first_unread = $first_unread = true;
}


	$force_edit_allowed = $force_delete_allowed = false;

	$force_edit_allowed = $force_delete_allowed = $force_softdelete_allowed = false;


$s_cannot_edit = !$auth->acl_get('f_edit', $forum_id) || $user->data['user_id'] != $poster_id;
$s_cannot_edit_time = $config['edit_time'] && $row['post_time'] <= time() - ($config['edit_time'] * 60);


$s_cannot_edit = !$auth->acl_get('f_edit', $forum_id) || $user->data['user_id'] != $poster_id;
$s_cannot_edit_time = $config['edit_time'] && $row['post_time'] <= time() - ($config['edit_time'] * 60);

Line 1847Line 1957
	* @var	bool	s_cannot_delete_lastpost	User can not delete the post because it's not the last post of the topic
* @var bool s_cannot_delete_locked User can not delete the post because it's locked
* @var bool s_cannot_delete_time User can not delete the post because edit_time has passed

	* @var	bool	s_cannot_delete_lastpost	User can not delete the post because it's not the last post of the topic
* @var bool s_cannot_delete_locked User can not delete the post because it's locked
* @var bool s_cannot_delete_time User can not delete the post because edit_time has passed

 
	* @var	bool	force_softdelete_allowed	Allow the user to —čoftdelete the post (all permissions and conditions are ignored)

	* @since 3.1.0-b4

	* @since 3.1.0-b4

 
	* @changed 3.1.11-RC1 Added force_softdelete_allowed var

	*/
$vars = array(
'row',

	*/
$vars = array(
'row',

Line 1861Line 1973
		's_cannot_delete_lastpost',
's_cannot_delete_locked',
's_cannot_delete_time',

		's_cannot_delete_lastpost',
's_cannot_delete_locked',
's_cannot_delete_time',

 
		'force_softdelete_allowed',

	);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_action_conditions', compact($vars)));


	);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_action_conditions', compact($vars)));


Line 1882Line 1995
		(!$s_cannot_delete && !$s_cannot_delete_lastpost && !$s_cannot_delete_time && !$s_cannot_delete_locked)
));


		(!$s_cannot_delete && !$s_cannot_delete_lastpost && !$s_cannot_delete_time && !$s_cannot_delete_locked)
));


	$softdelete_allowed = ($auth->acl_get('m_softdelete', $forum_id) ||
($auth->acl_get('f_softdelete', $forum_id) && $user->data['user_id'] == $poster_id)) && ($row['post_visibility'] != ITEM_DELETED);

	$softdelete_allowed = $force_softdelete_allowed || (($auth->acl_get('m_softdelete', $forum_id) ||
($auth->acl_get('f_softdelete', $forum_id) && $user->data['user_id'] == $poster_id)) && ($row['post_visibility'] != ITEM_DELETED));





	$permanent_delete_allowed = ($auth->acl_get('m_delete', $forum_id) ||

	$permanent_delete_allowed = $force_delete_allowed || ($auth->acl_get('m_delete', $forum_id) ||

		($auth->acl_get('f_delete', $forum_id) && $user->data['user_id'] == $poster_id));

// Can this user receive a Private Message?

		($auth->acl_get('f_delete', $forum_id) && $user->data['user_id'] == $poster_id));

// Can this user receive a Private Message?

Line 1931Line 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 1976Line 2090


'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,



'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,

		'S_MULTIPLE_ATTACHMENTS'	=> !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1,

		'S_MULTIPLE_ATTACHMENTS'	=> !empty($attachments[$row['post_id']]) && count($attachments[$row['post_id']]) > 1,

		'S_POST_UNAPPROVED'	=> ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) ? true : false,
'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false,
'L_POST_DELETED_MESSAGE' => $l_deleted_message,

		'S_POST_UNAPPROVED'	=> ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) ? true : false,
'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false,
'L_POST_DELETED_MESSAGE' => $l_deleted_message,

Line 1985Line 2099
		'S_FRIEND'			=> ($row['friend']) ? true : false,
'S_UNREAD_POST' => $post_unread,
'S_FIRST_UNREAD' => $s_first_unread,

		'S_FRIEND'			=> ($row['friend']) ? true : false,
'S_UNREAD_POST' => $post_unread,
'S_FIRST_UNREAD' => $s_first_unread,

		'S_CUSTOM_FIELDS'	=> (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false,

		'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_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 2014Line 2129
	* @var	array	user_poster_data	Poster's data from user cache
* @var array post_row Template block array of the post
* @var array topic_data Array with topic data

	* @var	array	user_poster_data	Poster's data from user cache
* @var array post_row Template block array of the post
* @var array topic_data Array with topic data

 
	* @var	array	user_cache			Array with cached user data
* @var array post_edit_list Array with post edited list

	* @since 3.1.0-a1

	* @since 3.1.0-a1

	* @change 3.1.0-a3 Added vars start, current_row_number, end, attachments
* @change 3.1.0-b3 Added topic_data array, total_posts
* @change 3.1.0-RC3 Added poster_id


	* @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments
* @changed 3.1.0-b3 Added topic_data array, total_posts
* @changed 3.1.0-RC3 Added poster_id
* @changed 3.2.2-RC1 Added user_cache and post_edit_list

	*/
$vars = array(
'start',

	*/
$vars = array(
'start',

Line 2031Line 2149
		'user_poster_data',
'post_row',
'topic_data',

		'user_poster_data',
'post_row',
'topic_data',

 
		'user_cache',
'post_edit_list',

	);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars)));

$i = $current_row_number;


	);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars)));

$i = $current_row_number;


	if (isset($cp_row['row']) && sizeof($cp_row['row']))

	if (isset($cp_row['row']) && count($cp_row['row']))

	{
$post_row = array_merge($post_row, $cp_row['row']);
}

	{
$post_row = array_merge($post_row, $cp_row['row']);
}

Line 2048Line 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 2115Line 2235
	* @var	array	post_row			Template block array of the post
* @var array topic_data Array with topic data
* @since 3.1.0-a3

	* @var	array	post_row			Template block array of the post
* @var array topic_data Array with topic data
* @since 3.1.0-a3

	* @change 3.1.0-b3 Added topic_data array, total_posts

	* @changed 3.1.0-b3 Added topic_data array, total_posts

	*/
$vars = array(
'start',

	*/
$vars = array(
'start',

Line 2149Line 2269
	$db->sql_query($sql);

// Update the attachment download counts

	$db->sql_query($sql);

// Update the attachment download counts

	if (sizeof($update_count))

	if (count($update_count))

	{
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
SET download_count = download_count + 1

	{
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
SET download_count = download_count + 1

Line 2228Line 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 2241Line 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&amp;f=$forum_id&amp;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&amp;f=$forum_id&amp;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 :(

Line 2278Line 2410
* @var	int		start			Start offset used to calculate the page
* @var array post_list Array with post_ids we are going to display
* @since 3.1.0-a1

* @var	int		start			Start offset used to calculate the page
* @var array post_list Array with post_ids we are going to display
* @since 3.1.0-a1

* @change 3.1.0-RC4 Added post_list var

* @changed 3.1.0-RC4 Added post_list var

*/
$vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list');
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars)));

*/
$vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list');
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars)));