Merge branch 'develop-2.1.x' of https://github.com/board3/Board3-Portal into feature/module_services
Conflicts: portal/includes/functions.php
This commit is contained in:
@@ -98,7 +98,7 @@ function obtain_portal_modules()
|
|||||||
// fetch post for news & announce
|
// fetch post for news & announce
|
||||||
function phpbb_fetch_posts($module_id, $forum_from, $permissions, $number_of_posts, $text_length, $time, $type, $start = 0, $invert = false)
|
function phpbb_fetch_posts($module_id, $forum_from, $permissions, $number_of_posts, $text_length, $time, $type, $start = 0, $invert = false)
|
||||||
{
|
{
|
||||||
global $db, $phpbb_root_path, $auth, $user, $bbcode_bitfield, $bbcode, $portal_config, $config;
|
global $db, $phpbb_root_path, $auth, $user, $bbcode_bitfield, $bbcode, $portal_config, $config, $cache;
|
||||||
|
|
||||||
$posts = $update_count = array();
|
$posts = $update_count = array();
|
||||||
$post_time = ($time == 0) ? '' : 'AND t.topic_time > ' . (time() - $time * 86400);
|
$post_time = ($time == 0) ? '' : 'AND t.topic_time > ' . (time() - $time * 86400);
|
||||||
@@ -183,14 +183,23 @@ function phpbb_fetch_posts($module_id, $forum_from, $permissions, $number_of_pos
|
|||||||
|
|
||||||
if ($type == 'announcements' && $global_f < 1)
|
if ($type == 'announcements' && $global_f < 1)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT forum_id
|
if (!empty($str_where) || ($row = $cache->get('_forum_id_first_forum_post')) === false)
|
||||||
FROM ' . FORUMS_TABLE . '
|
{
|
||||||
WHERE forum_type = ' . FORUM_POST . '
|
$sql = 'SELECT forum_id
|
||||||
' . str_replace('t.', '', $str_where) . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
ORDER BY forum_id';
|
WHERE forum_type = ' . FORUM_POST . '
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
' . str_replace('t.', '', $str_where) . '
|
||||||
$row = $db->sql_fetchrow($result);
|
ORDER BY forum_id';
|
||||||
$db->sql_freeresult($result);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($str_where))
|
||||||
|
{
|
||||||
|
// Cache first forum ID for one day = 86400 s
|
||||||
|
$cache->put('_forum_id_first_forum_post', $row, 86400);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!sizeof($row))
|
if (!sizeof($row))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user