punbb/index.php
author Dan
Sun, 02 Sep 2007 10:56:36 -0400
changeset 4 eb9ed4c366d0
parent 2 a8a21e1c7afa
child 5 e3d7322305bf
permissions -rw-r--r--
Various bugfixes, mostly with URL generation (maintenance commit, may not be in a working state)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     1
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     2
/***********************************************************************
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     3
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     4
  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     5
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     6
  This file is part of PunBB.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     7
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     8
  PunBB is free software; you can redistribute it and/or modify it
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     9
  under the terms of the GNU General Public License as published
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    10
  by the Free Software Foundation; either version 2 of the License,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    11
  or (at your option) any later version.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    12
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    13
  PunBB is distributed in the hope that it will be useful, but
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    14
  WITHOUT ANY WARRANTY; without even the implied warranty of
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    16
  GNU General Public License for more details.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    17
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    18
  You should have received a copy of the GNU General Public License
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    19
  along with this program; if not, write to the Free Software
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    20
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    21
  MA  02111-1307  USA
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    22
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    23
************************************************************************/
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    24
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    25
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    26
//define('PUN_ROOT', './');
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    27
//require PUN_ROOT.'include/common.php';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    28
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    29
global $pun_db, $pun_user, $pun_config, $lang_common;
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    30
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    31
if ($pun_user['g_read_board'] == '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    32
	message($lang_common['No view']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    33
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
// Load the index.php language file
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
define('PUN_ALLOW_INDEX', 1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
// Print the categories and forums
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    42
$result = $pun_db->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 '.$pun_db->prefix.'categories AS c INNER JOIN '.$pun_db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$pun_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('Unable to fetch category/forum list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
$cur_category = 0;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
$cat_count = 0;
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    46
while ($cur_forum = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
	$moderators = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    49
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
	if ($cur_forum['cid'] != $cur_category)	// A new category since last iteration?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
		if ($cur_category != 0)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
			echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
		++$cat_count;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
<div id="idx<?php echo $cat_count ?>" class="blocktable">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
	<h2><span><?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
		<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
			<table cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
			<thead>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
				<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
					<th class="tcl" scope="col"><?php echo $lang_common['Forum'] ?></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
					<th class="tc2" scope="col"><?php echo $lang_index['Topics'] ?></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
					<th class="tc3" scope="col"><?php echo $lang_common['Posts'] ?></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
					<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
				</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
			</thead>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
			<tbody>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
		$cur_category = $cur_forum['cid'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
	$item_status = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
	$icon_text = $lang_common['Normal icon'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
	$icon_type = 'icon';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
	// Are there new posts?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
	if (!$pun_user['is_guest'] && $cur_forum['last_post'] > $pun_user['last_visit'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
		$item_status = 'inew';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
		$icon_text = $lang_common['New icon'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
		$icon_type = 'icon inew';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
	// Is this a redirect forum?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
	if ($cur_forum['redirect_url'] != '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
		$forum_field = '<h3><a href="'.pun_htmlspecialchars($cur_forum['redirect_url']).'" title="'.$lang_index['Link to'].' '.pun_htmlspecialchars($cur_forum['redirect_url']).'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
		$num_topics = $num_posts = '&nbsp;';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
		$item_status = 'iredirect';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
		$icon_text = $lang_common['Redirect icon'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
		$icon_type = 'icon';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
	{
4
eb9ed4c366d0 Various bugfixes, mostly with URL generation (maintenance commit, may not be in a working state)
Dan
parents: 2
diff changeset
   100
		$forum_field = '<h3><a href="' . makeUrlNS('Special', 'Forum/ViewForum', 'id='.$cur_forum['fid'], true) . '">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3>';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
		$num_topics = $cur_forum['num_topics'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
		$num_posts = $cur_forum['num_posts'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
	if ($cur_forum['forum_desc'] != '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
		$forum_field .= "\n\t\t\t\t\t\t\t\t".$cur_forum['forum_desc'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
	// If there is a last_post/last_poster.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
	if ($cur_forum['last_post'] != '')
4
eb9ed4c366d0 Various bugfixes, mostly with URL generation (maintenance commit, may not be in a working state)
Dan
parents: 2
diff changeset
   111
		$last_post = '<a href="' . makeUrlNS('Special', 'Forum/ViewTopic', 'pid='.$cur_forum['last_post_id'], true) . '#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
		$last_post = '&nbsp;';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
	if ($cur_forum['moderators'] != '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
		$mods_array = unserialize($cur_forum['moderators']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
		$moderators = array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
		while (list($mod_username, $mod_id) = @each($mods_array))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
			$moderators[] = '<a href="profile.php?id='.$mod_id.'">'.pun_htmlspecialchars($mod_username).'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
		$moderators = "\t\t\t\t\t\t\t\t".'<p><em>('.$lang_common['Moderated by'].'</em> '.implode(', ', $moderators).')</p>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
 				<tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
					<td class="tcl">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
						<div class="intd">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
							<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
							<div class="tclcon">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
								<?php echo $forum_field."\n".$moderators ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
							</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
					</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
					<td class="tc2"><?php echo $num_topics ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
					<td class="tc3"><?php echo $num_posts ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
					<td class="tcr"><?php echo $last_post ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
				</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
// Did we output any categories and forums?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
if ($cur_category > 0)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
	echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
	echo '<div id="idx0" class="block"><div class="box"><div class="inbox"><p>'.$lang_index['Empty board'].'</p></div></div></div>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
// Collect some statistics from the database
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   152
$result = $pun_db->query('SELECT COUNT(id)-1 FROM '.$pun_db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $pun_db->error());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   153
$stats['total_users'] = $pun_db->result($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   155
$result = $pun_db->query('SELECT u.id, eu.username FROM '.$pun_db->prefix.'users AS u LEFT JOIN '.table_prefix.'users AS eu ON ( eu.user_id = u.id ) ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $pun_db->error());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   156
$stats['last_user'] = $pun_db->fetch_assoc($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   158
$result = $pun_db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$pun_db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $pun_db->error());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   159
list($stats['total_topics'], $stats['total_posts']) = $pun_db->fetch_row($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
<div id="brdstats" class="block">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
	<h2><span><?php echo $lang_index['Board info'] ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
		<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
			<dl class="conr">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
				<dt><strong><?php echo $lang_index['Board stats'] ?></strong></dt>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
				<dd><?php echo $lang_index['No of users'].': <strong>'. $stats['total_users'] ?></strong></dd>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
				<dd><?php echo $lang_index['No of topics'].': <strong>'.$stats['total_topics'] ?></strong></dd>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
				<dd><?php echo $lang_index['No of posts'].': <strong>'.$stats['total_posts'] ?></strong></dd>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
			</dl>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
			<dl class="conl">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
				<dt><strong><?php echo $lang_index['User info'] ?></strong></dt>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
				<dd><?php echo $lang_index['Newest user'] ?>: <a href="profile.php?id=<?php echo $stats['last_user']['id'] ?>"><?php echo pun_htmlspecialchars($stats['last_user']['username']) ?></a></dd>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
if ($pun_config['o_users_online'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
	// Fetch users online info and generate strings for output
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
	$num_guests = 0;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
	$users = array();
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   182
	$result = $pun_db->query('SELECT user_id, ident FROM '.$pun_db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   184
	while ($pun_user_online = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
		if ($pun_user_online['user_id'] > 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
			$users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
			++$num_guests;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
	$num_users = count($users);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
	echo "\t\t\t\t".'<dd>'. $lang_index['Users online'].': <strong>'.$num_users.'</strong></dd>'."\n\t\t\t\t".'<dd>'.$lang_index['Guests online'].': <strong>'.$num_guests.'</strong></dd>'."\n\t\t\t".'</dl>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
	if ($num_users > 0)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
		echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].':&nbsp;</strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
		echo "\t\t\t".'<div class="clearer"></div>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
	echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
$footer_style = 'index';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
require PUN_ROOT.'footer.php';