mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch '3.1.x' into 3.2.x
This commit is contained in:
commit
ed21921c58
1 changed files with 35 additions and 10 deletions
|
@ -277,16 +277,41 @@ if ($sort_days)
|
||||||
{
|
{
|
||||||
$min_post_time = time() - ($sort_days * 86400);
|
$min_post_time = time() - ($sort_days * 86400);
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(topic_id) AS num_topics
|
$sql_array = array(
|
||||||
FROM ' . TOPICS_TABLE . "
|
'SELECT' => 'COUNT(t.topic_id) AS num_topics',
|
||||||
WHERE forum_id = $forum_id
|
'FROM' => array(
|
||||||
AND (topic_last_post_time >= $min_post_time
|
TOPICS_TABLE => 't',
|
||||||
OR topic_type = " . POST_ANNOUNCE . '
|
),
|
||||||
OR topic_type = ' . POST_GLOBAL . ')
|
'WHERE' => 't.forum_id = ' . $forum_id . '
|
||||||
AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id);
|
AND (t.topic_last_post_time >= ' . $min_post_time . '
|
||||||
$result = $db->sql_query($sql);
|
OR t.topic_type = ' . POST_ANNOUNCE . '
|
||||||
$topics_count = (int) $db->sql_fetchfield('num_topics');
|
OR t.topic_type = ' . POST_GLOBAL . ')
|
||||||
$db->sql_freeresult($result);
|
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));
|
||||||
|
|
||||||
if (isset($_POST['sort']))
|
if (isset($_POST['sort']))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue