phpBB

Code Changes

File: viewtopic.php

  Unmodified   Added   Modified   Removed
Line 494Line 494
		watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0);
}
}

		watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0);
}
}

 

/**
* Event to modify highlight.
*
* @event core.viewtopic_highlight_modify
* @var string highlight String to be highlighted
* @var string highlight_match Highlight string to be used in preg_replace
* @var array topic_data Topic data
* @var int start Pagination start
* @var int total_posts Number of posts
* @var string viewtopic_url Current viewtopic URL
* @since 3.1.11-RC1
*/
$vars = array(
'highlight',
'highlight_match',
'topic_data',
'start',
'total_posts',
'viewtopic_url',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_highlight_modify', compact($vars)));


// Bookmarks
if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0))


// Bookmarks
if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0))

Line 588Line 610
	'topic_logs'			=> array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)),
);


	'topic_logs'			=> array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)),
);


foreach($quickmod_array as $option => $qm_ary)




























/**
* Event to modify data in the quickmod_array before it gets sent to the
* phpbb_add_quickmod_option function.
*
* @event core.viewtopic_add_quickmod_option_before
* @var int forum_id Forum ID
* @var int post_id Post ID
* @var array quickmod_array Array with quick moderation options data
* @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 string viewtopic_url URL to the topic page
* @var bool allow_change_type Topic change permissions check
* @since 3.1.9-RC1
*/
$vars = array(
'forum_id',
'post_id',
'quickmod_array',
'topic_data',
'topic_id',
'topic_tracking_info',
'viewtopic_url',
'allow_change_type',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_add_quickmod_option_before', compact($vars)));

foreach ($quickmod_array as $option => $qm_ary)

{
if (!empty($qm_ary[1]))
{

{
if (!empty($qm_ary[1]))
{

Line 651Line 700
* @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 1151Line 1200
* @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 1267Line 1316
				'rank_title'		=> '',
'rank_image' => '',
'rank_image_src' => '',

				'rank_title'		=> '',
'rank_image' => '',
'rank_image_src' => '',

				'sig'				=> '',

 
				'pm'				=> '',
'email' => '',
'jabber' => '',

				'pm'				=> '',
'email' => '',
'jabber' => '',

Line 1452Line 1500
			FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . '
AND in_message = 0

			FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . '
AND in_message = 0

			ORDER BY filetime DESC, post_msg_id ASC';

			ORDER BY attach_id DESC, post_msg_id ASC';

		$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))

		$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))

Line 1764Line 1812
		$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 1794Line 1842
	* @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 1808Line 1858
		'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 1820Line 1871
	$quote_allowed = $auth->acl_get('m_edit', $forum_id) || ($topic_data['topic_status'] != ITEM_LOCKED &&
($user->data['user_id'] == ANONYMOUS || $auth->acl_get('f_reply', $forum_id))
);

	$quote_allowed = $auth->acl_get('m_edit', $forum_id) || ($topic_data['topic_status'] != ITEM_LOCKED &&
($user->data['user_id'] == ANONYMOUS || $auth->acl_get('f_reply', $forum_id))
);

 

// Only display the quote button if the post is quotable. Posts not approved are not quotable.
$quote_allowed = ($quote_allowed && $row['post_visibility'] == ITEM_APPROVED) ? true : false;


$delete_allowed = $force_delete_allowed || ($user->data['is_registered'] && (
($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) ||
(!$s_cannot_delete && !$s_cannot_delete_lastpost && !$s_cannot_delete_time && !$s_cannot_delete_locked)
));


$delete_allowed = $force_delete_allowed || ($user->data['is_registered'] && (
($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) ||
(!$s_cannot_delete && !$s_cannot_delete_lastpost && !$s_cannot_delete_time && !$s_cannot_delete_locked)
));

 

$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 = $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?
$can_receive_pm = (


// Can this user receive a Private Message?
$can_receive_pm = (

Line 1888Line 1948
		'U_EDIT'			=> ($edit_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
'U_QUOTE' => ($quote_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&amp;mode=post_details&amp;f=$forum_id&amp;p=" . $row['post_id'], true, $user->session_id) : '',

		'U_EDIT'			=> ($edit_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
'U_QUOTE' => ($quote_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&amp;mode=post_details&amp;f=$forum_id&amp;p=" . $row['post_id'], true, $user->session_id) : '',

		'U_DELETE'			=> ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&amp;f=$forum_id&amp;p={$row['post_id']}") : '',

		'U_DELETE'			=> ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=' . (($softdelete_allowed) ? 'soft_delete' : 'delete') . "&amp;f=$forum_id&amp;p={$row['post_id']}") : '',


'U_SEARCH' => $user_cache[$poster_id]['search'],
'U_PM' => $u_pm,


'U_SEARCH' => $user_cache[$poster_id]['search'],
'U_PM' => $u_pm,

Line 1927Line 1987
		'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_POST_HIDDEN' => $row['hide_post'],
'L_POST_DISPLAY' => ($row['hide_post']) ? $user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $row['post_id'] . '" href="' . $viewtopic_url . "&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}" . '">', '</a>') : '',

		'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_POST_HIDDEN' => $row['hide_post'],
'L_POST_DISPLAY' => ($row['hide_post']) ? $user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $row['post_id'] . '" href="' . $viewtopic_url . "&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}" . '">', '</a>') : '',

 
		'S_DELETE_PERMANENT'	=> $permanent_delete_allowed,

	);

$user_poster_data = $user_cache[$poster_id];

	);

$user_poster_data = $user_cache[$poster_id];

Line 1949Line 2010
	* @var	array	post_row			Template block array of the post
* @var array topic_data Array with topic data
* @since 3.1.0-a1

	* @var	array	post_row			Template block array of the post
* @var array topic_data Array with topic data
* @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

	*/
$vars = array(
'start',

	*/
$vars = array(
'start',

Line 2049Line 2110
	* @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 2212Line 2273
* @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)));