= m2.id_msg_modified AS is_read') . '
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}messages AS m1 ON (m1.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem1 ON (mem1.id_member = m1.id_member)
LEFT JOIN {db_prefix}messages AS m2 ON (m2.id_msg = t.id_last_msg)
LEFT JOIN {db_prefix}members AS mem2 ON (mem2.id_member = m2.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = m.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = m.id_board AND lmr.id_member = {int:current_member})' : '') . '
WHERE m.id_msg >= {int:likely_max_msg}' .
(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
GROUP BY m.id_topic
ORDER BY m2.id_msg DESC
LIMIT ' . $latestPostOptions['number_posts'],
array(
'likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']),
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
'current_member' => $user_info['id'],
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// Censor the subject and post for the preview ;).
censorText($row['subject']);
censorText($row['body']);
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('
' => '
')));
if ($smcFunc['strlen']($row['body']) > 128)
$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
// Build the array.
$row['cname'] = preg_match("/german/", $user_info['language']) ? preg_replace("/ *\[.*\]/", "", $row['cname']) : preg_replace("/.*\[ *(.*) *\]/", "\\1", $row['cname']);
$row['board_name'] = preg_match("/german/", $user_info['language']) ? preg_replace("/ *\[.*\]/", "", $row['board_name']) : preg_replace("/.*\[ *(.*) *\]/", "\\1", $row['board_name']);
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '' . $row['board_name'] . ''
),
'categorie' => $row['cname'],
'topic' => $row['id_topic'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '' . $row['poster_name'] . ''
),
'first_poster' => array(
'id' => $row['first_id_member'],
'name' => $row['first_poster_name'],
'href' => empty($row['first_id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['first_id_member'],
'link' => empty($row['first_id_member']) ? $row['first_poster_name'] : '' . $row['first_poster_name'] . ''
),
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 24),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'raw_timestamp' => $row['poster_time'],
'new' => empty($row['is_read']),
'solved' => $row['icon'] == "topicsolved",
'is_poll' => !empty($row['id_poll']),
// 'first_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['first_id_msg'] . ';topicseen',
'first_href' => $scripturl . '?topic=' . $row['id_topic'] . ';topicseen',
// 'first_link' => '' . $row['subject'] . '',
'first_link' => '' . $row['subject'] . '',
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '' . $row['subject'] . ''
);
}
$smcFunc['db_free_result']($request);
$posts = array_merge($posts, getLastVdrPortalPosts("107-mld"));
return $posts;
}
// Callback-function for the cache for getLastPosts().
function cache_getLastPosts($latestPostOptions)
{
return array(
'data' => getLastPosts($latestPostOptions),
'expires' => time() + 60,
'post_retri_eval' => '
foreach ($cache_block[\'data\'] as $k => $post)
{
$cache_block[\'data\'][$k][\'time\'] = timeformat($post[\'raw_timestamp\']);
$cache_block[\'data\'][$k][\'timestamp\'] = forum_time(true, $post[\'raw_timestamp\']);
}',
);
}
function getLastVdrPortalMatches($bordId, $historyTime)
{
$context = stream_context_create(array('http' => array('header' => "Accept-language: en\r\n", 'timeout' => 2)));
$html = file_get_contents('https://www.vdr-portal.de/forum/index.php?board/' . $bordId . '/&filterByDate=' . $historyTime, false, $context);
preg_match('/