query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Impossible de retrouver la liste des catégories et des forums', __FILE__, __LINE__, $db->error());
$cur_category = 0;
$cat_count = 0;
while ($cur_forum = $db->fetch_assoc($result))
{
$moderators = '';
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
if ($cur_category != 0)
echo "\t\t\t".''."\n\t\t\t".''."\n\t\t".''."\n\t".''."\n".''."\n\n";
++$cat_count;
?>
|
|
|
|
$pun_user['last_visit'])
{
$item_status = 'inew';
$icon_text = $lang_common['New icon'];
$icon_type = 'icon inew';
}
// Is this a redirect forum?
if ($cur_forum['redirect_url'] != '')
{
$forum_field = '';
$num_topics = $num_posts = ' ';
$item_status = 'iredirect';
$icon_text = $lang_common['Redirect icon'];
$icon_type = 'icon';
}
else
{
$forum_field = '';
$num_topics = $cur_forum['num_topics'];
$num_posts = $cur_forum['num_posts'];
}
if ($cur_forum['forum_desc'] != '')
$forum_field .= "\n\t\t\t\t\t\t\t\t".$cur_forum['forum_desc'];
// If there is a last_post/last_poster.
if ($cur_forum['last_post'] != '')
$last_post = ''.format_time($cur_forum['last_post']).' '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'';
else
$last_post = ' ';
if ($cur_forum['moderators'] != '')
{
$mods_array = unserialize($cur_forum['moderators']);
$moderators = array();
while (list($mod_username, $mod_id) = @each($mods_array))
$moderators[] = ''.pun_htmlspecialchars($mod_username).'';
$moderators = "\t\t\t\t\t\t\t\t".'('.$lang_common['Moderated by'].' '.implode(', ', $moderators).')
'."\n";
}
?>
>
|
|
|
|
0)
echo "\t\t\t".''."\n\t\t\t".'
'."\n\t\t".'
'."\n\t".'
'."\n".'
'."\n\n";
else
echo ''.$lang_index['Empty board'].'
';
// Collect some statistics from the database
$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Impossible de retrouver le nombre total d\utilisateurs', __FILE__, __LINE__, $db->error());
$stats['total_users'] = $db->result($result);
$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Impossible de retrouver le dernier membre inscrit', __FILE__, __LINE__, $db->error());
$stats['last_user'] = $db->fetch_assoc($result);
$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Impossible de retrouver le nombre de discussions et de messages', __FILE__, __LINE__, $db->error());
list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);
?>
- '. $stats['total_users'] ?>
- '.$stats['total_topics'] ?>
- '.$stats['total_posts'] ?>
- :
query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Impossible de retrouver la liste des utilisateurs en ligne', __FILE__, __LINE__, $db->error());
while ($pun_user_online = $db->fetch_assoc($result))
{
if ($pun_user_online['user_id'] > 1)
$users[] = "\n\t\t\t\t".'- '.pun_htmlspecialchars($pun_user_online['ident']).'';
else
++$num_guests;
}
$num_users = count($users);
// utilisateurs en ligne aujourd'hui
$date = getdate(time());
$todaystamp = mktime(0,0,0, $date['mon'], $date['mday'], $date['year']);
$result = $db->query('SELECT username, id, last_visit from '.$db->prefix.'users WHERE last_visit >= \''.$todaystamp.'\' ORDER by last_visit DESC') or error('Impossible de retrouver la liste des utilisateurs en ligne aujourd\'hui', __FILE__, __LINE__, $db->error());
$users_today = array();
while ($pun_user_online_today = $db->fetch_assoc($result))
$users_today[] .= "\n\t\t\t\t".'
- '.$pun_user_online_today['username'].'';
// liste utilisateurs en ligne aujourd'hui
echo "\t\t\t".'
'."\n\t\t\t\t".'- '.$lang_index['Online today'].':
';
if ($num_users_today > 0)
echo implode(',
', $users_today).' '."\n\t\t\t".'
'."\n";
else
echo '
aucun'."\n\t\t\t".''."\n";
$num_users_today = count($users_today);
echo "\t\t\t\t".'
'.$lang_index['Users online'].': '.$num_users.''."\n\t\t\t\t".'
'.$lang_index['Users today'].': '.$num_users_today.''."\n\t\t\t\t".'
'.$lang_index['Guests online'].': '.$num_guests.''."\n\t\t\t".''."\n";
if ($num_users > 0)
echo "\t\t\t".'
'."\n\t\t\t\t".'- '.$lang_index['Online'].':
'."\t\t\t\t".implode(', ', $users).''."\n\t\t\t".'
'."\n";
else
echo "\t\t\t".'
'."\n";
}
else
echo "\t\t".''."\n\t\t\t".'
'."\n";
?>