phpBB

Code Changes

File: viewforum.php

  Unmodified   Added   Modified   Removed
Line 146Line 146
	}
}


	}
}


 
// Is a forum specific topic count required?
if ($forum_data['forum_topics_per_page'])
{
$config['topics_per_page'] = $forum_data['forum_topics_per_page'];
}

/* @var $phpbb_content_visibility \phpbb\content_visibility */

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

// Dump out the page header and load viewforum template

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

// Dump out the page header and load viewforum template

Line 207Line 214
	}

trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'));

	}

trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'));

}

// Is a forum specific topic count required?
if ($forum_data['forum_topics_per_page'])
{
$config['topics_per_page'] = $forum_data['forum_topics_per_page'];

 
}

// Do the forum Prune thang - cron type job ...

}

// Do the forum Prune thang - cron type job ...

Line 264Line 265
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);

$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);

$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);

$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);

$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');

$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 'LOWER(t.topic_title)', 'v' => 't.topic_views');


$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);


$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);

Line 274Line 275
{
$min_post_time = time() - ($sort_days * 86400);


{
$min_post_time = time() - ($sort_days * 86400);


	$sql = 'SELECT COUNT(topic_id) AS num_topics
FROM ' . TOPICS_TABLE . "
WHERE forum_id = $forum_id
AND (topic_last_post_time >= $min_post_time
OR topic_type = " . POST_ANNOUNCE . '
OR topic_type = ' . POST_GLOBAL . ')
AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id);
$result = $db->sql_query($sql);





























	$sql_array = array(
'SELECT' => 'COUNT(t.topic_id) AS num_topics',
'FROM' => array(
TOPICS_TABLE => 't',
),
'WHERE' => 't.forum_id = ' . $forum_id . '
AND (t.topic_last_post_time >= ' . $min_post_time . '
OR t.topic_type = ' . POST_ANNOUNCE . '
OR t.topic_type = ' . POST_GLOBAL . ')
AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'),
);

/**
* Modify the sort data SQL query for getting additional fields if needed
*
* @event core.viewforum_modify_sort_data_sql
* @var int forum_id The forum_id whose topics are being listed
* @var int start Variable containing start for pagination
* @var int sort_days The oldest topic displayable in elapsed days
* @var string sort_key The sorting by. It is one of the first character of (in low case):
* Author, Post time, Replies, Subject, Views
* @var string sort_dir Either "a" for ascending or "d" for descending
* @var array sql_array The SQL array to get the data of all topics
* @since 3.1.9-RC1
*/
$vars = array(
'forum_id',
'start',
'sort_days',
'sort_key',
'sort_dir',
'sql_array',
);
extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_sort_data_sql', compact($vars)));

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

	$topics_count = (int) $db->sql_fetchfield('num_topics');
$db->sql_freeresult($result);


	$topics_count = (int) $db->sql_fetchfield('num_topics');
$db->sql_freeresult($result);


Line 396Line 425
* @event core.viewforum_get_topic_data
* @var array forum_data Array with forum data
* @var array sql_array The SQL array to get the data of all topics

* @event core.viewforum_get_topic_data
* @var array forum_data Array with forum data
* @var array sql_array The SQL array to get the data of all topics

* @var	array	forum_id			The forum_id whose topics are being listed
* @var array topics_count The total number of topics for display
* @var array sort_days The oldest topic displayable in elapsed days
* @var array sort_key The sorting by. It is one of the first character of (in low case):

* @var	int		forum_id			The forum_id whose topics are being listed
* @var int topics_count The total number of topics for display
* @var int sort_days The oldest topic displayable in elapsed days
* @var string sort_key The sorting by. It is one of the first character of (in low case):

*									Author, Post time, Replies, Subject, Views

*									Author, Post time, Replies, Subject, Views

* @var	array	sort_dir			Either "a" for ascending or "d" for descending

* @var	string	sort_dir			Either "a" for ascending or "d" for descending

* @since 3.1.0-a1

* @since 3.1.0-a1

* @change 3.1.0-RC4 Added forum_data var
* @change 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars


* @changed 3.1.0-RC4 Added forum_data var
* @changed 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars
* @changed 3.1.9-RC1 Fix types of properties

*/
$vars = array(
'forum_data',

*/
$vars = array(
'forum_data',

Line 463Line 493

'ORDER_BY' => 't.topic_time DESC',
);


'ORDER_BY' => 't.topic_time DESC',
);

 

/**
* Event to modify the SQL query before the announcement topic ids data is retrieved
*
* @event core.viewforum_get_announcement_topic_ids_data
* @var array forum_data Data about the forum
* @var array g_forum_ary Global announcement forums array
* @var array sql_anounce_array SQL announcement array
* @var array sql_ary SQL query array to get the announcement topic ids data
* @var int forum_id The forum ID
*
* @since 3.1.10-RC1
*/
$vars = array(
'forum_data',
'g_forum_ary',
'sql_anounce_array',
'sql_ary',
'forum_id',
);
extract($phpbb_dispatcher->trigger_event('core.viewforum_get_announcement_topic_ids_data', 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 731Line 783
* @var	array	topic_list			Array with current viewforum page topic ids
* @var array rowset Array with topics data (in topic_id => topic_data format)
* @var int total_topic_count Forum's total topic count

* @var	array	topic_list			Array with current viewforum page topic ids
* @var array rowset Array with topics data (in topic_id => topic_data format)
* @var int total_topic_count Forum's total topic count

 
* @var	int		forum_id			Forum identifier

* @since 3.1.0-b3

* @since 3.1.0-b3

 
* @changed 3.1.11-RC1 Added forum_id

*/

*/

$vars = array('topic_list', 'rowset', 'total_topic_count');

$vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id');

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

// Okay, lets dump out the page ...

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

// Okay, lets dump out the page ...

Line 888Line 942
		* Modify the topic data before it is assigned to the template
*
* @event core.viewforum_modify_topicrow

		* Modify the topic data before it is assigned to the template
*
* @event core.viewforum_modify_topicrow

		* @var	array	row			Array with topic data
* @var array topic_row Template array with topic data



		* @var	array	row					Array with topic data
* @var array topic_row Template array with topic data
* @var bool s_type_switch Flag indicating if the topic type is [global] announcement
* @var bool s_type_switch_test Flag indicating if the test topic type is [global] announcement

		* @since 3.1.0-a1

		* @since 3.1.0-a1

 
		*
* @changed 3.1.10-RC1 Added s_type_switch, s_type_switch_test

		*/

		*/

		$vars = array('row', 'topic_row');

		$vars = array('row', 'topic_row', 's_type_switch', 's_type_switch_test');

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

$template->assign_block_vars('topicrow', $topic_row);

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

$template->assign_block_vars('topicrow', $topic_row);