phpBB

Code Changes

File: includes/functions_display.php

  Unmodified   Added   Modified   Removed
Line 150Line 150
	$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);


	$forum_tracking_info = array();

	$forum_tracking_info = $valid_categories = array();

	$branch_root_id = $root_data['forum_id'];

$phpbb_content_visibility = $phpbb_container->get('content.visibility');

	$branch_root_id = $root_data['forum_id'];

$phpbb_content_visibility = $phpbb_container->get('content.visibility');

Line 248Line 248
			{
$active_forum_ary['exclude_forum_id'][] = $forum_id;
}

			{
$active_forum_ary['exclude_forum_id'][] = $forum_id;
}

 
		}

// Fill list of categories with forums
if (isset($forum_rows[$row['parent_id']]))
{
$valid_categories[$row['parent_id']] = true;

		}

//

		}

//

Line 267Line 273
				$branch_root_id = $forum_id;
}
$forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id'];

				$branch_root_id = $forum_id;
}
$forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id'];

 
			$forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password'];

			$forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time'];
}
else if ($row['forum_type'] != FORUM_CAT)

			$forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time'];
}
else if ($row['forum_type'] != FORUM_CAT)

Line 308Line 315
				$forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name'];
$forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour'];
$forum_rows[$parent_id]['forum_id_last_post'] = $forum_id;

				$forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name'];
$forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour'];
$forum_rows[$parent_id]['forum_id_last_post'] = $forum_id;

 
				$forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password'];

			}
}


			}
}


Line 374Line 382
		}
get_moderators($forum_moderators, $forum_ids_moderator);
}

		}
get_moderators($forum_moderators, $forum_ids_moderator);
}

 

/**
* Event to perform additional actions before the forum list is being generated
*
* @event core.display_forums_before
* @var array active_forum_ary Array with forum data to display active topics
* @var bool display_moderators Flag indicating if we display forum moderators
* @var array forum_moderators Array with forum moderators list
* @var array forum_rows Data array of all forums we display
* @var bool return_moderators Flag indicating if moderators list should be returned
* @var array root_data Array with the root forum data
* @since 3.1.4-RC1
*/
$vars = array(
'active_forum_ary',
'display_moderators',
'forum_moderators',
'forum_rows',
'return_moderators',
'root_data',
);
extract($phpbb_dispatcher->trigger_event('core.display_forums_before', compact($vars)));


// Used to tell whatever we have to create a dummy category or not.
$last_catless = true;


// Used to tell whatever we have to create a dummy category or not.
$last_catless = true;

Line 382Line 412
		// Category
if ($row['parent_id'] == $root_data['forum_id'] && $row['forum_type'] == FORUM_CAT)
{

		// Category
if ($row['parent_id'] == $root_data['forum_id'] && $row['forum_type'] == FORUM_CAT)
{

 
			// Do not display categories without any forums to display
if (!isset($valid_categories[$row['forum_id']]))
{
continue;
}


			$cat_row = array(
'S_IS_CAT' => true,
'FORUM_ID' => $row['forum_id'],

			$cat_row = array(
'S_IS_CAT' => true,
'FORUM_ID' => $row['forum_id'],

Line 500Line 536
		// Create last post link information, if appropriate
if ($row['forum_last_post_id'])
{

		// Create last post link information, if appropriate
if ($row['forum_last_post_id'])
{

			$last_post_subject = $row['forum_last_post_subject'];
$last_post_subject_truncated = truncate_string(censor_text($last_post_subject), 30, 255, false, $user->lang['ELLIPSIS']);








			if ($row['forum_password_last_post'] === '' && $auth->acl_get('f_read', $row['forum_id_last_post']))
{
$last_post_subject = censor_text($row['forum_last_post_subject']);
$last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']);
}
else
{
$last_post_subject = $last_post_subject_truncated = '';
}

			$last_post_time = $user->format_date($row['forum_last_post_time']);
$last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
}

			$last_post_time = $user->format_date($row['forum_last_post_time']);
$last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
}

Line 561Line 604
			'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_DISPLAY_SUBJECT'	=>	($last_post_subject && $config['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false,

			'S_DISPLAY_SUBJECT'	=>	($last_post_subject !== '' && $config['display_last_subject']) ? 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'],

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

Line 574Line 617
			'FORUM_FOLDER_IMG_ALT'	=> isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '',
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',

			'FORUM_FOLDER_IMG_ALT'	=> isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '',
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',

			'LAST_POST_SUBJECT'		=> (!$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? censor_text($last_post_subject) : "",
'LAST_POST_SUBJECT_TRUNCATED' => (!$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? $last_post_subject_truncated : "",

			'LAST_POST_SUBJECT'		=> $last_post_subject,
'LAST_POST_SUBJECT_TRUNCATED' => $last_post_subject_truncated,

			'LAST_POST_TIME'		=> $last_post_time,
'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),

			'LAST_POST_TIME'		=> $last_post_time,
'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),

Line 603Line 646
		* @var	array	row				The data of the forum
* @var array subforums_row Template data of subforums
* @since 3.1.0-a1

		* @var	array	row				The data of the forum
* @var array subforums_row Template data of subforums
* @since 3.1.0-a1

		* @change 3.1.0-b5 Added var subforums_row

		* @changed 3.1.0-b5 Added var subforums_row

		*/
$vars = array('forum_row', 'row', 'subforums_row');
extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars)));

		*/
$vars = array('forum_row', 'row', 'subforums_row');
extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars)));

Line 710Line 753
function generate_forum_nav(&$forum_data)
{
global $db, $user, $template, $auth, $config;

function generate_forum_nav(&$forum_data)
{
global $db, $user, $template, $auth, $config;

	global $phpEx, $phpbb_root_path;

	global $phpEx, $phpbb_root_path, $phpbb_dispatcher;


if (!$auth->acl_get('f_list', $forum_data['forum_id']))
{
return;
}


if (!$auth->acl_get('f_list', $forum_data['forum_id']))
{
return;
}

 

$navlinks = $navlinks_parents = $forum_template_data = array();


// Get forum parents
$forum_parents = get_forum_parents($forum_data);


// Get forum parents
$forum_parents = get_forum_parents($forum_data);

Line 735Line 780
				continue;
}


				continue;
}


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

			$navlinks_parents[] = array(

				'S_IS_CAT'		=> ($parent_type == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false,
'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name,
'FORUM_ID' => $parent_forum_id,
'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"',

				'S_IS_CAT'		=> ($parent_type == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false,
'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name,
'FORUM_ID' => $parent_forum_id,
'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"',

				'U_VIEW_FORUM'	=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id))

				'U_VIEW_FORUM'	=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id),

			);
}
}


			);
}
}


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

	$navlinks = array(

		'S_IS_CAT'		=> ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_ID' => $forum_data['forum_id'],
'MICRODATA' => $microdata_attr . '="' . $forum_data['forum_id'] . '"',

		'S_IS_CAT'		=> ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_ID' => $forum_data['forum_id'],
'MICRODATA' => $microdata_attr . '="' . $forum_data['forum_id'] . '"',

		'U_VIEW_FORUM'	=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']))

		'U_VIEW_FORUM'	=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']),

	);


	);


	$template->assign_vars(array(

	$forum_template_data = array(

		'FORUM_ID' 		=> $forum_data['forum_id'],
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']),

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

		'FORUM_ID' 		=> $forum_data['forum_id'],
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']),

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

	));

























	);

/**
* Event to modify the navlinks text
*
* @event core.generate_forum_nav
* @var array forum_data Array with the forum data
* @var array forum_template_data Array with generic forum template data
* @var string microdata_attr The microdata attribute
* @var array navlinks_parents Array with the forum parents navlinks data
* @var array navlinks Array with the forum navlinks data
* @since 3.1.5-RC1
*/
$vars = array(
'forum_data',
'forum_template_data',
'microdata_attr',
'navlinks_parents',
'navlinks',
);
extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars)));

$template->assign_block_vars_array('navlinks', $navlinks_parents);
$template->assign_block_vars('navlinks', $navlinks);
$template->assign_vars($forum_template_data);


return;
}


return;
}

Line 1427Line 1496
* @param array $user_data the current stored users data
* @param int $user_posts the users number of posts
*

* @param array $user_data the current stored users data
* @param int $user_posts the users number of posts
*

* @return array An associative array containing the rank title (title), the rank image source (img) and the rank image as full img tag (img)

* @return array An associative array containing the rank title (title), the rank image as full img tag (img) and the rank image source (img_src)

*
* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false
*/

*
* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false
*/

Line 1484Line 1553
			}
}
}

			}
}
}

 

/**
* Modify a user's rank before displaying
*
* @event core.get_user_rank_after
* @var array user_data Array with user's data
* @var int user_posts User_posts to change
* @var array user_rank_data User rank data
* @since 3.1.11-RC1
*/

$vars = array(
'user_data',
'user_posts',
'user_rank_data',
);
extract($phpbb_dispatcher->trigger_event('core.get_user_rank_after', compact($vars)));


return $user_rank_data;
}


return $user_rank_data;
}

Line 1608Line 1694
		'U_EMAIL'		=> $email,
'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=jabber&amp;u=' . $user_id) : '',


		'U_EMAIL'		=> $email,
'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=jabber&amp;u=' . $user_id) : '',


		'USER_JABBER'		=> $data['user_jabber'],
'USER_JABBER_IMG' => ($data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '',

		'USER_JABBER'		=> ($config['jab_enable']) ? $data['user_jabber'] : '',
'USER_JABBER_IMG' => ($config['jab_enable'] && $data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '',


'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $username),
'L_CONTACT_USER' => $user->lang('CONTACT_USER', $username),


'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $username),
'L_CONTACT_USER' => $user->lang('CONTACT_USER', $username),