diff options
Diffstat (limited to 'phpBB/viewforum.php')
-rw-r--r-- | phpBB/viewforum.php | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 9ecbdea77a..6379da6802 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -251,7 +251,7 @@ $s_watching_forum = array( 'is_watching' => false, ); -if (($config['email_enable'] || $config['jab_enable']) && $config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS)) +if ($config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS)) { $notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL; watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status, $start, $forum_data['forum_name']); @@ -392,10 +392,15 @@ $sql_array = array( * Event to modify the SQL query before the topic data is retrieved * * @event core.viewforum_get_topic_data -* @var array sql_array The SQL array to get the data of all topics +* @var array forum_data Array with forum data +* @var array sql_array The SQL array to get the data of all topics * @since 3.1.0-a1 +* @change 3.1.0-RC4 Added forum_data var */ -$vars = array('sql_array'); +$vars = array( + 'forum_data', + 'sql_array', +); extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_data', compact($vars))); $sql_approved = ' AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'); @@ -533,13 +538,46 @@ else } // Grab just the sorted topic ids -$sql = 'SELECT t.topic_id - FROM ' . TOPICS_TABLE . " t - WHERE $sql_where +$sql_ary = array( + 'SELECT' => 't.topic_id', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => "$sql_where AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ") $sql_approved - $sql_limit_time - ORDER BY t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order; + $sql_limit_time", + 'ORDER_BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order, +); + +/** +* Event to modify the SQL query before the topic ids data is retrieved +* +* @event core.viewforum_get_topic_ids_data +* @var array sql_ary SQL query array to get the topic ids data +* @var string sql_approved Topic visibility SQL string +* @var int sql_limit Number of records to select +* @var string sql_limit_time SQL string to limit topic_last_post_time data +* @var array sql_sort_order SQL sorting string +* @var int sql_start Offset point to start selection from +* @var string sql_where SQL WHERE clause string +* @var bool store_reverse Flag indicating if we select from the late pages +* +* @since 3.1.0-RC4 +*/ +$vars = array( + 'sql_ary', + 'sql_approved', + 'sql_limit', + 'sql_limit_time', + 'sql_sort_order', + 'sql_start', + 'sql_where', + 'store_reverse', +); +extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_ids_data', compact($vars))); + +$sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); while ($row = $db->sql_fetchrow($result)) |