query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.closed FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra_sql.' ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); while ($cur_forum = $db->fetch_assoc($result)) { if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? { ?> '.pun_htmlspecialchars($cur_forum['forum_name']).''; else $forum_field = ''.pun_htmlspecialchars($cur_forum['forum_name']).''; if ($cur_forum['forum_desc'] != '') $forum_field .= '
'."\n\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 (!$cookie['is_guest'] && $cur_forum['last_post'] > $cur_user['last_visit']) { if ($cur_user['show_img'] == '1') $icon = ''; else $icon = ''; } else $icon = ' '; 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 = implode(', ', $moderators); } else $moderators = ' '; ?> \n\n"; // Show what the current user can and cannot do if ($cur_user['status'] > PUN_USER) $perms = $lang_index['You'].' '.$lang_index['can'].' '.$lang_index['post replies'].'
'.$lang_index['You'].' '.$lang_index['can'].' '.$lang_index['post topics'].'
'.$lang_index['You'].' '.$lang_index['can'].' '.$lang_index['edit posts'].'
'.$lang_index['You'].' '.$lang_index['can'].' '.$lang_index['delete posts'].'
'.$lang_index['You'].' '.$lang_index['can'].' '.$lang_index['delete topics']."\n"; else if (!$cookie['is_guest']) { $perms = $lang_index['You'].' '. (($pun_config['p_users_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .' '.$lang_index['post replies'].'
'; $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' '. (($pun_config['p_users_post_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .' '.$lang_index['post topics'].'
'; $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' '. (($pun_config['p_users_edit_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .' '.$lang_index['edit posts'].'
'; $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' '. (($pun_config['p_users_del_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .' '.$lang_index['delete posts'].'
'; $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' '. (($pun_config['p_users_del_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .' '.$lang_index['delete topics'].'
'."\n"; } else { $perms = $lang_index['You'].' '. (($pun_config['p_guests_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .' '.$lang_index['post replies'].'
'; $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' '. (($pun_config['p_guests_post_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .' '.$lang_index['post topics'].'
'; $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' '.$lang_index['cannot'].' '.$lang_index['edit posts'].'
'.$lang_index['You'].' '.$lang_index['cannot'].' '.$lang_index['delete posts'].'
'.$lang_index['You'].' '.$lang_index['cannot'].' '.$lang_index['delete topics']."\n"; } // Collect some statistics from the database $result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error()); $stats['total_users'] = $db->result($result, 0); $result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __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('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error()); list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result); ?>
 
 
1) ? $lang_index['registered users'] : $lang_index['registered users']).', '.$stats['total_topics'].' '.(($stats['total_topics'] <> 1) ? $lang_index['topics'] : $lang_index['topic']).' '.$lang_index['and'].' '.$stats['total_posts'].' '.(($stats['total_posts'] <> 1) ? $lang_index['posts'] : $lang_index['post']) ?>.
. query('SELECT user_id, ident FROM '.$db->prefix.'online ORDER BY ident') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error()); while ($cur_user_online = $db->fetch_assoc($result)) { if ($cur_user_online['user_id'] > 0) $users[] = ''.pun_htmlspecialchars($cur_user_online['ident']).''; else ++$num_guests; } $num_users = count($users); echo "\t\t\t\t\t\t".'
'.$lang_index['Currently serving'].' '.$num_users.' '.(($num_users <> 1) ? $lang_index['registered users'] : $lang_index['registered user']).' '.$lang_index['and'].' '.$num_guests.' '.(($num_guests <> 1) ? $lang_index['guests'] : $lang_index['guest']).'.'; if ($num_users) echo '

'."\n\t\t\t\t\t\t".implode(', ', $users)."\n"; else echo "\n"; } ?>