boardindex.php
// Remember the most recent topic for optimizing the recent posts feature.
$most_recent_topic = array(
'timestamp' => 0,
'ref' => null
);
// Board Viewers - by HarzeM
$board_viewers = array();
if (!empty($settings['display_who_viewing']))
{
// get the users that are on some boards :)
$request = db_query("
SELECT session, url
FROM {$db_prefix}log_online
WHERE INSTR(url, 's:5:\"board\";i:')", __FILE__, __LINE__);
// for each user ...
while($row = mysql_fetch_assoc($request))
{
// no user ?! useless forum!
if (empty($row['session']))
continue;
// a second check on the user, if it is in some board
$bw_poss = strpos($row['url'],'s:5:"board";i:');
if ($bw_poss === false) continue;
// found someone inside! try to get the end of the board number
$bw_pose = strpos($row['url'],';',$bw_poss + 14);
// extract the board number, and add to board viewers
if(!isset($board_viewers[substr($row['url'],$bw_poss + 14 , $bw_pose - $bw_poss - 14)]))
$board_viewers[substr($row['url'],$bw_poss + 14 , $bw_pose - $bw_poss - 14)] = 0;
$board_viewers[substr($row['url'],$bw_poss + 14 , $bw_pose - $bw_poss - 14)]++;
}
// thanks.
mysql_free_result($request);
}
// Not a child.
$isChild = false;
$this_category[$row_board['ID_BOARD']] = array(
'new' => empty($row_board['isRead']),
'id' => $row_board['ID_BOARD'],
'name' => $row_board['boardName'],
'description' => $row_board['description'],
'moderators' => array(),
'link_moderators' => array(),
'children' => array(),
'link_children' => array(),
'children_new' => false,
'topics' => $row_board['numTopics'],
'posts' => $row_board['numPosts'],
'viewers' => isset($board_viewers[$row_board['ID_BOARD']]) ? $board_viewers[$row_board['ID_BOARD']] : 0, // Board Viewers - by HarzeM
// A valid child!
$isChild = true;
$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']] = array(
'id' => $row_board['ID_BOARD'],
'name' => $row_board['boardName'],
'description' => $row_board['description'],
'new' => empty($row_board['isRead']) && $row_board['posterName'] != '',
'topics' => $row_board['numTopics'],
'posts' => $row_board['numPosts'],
'viewers' => isset($board_viewers[$row_board['ID_BOARD']]) ? $board_viewers[$row_board['ID_BOARD']] : 0, // Board Viewers - by HarzeM
// Counting child board posts is... slow :/.
if (!empty($modSettings['countChildPosts']))
{
$this_category[$row_board['ID_PARENT']]['posts'] += $row_board['numPosts'];
$this_category[$row_board['ID_PARENT']]['topics'] += $row_board['numTopics'];
$this_category[$row_board['ID_PARENT']]['viewers'] += isset($board_viewers[$row_board['ID_BOARD']]) ? $board_viewers[$row_board['ID_BOARD']] : 0; // Board Viewers - by HarzeM
if (isset($parent_map[$row_board['ID_PARENT']]))
{
$parent_map[$row_board['ID_PARENT']][0]['posts'] += $row_board['numPosts'];
$parent_map[$row_board['ID_PARENT']][0]['topics'] += $row_board['numTopics'];
$parent_map[$row_board['ID_PARENT']][0]['viewers'] += isset($board_viewers[$row_board['ID_BOARD']]) ? $board_viewers[$row_board['ID_BOARD']] : 0; // Board Viewers - by HarzeM
$parent_map[$row_board['ID_PARENT']][1]['posts'] += $row_board['numPosts'];
$parent_map[$row_board['ID_PARENT']][1]['topics'] += $row_board['numTopics'];
$parent_map[$row_board['ID_PARENT']][1]['viewers'] += isset($board_viewers[$row_board['ID_BOARD']]) ? $board_viewers[$row_board['ID_BOARD']] : 0; // Board Viewers - by HarzeM
boardindex.template.php
<b>', $board['link'], '</b>
' , /*Board Viewers - by HarzeM*/($board['viewers'] > 0 ) ? '<span class="smalltext"> (<b>'.$board['viewers'] . '</b> ' . (($board['viewers'] > 1) ? $txt['board_viewers'] : $txt['board_viewer']) . ')</span>' : '' , '
languages/Modifications.portuguese.php
// Board Viewers - by HarzeM
$txt['board_viewer'] = 'A ler o quadro'; // 1 viewing
$txt['board_viewers'] = 'A Lerem o Quadro'; // 20 viewing
se tiver algum dificuldade coloca aqui...