phpBB

Code Changes

File: includes/acp/acp_forums.php

  Unmodified   Added   Modified   Removed
Line 90Line 90

$errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id);



$errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id);


					if (sizeof($errors))

					if (count($errors))

					{
break;
}

					{
break;
}

Line 198Line 198

$errors = $this->update_forum_data($forum_data);



$errors = $this->update_forum_data($forum_data);


					if (!sizeof($errors))

					if (!count($errors))

					{
$forum_perm_from = $request->variable('forum_perm_from', 0);
$cache->destroy('sql', FORUMS_TABLE);

					{
$forum_perm_from = $request->variable('forum_perm_from', 0);
$cache->destroy('sql', FORUMS_TABLE);

Line 622Line 622

$template_data = array(
'S_EDIT_FORUM' => true,


$template_data = array(
'S_EDIT_FORUM' => true,

					'S_ERROR'			=> (sizeof($errors)) ? true : false,

					'S_ERROR'			=> (count($errors)) ? true : false,

					'S_PARENT_ID'		=> $this->parent_id,
'S_FORUM_PARENT_ID' => $forum_data['parent_id'],
'S_ADD_ACTION' => ($action == 'add') ? true : false,

					'S_PARENT_ID'		=> $this->parent_id,
'S_FORUM_PARENT_ID' => $forum_data['parent_id'],
'S_ADD_ACTION' => ($action == 'add') ? true : false,

Line 632Line 632

'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'],
'L_TITLE' => $user->lang[$this->page_title],


'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'],
'L_TITLE' => $user->lang[$this->page_title],

					'ERROR_MSG'						=> (sizeof($errors)) ? implode('<br />', $errors) : '',

					'ERROR_MSG'						=> (count($errors)) ? implode('<br />', $errors) : '',


'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DATA_LINK' => $forum_data['forum_link'],


'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DATA_LINK' => $forum_data['forum_link'],

Line 772Line 772
					'S_FORUM_LINK'			=> ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false,
'S_FORUMS_LIST' => $forums_list,

					'S_FORUM_LINK'			=> ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false,
'S_FORUMS_LIST' => $forums_list,

					'S_ERROR'				=> (sizeof($errors)) ? true : false,
'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '')

					'S_ERROR'				=> (count($errors)) ? true : false,
'ERROR_MSG' => (count($errors)) ? implode('<br />', $errors) : '')

				);

return;

				);

return;

Line 924Line 924
		unset($rowset);

$template->assign_vars(array(

		unset($rowset);

$template->assign_vars(array(

			'ERROR_MSG'		=> (sizeof($errors)) ? implode('<br />', $errors) : '',

			'ERROR_MSG'		=> (count($errors)) ? implode('<br />', $errors) : '',

			'NAVIGATION'	=> $navigation,
'FORUM_BOX' => $forum_box,
'U_SEL_ACTION' => $this->u_action,

			'NAVIGATION'	=> $navigation,
'FORUM_BOX' => $forum_box,
'U_SEL_ACTION' => $this->u_action,

Line 984Line 984
		if ($forum_data_ary['forum_name'] == '')
{
$errors[] = $user->lang['FORUM_NAME_EMPTY'];

		if ($forum_data_ary['forum_name'] == '')
{
$errors[] = $user->lang['FORUM_NAME_EMPTY'];

 
		}

/**
* Replace Emojis and other 4bit UTF-8 chars not allowed by MySql to UCR / NCR.
* Using their Numeric Character Reference's Hexadecimal notation.
*/
$forum_data_ary['forum_name'] = utf8_encode_ucr($forum_data_ary['forum_name']);

/**
* This should never happen again.
* Leaving the fallback here just in case there will be the need of it.
*/
if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $forum_data_ary['forum_name'], $matches))
{
$character_list = implode('<br>', $matches[0]);

$errors[] = $user->lang('FORUM_NAME_EMOJI', $character_list);

		}

if (utf8_strlen($forum_data_ary['forum_desc']) > 4000)

		}

if (utf8_strlen($forum_data_ary['forum_desc']) > 4000)

Line 1012Line 1029
		}

$range_test_ary = array(

		}

$range_test_ary = array(

			array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'TINT:0'),

			array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'USINT:0'),

		);

if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image']))

		);

if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image']))

Line 1053Line 1070
		// What are we going to do tonight Brain? The same thing we do everynight,
// try to take over the world ... or decide whether to continue update
// and if so, whether it's a new forum/cat/link or an existing one

		// What are we going to do tonight Brain? The same thing we do everynight,
// try to take over the world ... or decide whether to continue update
// and if so, whether it's a new forum/cat/link or an existing one

		if (sizeof($errors))

		if (count($errors))

		{
return $errors;
}

		{
return $errors;
}

Line 1217Line 1234
							$errors = array_merge($errors, $this->delete_forum_content($_row['forum_id']));
}


							$errors = array_merge($errors, $this->delete_forum_content($_row['forum_id']));
}


						if (sizeof($errors))

						if (count($errors))

						{
return $errors;
}


						{
return $errors;
}


						if (sizeof($forum_ids))

						if (count($forum_ids))

						{
$sql = 'DELETE FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ids);

						{
$sql = 'DELETE FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ids);

Line 1252Line 1269
								$allowed_forums = array_diff($allowed_forums, $forum_ids);

$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "

								$allowed_forums = array_diff($allowed_forums, $forum_ids);

$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "

									SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "'

									SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "'

									WHERE group_id = {$_row['group_id']}";
$db->sql_query($sql);
}

									WHERE group_id = {$_row['group_id']}";
$db->sql_query($sql);
}

Line 1321Line 1338
				$forum_data_sql['forum_last_poster_colour'] = '';
}


				$forum_data_sql['forum_last_poster_colour'] = '';
}


			if (sizeof($errors))

			if (count($errors))

			{
return $errors;
}

			{
return $errors;
}

Line 1338Line 1355
				}
}


				}
}


			if (sizeof($errors))

			if (count($errors))

			{
return $errors;
}

			{
return $errors;
}

Line 1416Line 1433
		* This event may be triggered, when a forum is deleted
*
* @event core.acp_manage_forums_move_children

		* This event may be triggered, when a forum is deleted
*
* @event core.acp_manage_forums_move_children

		* @var	int		from_id		If of the current parent forum
* @var int to_id If of the new parent forum

		* @var	int		from_id		Id of the current parent forum
* @var int to_id Id of the new parent forum

		* @var	array	errors		Array of errors, should be strings and not
* language key.
* @since 3.1.0-a1

		* @var	array	errors		Array of errors, should be strings and not
* language key.
* @since 3.1.0-a1

Line 1430Line 1447
		{
return $errors;
}

		{
return $errors;
}

 

$db->sql_transaction('begin');


$moved_forums = get_forum_branch($from_id, 'children', 'descending');
$from_data = $moved_forums[0];


$moved_forums = get_forum_branch($from_id, 'children', 'descending');
$from_data = $moved_forums[0];

		$diff = sizeof($moved_forums) * 2;

		$diff = count($moved_forums) * 2;


$moved_ids = array();


$moved_ids = array();

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

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

		{
$moved_ids[] = $moved_forums[$i]['forum_id'];
}

		{
$moved_ids[] = $moved_forums[$i]['forum_id'];
}

Line 1501Line 1520
			SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = ''
WHERE " . $db->sql_in_set('forum_id', $moved_ids);
$db->sql_query($sql);

			SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = ''
WHERE " . $db->sql_in_set('forum_id', $moved_ids);
$db->sql_query($sql);

 

$db->sql_transaction('commit');


return $errors;
}


return $errors;
}

Line 1518Line 1539
		* Event when we move content from one forum to another
*
* @event core.acp_manage_forums_move_content

		* Event when we move content from one forum to another
*
* @event core.acp_manage_forums_move_content

		* @var	int		from_id		If of the current parent forum
* @var int to_id If of the new parent forum

		* @var	int		from_id		Id of the current parent forum
* @var int to_id Id of the new parent forum

		* @var	bool	sync		Shall we sync the "to"-forum's data
* @var array errors Array of errors, should be strings and not
* language key. If this array is not empty,

		* @var	bool	sync		Shall we sync the "to"-forum's data
* @var array errors Array of errors, should be strings and not
* language key. If this array is not empty,

Line 1536Line 1557
		}

$table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);

		}

$table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);

 

/**
* Perform additional actions before move forum content
*
* @event core.acp_manage_forums_move_content_sql_before
* @var array table_ary Array of tables from which forum_id will be updated
* @since 3.2.4-RC1
*/
$vars = array('table_ary');
extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content_sql_before', compact($vars)));


foreach ($table_ary as $table)
{


foreach ($table_ary as $table)
{

Line 1554Line 1585
				WHERE forum_id = $from_id";
$db->sql_query($sql);
}

				WHERE forum_id = $from_id";
$db->sql_query($sql);
}

 

/**
* Event when content has been moved from one forum to another
*
* @event core.acp_manage_forums_move_content_after
* @var int from_id Id of the current parent forum
* @var int to_id Id of the new parent forum
* @var bool sync Shall we sync the "to"-forum's data
*
* @since 3.2.9-RC1
*/
$vars = array('from_id', 'to_id', 'sync');
extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content_after', compact($vars)));


if ($sync)
{


if ($sync)
{

Line 1612Line 1656
			}
}


			}
}


		if (sizeof($errors))

		if (count($errors))

		{
return $errors;
}

		{
return $errors;
}

Line 1628Line 1672
				$errors = array_merge($errors, $this->delete_forum_content($row['forum_id']));
}


				$errors = array_merge($errors, $this->delete_forum_content($row['forum_id']));
}


			if (sizeof($errors))

			if (count($errors))

			{
return $errors;
}


			{
return $errors;
}


			$diff = sizeof($forum_ids) * 2;

			$diff = count($forum_ids) * 2;


$sql = 'DELETE FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ids);


$sql = 'DELETE FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ids);

Line 1706Line 1750
				}
}


				}
}


			if (sizeof($errors))

			if (count($errors))

			{
return $errors;
}

			{
return $errors;
}

Line 1754Line 1798
			$allowed_forums = array_diff($allowed_forums, $forum_ids);

$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "

			$allowed_forums = array_diff($allowed_forums, $forum_ids);

$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "

				SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "'

				SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "'

				WHERE group_id = {$row['group_id']}";
$db->sql_query($sql);
}

				WHERE group_id = {$row['group_id']}";
$db->sql_query($sql);
}

Line 1927Line 1971
						}
$db->sql_freeresult($result);


						}
$db->sql_freeresult($result);


						if (sizeof($ids))

						if (count($ids))

						{

						{

							$start += sizeof($ids);

							$start += count($ids);


foreach ($tables as $table)
{


foreach ($tables as $table)
{

Line 1937Line 1981
							}
}
}

							}
}
}

					while (sizeof($ids) == $batch_size);

					while (count($ids) == $batch_size);

				}
unset($ids);


				}
unset($ids);


Line 1978Line 2022
		}

// Adjust users post counts

		}

// Adjust users post counts

		if (sizeof($post_counts))

		if (count($post_counts))

		{
foreach ($post_counts as $poster_id => $substract)
{

		{
foreach ($post_counts as $poster_id => $substract)
{

Line 2062Line 2106
		}
$db->sql_freeresult($result);


		}
$db->sql_freeresult($result);


		if (!sizeof($target))

		if (!count($target))

		{
// The forum is already on top or bottom
return false;

		{
// The forum is already on top or bottom
return false;