phpBB

Code Changes

File: includes/functions_posting.php

  Unmodified   Added   Modified   Removed
Line 52Line 52

page_header($user->lang['SMILIES']);



page_header($user->lang['SMILIES']);


		$sql = 'SELECT COUNT(smiley_id) AS item_count
FROM ' . SMILIES_TABLE . '
GROUP BY smiley_url';





















		$sql_ary = [
'SELECT' => 'COUNT(s.smiley_id) AS item_count',
'FROM' => [
SMILIES_TABLE => 's',
],
'GROUP_BY' => 's.smiley_url',
];

/**
* Modify SQL query that fetches the total number of smilies in window mode
*
* @event core.generate_smilies_count_sql_before
* @var int forum_id Forum where smilies are generated
* @var array sql_ary Array with the SQL query
* @since 3.2.9-RC1
*/
$vars = [
'forum_id',
'sql_ary',
];
extract($phpbb_dispatcher->trigger_event('core.generate_smilies_count_sql_before', compact($vars)));

$sql = $db->sql_build_query('SELECT', $sql_ary);

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

$smiley_count = 0;

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

$smiley_count = 0;

Line 114Line 134
	}
$db->sql_freeresult($result);


	}
$db->sql_freeresult($result);


	if (sizeof($smilies))

















	/**
* Modify smilies before they are assigned to the template
*
* @event core.generate_smilies_modify_rowset
* @var string mode Smiley mode, either window or inline
* @var int forum_id Forum where smilies are generated
* @var array smilies Smiley rows fetched from the database
* @since 3.2.9-RC1
*/
$vars = [
'mode',
'forum_id',
'smilies',
];
extract($phpbb_dispatcher->trigger_event('core.generate_smilies_modify_rowset', compact($vars)));

if (count($smilies))

	{
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path();


	{
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path();


Line 200Line 236
		$topic_condition = '';
}


		$topic_condition = '';
}


	if (sizeof($ids) == 1)

	if (count($ids) == 1)

	{

	{

		$sql = 'SELECT MAX(p.post_id) as last_post_id

		$sql = 'SELECT p.post_id as last_post_id

			FROM ' . POSTS_TABLE . " p $topic_join
WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . "
$topic_condition

			FROM ' . POSTS_TABLE . " p $topic_join
WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . "
$topic_condition

				AND p.post_visibility = " . ITEM_APPROVED;



				AND p.post_visibility = " . ITEM_APPROVED . "
ORDER BY p.post_id DESC";
$result = $db->sql_query_limit($sql, 1);

	}
else
{

	}
else
{

Line 216Line 254
				$topic_condition
AND p.post_visibility = " . ITEM_APPROVED . "
GROUP BY p.{$type}_id";

				$topic_condition
AND p.post_visibility = " . ITEM_APPROVED . "
GROUP BY p.{$type}_id";

	}

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

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

 
	}


$last_post_ids = array();
while ($row = $db->sql_fetchrow($result))
{


$last_post_ids = array();
while ($row = $db->sql_fetchrow($result))
{

		if (sizeof($ids) == 1)

		if (count($ids) == 1)

		{
$row[$type . '_id'] = $ids[0];
}

		{
$row[$type . '_id'] = $ids[0];
}

Line 256Line 294
		}
}


		}
}


	if (sizeof($last_post_ids))

	if (count($last_post_ids))

	{
$sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u

	{
$sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u

Line 277Line 315
	}
unset($empty_forums, $ids, $last_post_ids);


	}
unset($empty_forums, $ids, $last_post_ids);


	if ($return_update_sql || !sizeof($update_sql))

	if ($return_update_sql || !count($update_sql))

	{
return $update_sql;
}

	{
return $update_sql;
}

Line 310Line 348
		$template->assign_var('S_NO_ICON_CHECKED', ' checked="checked"');
}


		$template->assign_var('S_NO_ICON_CHECKED', ' checked="checked"');
}


	if (sizeof($icons))

	if (count($icons))

	{
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;


	{
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;


Line 519Line 557
*/
function create_thumbnail($source, $destination, $mimetype)
{

*/
function create_thumbnail($source, $destination, $mimetype)
{

	global $config, $phpbb_filesystem;

	global $config, $phpbb_filesystem, $phpbb_dispatcher;


$min_filesize = (int) $config['img_min_thumb_filesize'];
$img_filesize = (file_exists($source)) ? @filesize($source) : false;


$min_filesize = (int) $config['img_min_thumb_filesize'];
$img_filesize = (file_exists($source)) ? @filesize($source) : false;

Line 551Line 589
		return false;
}


		return false;
}


	$used_imagick = false;

	$thumbnail_created = false;





	// Only use ImageMagick if defined and the passthru function not disabled
if ($config['img_imagick'] && function_exists('passthru'))
{
if (substr($config['img_imagick'], -1) !== '/')
{
$config['img_imagick'] .= '/';
}

@passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -geometry ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"');

if (file_exists($destination))
{
$used_imagick = true;
}
}







	/**
* Create thumbnail event to replace GD thumbnail creation with for example ImageMagick
*
* @event core.thumbnail_create_before
* @var string source Image source path
* @var string destination Thumbnail destination path
* @var string mimetype Image mime type
* @var float new_width Calculated thumbnail width
* @var float new_height Calculated thumbnail height
* @var bool thumbnail_created Set to true to skip default GD thumbnail creation
* @since 3.2.4
*/
$vars = array(
'source',
'destination',
'mimetype',
'new_width',
'new_height',
'thumbnail_created',
);
extract($phpbb_dispatcher->trigger_event('core.thumbnail_create_before', compact($vars)));





	if (!$used_imagick)

	if (!$thumbnail_created)

	{
$type = get_supported_image_types($type);


	{
$type = get_supported_image_types($type);


Line 690Line 734
{
global $template;


{
global $template;


	if (sizeof($attachment_data))

	if (count($attachment_data))

	{
$s_inline_attachment_options = '';


	{
$s_inline_attachment_options = '';


Line 712Line 756
*/
function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true)
{

*/
function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true)
{

	global $template, $config, $phpbb_root_path, $phpEx, $user;

	global $template, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher;


// Some default template variables
$template->assign_vars(array(
'S_SHOW_ATTACH_BOX' => $show_attach_box,


// Some default template variables
$template->assign_vars(array(
'S_SHOW_ATTACH_BOX' => $show_attach_box,

		'S_HAS_ATTACHMENTS'	=> sizeof($attachment_data),

		'S_HAS_ATTACHMENTS'	=> count($attachment_data),

		'FILESIZE'			=> $config['max_filesize'],
'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '',
));


		'FILESIZE'			=> $config['max_filesize'],
'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '',
));


	if (sizeof($attachment_data))

	if (count($attachment_data))

	{
// We display the posted attachments within the desired order.
($config['display_order']) ? krsort($attachment_data) : ksort($attachment_data);

	{
// We display the posted attachments within the desired order.
($config['display_order']) ? krsort($attachment_data) : ksort($attachment_data);

 

$attachrow_template_vars = [];


foreach ($attachment_data as $count => $attach_row)
{


foreach ($attachment_data as $count => $attach_row)
{

Line 739Line 785

$download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false);



$download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false);


			$template->assign_block_vars('attach_row', array(

			$attachrow_template_vars[(int) $attach_row['attach_id']] = array(

				'FILENAME'			=> utf8_basename($attach_row['real_filename']),
'A_FILENAME' => addslashes(utf8_basename($attach_row['real_filename'])),
'FILE_COMMENT' => $attach_row['attach_comment'],

				'FILENAME'			=> utf8_basename($attach_row['real_filename']),
'A_FILENAME' => addslashes(utf8_basename($attach_row['real_filename'])),
'FILE_COMMENT' => $attach_row['attach_comment'],

Line 749Line 795
				'FILESIZE'			=> get_formatted_filesize($attach_row['filesize']),

'U_VIEW_ATTACHMENT' => $download_link,

				'FILESIZE'			=> get_formatted_filesize($attach_row['filesize']),

'U_VIEW_ATTACHMENT' => $download_link,

				'S_HIDDEN'			=> $hidden)

				'S_HIDDEN'			=> $hidden,

			);
}

			);
}

 

/**
* Modify inline attachments template vars
*
* @event core.modify_inline_attachments_template_vars
* @var array attachment_data Array containing attachments data
* @var array attachrow_template_vars Array containing attachments template vars
* @since 3.2.2-RC1
*/
$vars = array('attachment_data', 'attachrow_template_vars');
extract($phpbb_dispatcher->trigger_event('core.modify_inline_attachments_template_vars', compact($vars)));

$template->assign_block_vars_array('attach_row', $attachrow_template_vars);

	}


	}


	return sizeof($attachment_data);

	return count($attachment_data);

}

//

}

//

Line 802Line 861
	}
$db->sql_freeresult($result);


	}
$db->sql_freeresult($result);


	if (!sizeof($draft_rows))

	if (!count($draft_rows))

	{
return;
}

$topic_rows = array();

	{
return;
}

$topic_rows = array();

	if (sizeof($topic_ids))

	if (count($topic_ids))

	{
$sql = 'SELECT topic_id, forum_id, topic_title, topic_poster
FROM ' . TOPICS_TABLE . '

	{
$sql = 'SELECT topic_id, forum_id, topic_title, topic_poster
FROM ' . TOPICS_TABLE . '

Line 921Line 980

$db->sql_freeresult($result);



$db->sql_freeresult($result);


	if (!sizeof($post_list))

	if (!count($post_list))

	{
return false;
}

	{
return false;
}

Line 954Line 1013
		'WHERE'		=> $db->sql_in_set('p.post_id', $post_list) . '
AND u.user_id = p.poster_id',
);

		'WHERE'		=> $db->sql_in_set('p.post_id', $post_list) . '
AND u.user_id = p.poster_id',
);

 

/**
* Event to modify the SQL query for topic reviews
*
* @event core.topic_review_modify_sql_ary
* @var int topic_id The topic ID that is being reviewed
* @var int forum_id The topic's forum ID
* @var string mode The topic review mode
* @var int cur_post_id Post offset ID
* @var bool show_quote_button Flag indicating if the quote button should be displayed
* @var array post_list Array with the post IDs
* @var array sql_ary Array with the SQL query
* @since 3.2.8-RC1
*/
$vars = array(
'topic_id',
'forum_id',
'mode',
'cur_post_id',
'show_quote_button',
'post_list',
'sql_ary',
);
extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_sql_ary', compact($vars)));


$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);


$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);

Line 1016Line 1099
	);
extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_post_list', compact($vars)));


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


	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 1165Line 1248
*/
function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '')
{

*/
function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '')
{

	global $db, $user, $phpbb_container;

	global $db, $user, $phpbb_container, $phpbb_dispatcher;

	global $config, $phpEx, $phpbb_root_path;

// Specify our post mode

	global $config, $phpEx, $phpbb_root_path;

// Specify our post mode

Line 1243Line 1326

foreach ($shadow_forum_ids as $updated_forum => $topic_count)
{


foreach ($shadow_forum_ids as $updated_forum => $topic_count)
{

				// counting is fun! we only have to do sizeof($forum_ids) number of queries,

				// counting is fun! we only have to do count($forum_ids) number of queries,

				// even if the topic is moved back to where its shadow lives (we count how many times it is in a forum)
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET forum_topics_approved = forum_topics_approved - ' . $topic_count . '

				// even if the topic is moved back to where its shadow lives (we count how many times it is in a forum)
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET forum_topics_approved = forum_topics_approved - ' . $topic_count . '

Line 1261Line 1344
				delete_topics('topic_id', array($topic_id), false);

$phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data);

				delete_topics('topic_id', array($topic_id), false);

$phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data);

 
				$config->increment('num_posts', -1, false);


$update_sql = update_post_information('forum', $forum_id, true);


$update_sql = update_post_information('forum', $forum_id, true);

				if (sizeof($update_sql))

				if (count($update_sql))

				{
$sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
$sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);

				{
$sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
$sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);

Line 1312Line 1396
			{
// Update last post information when hard deleting. Soft delete already did that by itself.
$update_sql = update_post_information('forum', $forum_id, true);

			{
// Update last post information when hard deleting. Soft delete already did that by itself.
$update_sql = update_post_information('forum', $forum_id, true);

				if (sizeof($update_sql))

				if (count($update_sql))

				{
$sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . implode(', ', $update_sql[$forum_id]);
}

				{
$sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . implode(', ', $update_sql[$forum_id]);
}

Line 1415Line 1499
	{
sync('topic_reported', 'topic_id', array($topic_id));
}

	{
sync('topic_reported', 'topic_id', array($topic_id));
}

 

/**
* This event is used for performing actions directly after a post or topic
* has been deleted.
*
* @event core.delete_post_after
* @var int forum_id Post forum ID
* @var int topic_id Post topic ID
* @var int post_id Post ID
* @var array data Post data
* @var bool is_soft Soft delete flag
* @var string softdelete_reason Soft delete reason
* @var string post_mode delete_topic, delete_first_post, delete_last_post or delete
* @var mixed next_post_id Next post ID in the topic (post ID or false)
*
* @since 3.1.11-RC1
*/
$vars = array(
'forum_id',
'topic_id',
'post_id',
'data',
'is_soft',
'softdelete_reason',
'post_mode',
'next_post_id',
);
extract($phpbb_dispatcher->trigger_event('core.delete_post_after', compact($vars)));


return $next_post_id;
}


return $next_post_id;
}

Line 1676Line 1788
				'topic_first_poster_name'	=> (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''),
'topic_first_poster_colour' => $user->data['user_colour'],
'topic_type' => $topic_type,

				'topic_first_poster_name'	=> (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''),
'topic_first_poster_colour' => $user->data['user_colour'],
'topic_type' => $topic_type,

				'topic_time_limit'			=> ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data_ary['topic_time_limit'] * 86400) : 0,

				'topic_time_limit'			=> $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0,

				'topic_attachment'			=> (!empty($data_ary['attachment_data'])) ? 1 : 0,
'topic_status' => (isset($data_ary['topic_status'])) ? $data_ary['topic_status'] : ITEM_UNLOCKED,
);

				'topic_attachment'			=> (!empty($data_ary['attachment_data'])) ? 1 : 0,
'topic_status' => (isset($data_ary['topic_status'])) ? $data_ary['topic_status'] : ITEM_UNLOCKED,
);

Line 1771Line 1883
				'topic_title'				=> $subject,
'topic_first_poster_name' => $username,
'topic_type' => $topic_type,

				'topic_title'				=> $subject,
'topic_first_poster_name' => $username,
'topic_type' => $topic_type,

				'topic_time_limit'			=> ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data_ary['topic_time_limit'] * 86400) : 0,

				'topic_time_limit'			=> $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0,

				'poll_title'				=> (isset($poll_ary['poll_options'])) ? $poll_ary['poll_title'] : '',
'poll_start' => (isset($poll_ary['poll_options'])) ? $poll_start : 0,
'poll_max_options' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_max_options'] : 1,

				'poll_title'				=> (isset($poll_ary['poll_options'])) ? $poll_ary['poll_title'] : '',
'poll_start' => (isset($poll_ary['poll_options'])) ? $poll_start : 0,
'poll_max_options' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_max_options'] : 1,

Line 1926Line 2038

$sql_insert_ary = array();



$sql_insert_ary = array();


		for ($i = 0, $size = sizeof($poll_ary['poll_options']); $i < $size; $i++)

		for ($i = 0, $size = count($poll_ary['poll_options']); $i < $size; $i++)

		{
if (strlen(trim($poll_ary['poll_options'][$i])))
{

		{
if (strlen(trim($poll_ary['poll_options'][$i])))
{

Line 1934Line 2046
				{
// If we add options we need to put them to the end to be able to preserve votes...
$sql_insert_ary[] = array(

				{
// If we add options we need to put them to the end to be able to preserve votes...
$sql_insert_ary[] = array(

						'poll_option_id'	=> (int) sizeof($cur_poll_options) + 1 + sizeof($sql_insert_ary),

						'poll_option_id'	=> (int) count($cur_poll_options) + 1 + count($sql_insert_ary),

						'topic_id'			=> (int) $data_ary['topic_id'],
'poll_option_text' => (string) $poll_ary['poll_options'][$i]
);

						'topic_id'			=> (int) $data_ary['topic_id'],
'poll_option_text' => (string) $poll_ary['poll_options'][$i]
);

Line 1952Line 2064

$db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary);



$db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary);


		if (sizeof($poll_ary['poll_options']) < sizeof($cur_poll_options))

		if (count($poll_ary['poll_options']) < count($cur_poll_options))

		{
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . '

		{
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . '

				WHERE poll_option_id > ' . sizeof($poll_ary['poll_options']) . '

				WHERE poll_option_id > ' . count($poll_ary['poll_options']) . '

					AND topic_id = ' . $data_ary['topic_id'];
$db->sql_query($sql);
}

// If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option

					AND topic_id = ' . $data_ary['topic_id'];
$db->sql_query($sql);
}

// If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option

		if ($mode == 'edit' && sizeof($poll_ary['poll_options']) != sizeof($cur_poll_options))

		if ($mode == 'edit' && count($poll_ary['poll_options']) != count($cur_poll_options))

		{
$db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data_ary['topic_id']);
$db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data_ary['topic_id']);

		{
$db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data_ary['topic_id']);
$db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data_ary['topic_id']);

Line 1979Line 2091
			$orphan_rows[(int) $attach_row['attach_id']] = array();
}


			$orphan_rows[(int) $attach_row['attach_id']] = array();
}


		if (sizeof($orphan_rows))

		if (count($orphan_rows))

		{
$sql = 'SELECT attach_id, filesize, physical_filename
FROM ' . ATTACHMENTS_TABLE . '

		{
$sql = 'SELECT attach_id, filesize, physical_filename
FROM ' . ATTACHMENTS_TABLE . '

Line 2001Line 2113
			if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']]))
{
continue;

			if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']]))
{
continue;

 
			}

if (preg_match('/[\x{10000}-\x{10FFFF}]/u', $attach_row['attach_comment']))
{
trigger_error('ATTACH_COMMENT_NO_EMOJIS');

			}

if (!$attach_row['is_orphan'])

			}

if (!$attach_row['is_orphan'])

Line 2238Line 2355
		'post_time'			=> $current_time,
'post_subject' => $subject,
));

		'post_time'			=> $current_time,
'post_subject' => $subject,
));

 

/**
* This event allows you to modify the notification data upon submission
*
* @event core.modify_submit_notification_data
* @var array notification_data The notification data to be inserted in to the database
* @var array data_ary The data array with a lot of the post submission data
* @var string mode The posting mode
* @var int poster_id The poster id
* @since 3.2.4-RC1
*/
$vars = array('notification_data', 'data_ary', 'mode', 'poster_id');
extract($phpbb_dispatcher->trigger_event('core.modify_submit_notification_data', compact($vars)));


/* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');


/* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');

Line 2266Line 2396
			case 'edit_first_post':
case 'edit':
case 'edit_last_post':

			case 'edit_first_post':
case 'edit':
case 'edit_last_post':

 
				if ($user->data['user_id'] == $poster_id)
{

				$phpbb_notifications->update_notifications(array(
'notification.type.quote',

				$phpbb_notifications->update_notifications(array(
'notification.type.quote',

 
					), $notification_data);
}

$phpbb_notifications->update_notifications(array(

					'notification.type.bookmark',
'notification.type.topic',
'notification.type.post',

					'notification.type.bookmark',
'notification.type.topic',
'notification.type.post',

Line 2386Line 2522
	* @var	string	url					The "Return to topic" URL
*
* @since 3.1.0-a3

	* @var	string	url					The "Return to topic" URL
*
* @since 3.1.0-a3

	* @change 3.1.0-RC3 Added vars mode, subject, username, topic_type,

	* @changed 3.1.0-RC3 Added vars mode, subject, username, topic_type,

	*		poll, update_message, update_search_index
*/
$vars = array(

	*		poll, update_message, update_search_index
*/
$vars = array(

Line 2543Line 2679

/**
* Do the various checks required for removing posts as well as removing it


/**
* Do the various checks required for removing posts as well as removing it

 
*
* @param int $forum_id The id of the forum
* @param int $topic_id The id of the topic
* @param int $post_id The id of the post
* @param array $post_data Array with the post data
* @param bool $is_soft The flag indicating whether it is the soft delete mode
* @param string $delete_reason Description for the post deletion reason
*
* @return null

*/
function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '')
{
global $user, $auth, $config, $request;

*/
function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '')
{
global $user, $auth, $config, $request;

	global $phpbb_root_path, $phpEx, $phpbb_log;

	global $phpbb_root_path, $phpEx, $phpbb_log, $phpbb_dispatcher;





 
	$force_delete_allowed = $force_softdelete_allowed = false;

	$perm_check = ($is_soft) ? 'softdelete' : 'delete';

	$perm_check = ($is_soft) ? 'softdelete' : 'delete';

 

/**
* This event allows to modify the conditions for the post deletion
*
* @event core.handle_post_delete_conditions
* @var int forum_id The id of the forum
* @var int topic_id The id of the topic
* @var int post_id The id of the post
* @var array post_data Array with the post data
* @var bool is_soft The flag indicating whether it is the soft delete mode
* @var string delete_reason Description for the post deletion reason
* @var bool force_delete_allowed Allow the user to delete the post (all permissions and conditions are ignored)
* @var bool force_softdelete_allowed Allow the user to softdelete the post (all permissions and conditions are ignored)
* @var string perm_check The deletion mode softdelete|delete
* @since 3.1.11-RC1
*/
$vars = array(
'forum_id',
'topic_id',
'post_id',
'post_data',
'is_soft',
'delete_reason',
'force_delete_allowed',
'force_softdelete_allowed',
'perm_check',
);
extract($phpbb_dispatcher->trigger_event('core.handle_post_delete_conditions', compact($vars)));


// If moderator removing post or user itself removing post, present a confirmation screen


// If moderator removing post or user itself removing post, present a confirmation screen

	if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])))

	if ($force_delete_allowed || ($is_soft && $force_softdelete_allowed) || $auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])))

	{
$s_hidden_fields = array(
'p' => $post_id,

	{
$s_hidden_fields = array(
'p' => $post_id,

Line 2622Line 2796
		}
else
{

		}
else
{

			global $user, $template, $request;

			global $template;





			$can_delete = $auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id));
$can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id));

			$can_delete = $force_delete_allowed || ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id)));
$can_softdelete = $force_softdelete_allowed || ($auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id)));


$template->assign_vars(array(
'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED,


$template->assign_vars(array(
'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED,