phpBB

Code Changes

File: includes/functions_display.php

  Unmodified   Added   Modified   Removed
Line 49Line 49
	else
{
$sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'];

	else
{
$sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'];

 
	}

// Handle marking everything read
if ($mark_read == 'all')
{
$redirect = build_url(array('mark', 'hash'));
meta_refresh(3, $redirect);

if (check_link_hash(request_var('hash', ''), 'global'))
{
markread('all');

trigger_error(
$user->lang['FORUMS_MARKED'] . '<br /><br />' .
sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>')
);
}
else
{
trigger_error(sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}

	}

// Display list of active topics for this category?

	}

// Display list of active topics for this category?

Line 120Line 141
		$forum_id = $row['forum_id'];

// Mark forums read?

		$forum_id = $row['forum_id'];

// Mark forums read?

		if ($mark_read == 'forums' || $mark_read == 'all')

		if ($mark_read == 'forums')

		{
if ($auth->acl_get('f_list', $forum_id))
{
$forum_ids[] = $forum_id;

		{
if ($auth->acl_get('f_list', $forum_id))
{
$forum_ids[] = $forum_id;

				continue;

 
			}

			}

 

continue;

		}

// Category with no members

		}

// Category with no members

Line 151Line 173
			$right_id = $row['right_id'];
continue;
}

			$right_id = $row['right_id'];
continue;
}


$forum_ids[] = $forum_id;

 

if ($config['load_db_lastread'] && $user->data['is_registered'])
{


if ($config['load_db_lastread'] && $user->data['is_registered'])
{

Line 255Line 275
	$db->sql_freeresult($result);

// Handle marking posts

	$db->sql_freeresult($result);

// Handle marking posts

	if ($mark_read == 'forums' || $mark_read == 'all')

	if ($mark_read == 'forums')

	{
$redirect = build_url(array('mark', 'hash'));
$token = request_var('hash', '');
if (check_link_hash($token, 'global'))

	{
$redirect = build_url(array('mark', 'hash'));
$token = request_var('hash', '');
if (check_link_hash($token, 'global'))

		{
if ($mark_read == 'all')
{
markread('all');
$message = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>');
}
else

 
			{
// Add 0 to forums array to mark global announcements correctly
$forum_ids[] = 0;
markread('topics', $forum_ids);
$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');

			{
// Add 0 to forums array to mark global announcements correctly
$forum_ids[] = 0;
markread('topics', $forum_ids);
$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');

			}

 
			meta_refresh(3, $redirect);
trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message);
}

			meta_refresh(3, $redirect);
trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message);
}

Line 453Line 465
			'S_NO_CAT'			=> $catless && !$last_catless,
'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false,
'S_UNREAD_FORUM' => $forum_unread,

			'S_NO_CAT'			=> $catless && !$last_catless,
'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false,
'S_UNREAD_FORUM' => $forum_unread,

 
			'S_AUTH_READ'		=> $auth->acl_get('f_read', $row['forum_id']),

			'S_LOCKED_FORUM'	=> ($row['forum_status'] == ITEM_LOCKED) ? true : false,
'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false,
'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false,

			'S_LOCKED_FORUM'	=> ($row['forum_status'] == ITEM_LOCKED) ? true : false,
'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false,
'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false,

			'S_FEED_ENABLED'	=> ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options'])) ? true : false,

			'S_FEED_ENABLED'	=> ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false,


'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],


'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],

Line 477Line 490
			'SUBFORUMS'				=> $s_subforums_list,

'L_SUBFORUM_STR' => $l_subforums,

			'SUBFORUMS'				=> $s_subforums_list,

'L_SUBFORUM_STR' => $l_subforums,

			'L_FORUM_FOLDER_ALT'	=> $folder_alt,

 
			'L_MODERATOR_STR'		=> $l_moderator,

'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=unapproved_topics&amp;f=' . $row['forum_id_unapproved_topics']) : '',

			'L_MODERATOR_STR'		=> $l_moderator,

'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=unapproved_topics&amp;f=' . $row['forum_id_unapproved_topics']) : '',

Line 663Line 675
			$pagination .= '<a href="' . $url . ($j == 0 ? '' : '&amp;start=' . $j) . '">' . $times . '</a>';
if ($times == 1 && $total_pages > 5)
{

			$pagination .= '<a href="' . $url . ($j == 0 ? '' : '&amp;start=' . $j) . '">' . $times . '</a>';
if ($times == 1 && $total_pages > 5)
{

				$pagination .= ' ... ';

				$pagination .= '<span class="page-dots"> ... </span>';


// Display the last three pages
$times = $total_pages - 3;


// Display the last three pages
$times = $total_pages - 3;

Line 997Line 1009
	}

// Obtain active topic

	}

// Obtain active topic

 
	// We need to exclude passworded forums here so we do not leak the topic title
$forum_ary_topic = array_unique(array_merge($forum_ary, $user->get_passworded_forums()));
$forum_sql_topic = (!empty($forum_ary_topic)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary_topic, true) : '';


	$sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $userdata['user_id'] . "
AND post_postcount = 1
AND (post_approved = 1
$sql_m_approve)

	$sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $userdata['user_id'] . "
AND post_postcount = 1
AND (post_approved = 1
$sql_m_approve)

			$forum_sql

			$forum_sql_topic

		GROUP BY topic_id
ORDER BY num_posts DESC";
$result = $db->sql_query_limit($sql, 1);

		GROUP BY topic_id
ORDER BY num_posts DESC";
$result = $db->sql_query_limit($sql, 1);

Line 1059Line 1075
/**
* Topic and forum watching common code
*/

/**
* Topic and forum watching common code
*/

function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0)

function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '')

{
global $template, $db, $user, $phpEx, $start, $phpbb_root_path;


{
global $template, $db, $user, $phpEx, $start, $phpbb_root_path;


Line 1068Line 1084
	$match_id = ($mode == 'forum') ? $forum_id : $topic_id;
$u_url = "uid={$user->data['user_id']}";
$u_url .= ($mode == 'forum') ? '&amp;f' : '&amp;f=' . $forum_id . '&amp;t';

	$match_id = ($mode == 'forum') ? $forum_id : $topic_id;
$u_url = "uid={$user->data['user_id']}";
$u_url .= ($mode == 'forum') ? '&amp;f' : '&amp;f=' . $forum_id . '&amp;t';

 
	$is_watching = 0;


// Is user watching this thread?
if ($user_id != ANONYMOUS)


// Is user watching this thread?
if ($user_id != ANONYMOUS)

Line 1092Line 1109
			if (isset($_GET['unwatch']))
{
$uid = request_var('uid', 0);

			if (isset($_GET['unwatch']))
{
$uid = request_var('uid', 0);

				if ($uid != $user_id)





				$token = request_var('hash', '');

if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))
{
if ($uid != $user_id || $_GET['unwatch'] != $mode)

				{
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");
$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message);
}

				{
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");
$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message);
}

				if ($_GET['unwatch'] == $mode)
{
$is_watching = 0;

 

$sql = 'DELETE FROM ' . $table_sql . "
WHERE $where_sql = $match_id
AND user_id = $user_id";
$db->sql_query($sql);


$sql = 'DELETE FROM ' . $table_sql . "
WHERE $where_sql = $match_id
AND user_id = $user_id";
$db->sql_query($sql);

				}

 

$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");


$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");




					$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />';
$message .= sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');

				meta_refresh(3, $redirect_url);

				meta_refresh(3, $redirect_url);


$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');

 
				trigger_error($message);

				trigger_error($message);

 
				}
else
{
$s_hidden_fields = array(
'uid' => $user->data['user_id'],
'unwatch' => $mode,
'start' => $start,
'f' => $forum_id,
);
if ($mode != 'forum')
{
$s_hidden_fields['t'] = $topic_id;
}

if ($item_title == '')
{
$confirm_box_message = 'UNWATCH_' . strtoupper($mode);
}
else
{
$confirm_box_message = $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title);
}
confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields));
}

			}
else
{

			}
else
{

Line 1133Line 1173
		{
if (isset($_GET['watch']))
{

		{
if (isset($_GET['watch']))
{

 
				$uid = request_var('uid', 0);

				$token = request_var('hash', '');

				$token = request_var('hash', '');

				$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");

 




				if ($_GET['watch'] == $mode && check_link_hash($token, "{$mode}_$match_id"))

				if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))

				{

				{

 
					if ($uid != $user_id || $_GET['watch'] != $mode)
{
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");
$message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message);
}


					$is_watching = true;

$sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status)
VALUES ($user_id, $match_id, " . NOTIFY_YES . ')';
$db->sql_query($sql);

					$is_watching = true;

$sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status)
VALUES ($user_id, $match_id, " . NOTIFY_YES . ')';
$db->sql_query($sql);

 

$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&amp;start=$start");

					$message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');

					$message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');

 
					meta_refresh(3, $redirect_url);
trigger_error($message);

				}
else
{

				}
else
{

					$message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');









					$s_hidden_fields = array(
'uid' => $user->data['user_id'],
'watch' => $mode,
'start' => $start,
'f' => $forum_id,
);
if ($mode != 'forum')
{
$s_hidden_fields['t'] = $topic_id;

				}


				}


				meta_refresh(3, $redirect_url);

trigger_error($message);

					$confirm_box_message = (($item_title == '') ? 'WATCH_' . strtoupper($mode) : $user->lang('WATCH_' . strtoupper($mode) . '_DETAILED', $item_title));
confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields));
}

			}
else
{

			}
else
{

Line 1162Line 1221
	}
else
{

	}
else
{

		if (isset($_GET['unwatch']) && $_GET['unwatch'] == $mode)

		if ((isset($_GET['unwatch']) && $_GET['unwatch'] == $mode) || (isset($_GET['watch']) && $_GET['watch'] == $mode))

		{
login_box();
}

		{
login_box();
}