punbb/viewforum.php
author Dan
Thu, 12 Jul 2007 01:04:01 -0400
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
child 5 e3d7322305bf
permissions -rw-r--r--
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.
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';
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
    28
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;
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
    30
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    31
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    32
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    33
if ($pun_user['g_read_board'] == '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
	message($lang_common['No view']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
if ($id < 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
	message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
// Load the viewforum.php language file
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
// Fetch some info about the forum
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
    45
$result = $pun_db->query('SELECT f.forum_name, f.redirect_url, f.moderators, f.num_topics, f.sort_by, fp.post_topics FROM '.$pun_db->prefix.'forums AS f 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) AND f.id='.$id) or error('Unable to fetch forum info', __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
    46
if (!$pun_db->num_rows($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
	message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
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
    49
$cur_forum = $pun_db->fetch_assoc($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
// Is this a redirect forum? In that case, redirect!
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
if ($cur_forum['redirect_url'] != '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
	header('Location: '.$cur_forum['redirect_url']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
	exit;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
// Sort out who the moderators are and if we are currently a moderator (or an admin)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
$mods_array = array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
if ($cur_forum['moderators'] != '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
	$mods_array = unserialize($cur_forum['moderators']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_id'] == PUN_MOD && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
// Can we or can we not post new topics?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
if (($cur_forum['post_topics'] == '' && $pun_user['g_post_topics'] == '1') || $cur_forum['post_topics'] == '1' || $is_admmod)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
	$post_link = "\t\t".'<p class="postlink conr"><a href="post.php?fid='.$id.'">'.$lang_forum['Post topic'].'</a></p>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
	$post_link = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
// Determine the topic offset (based on $_GET['p'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
$num_pages = ceil($cur_forum['num_topics'] / $pun_user['disp_topics']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
$start_from = $pun_user['disp_topics'] * ($p - 1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
// Generate paging links
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
    79
$paging_links = $lang_common['Pages'].': '.pun_paginate($num_pages, $p, 'viewforum.php?id='.$id);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
$page_title = pun_htmlspecialchars($pun_config['o_board_title'].' / '.$cur_forum['forum_name']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
define('PUN_ALLOW_INDEX', 1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
<div class="linkst">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
	<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
		<p class="pagelink conl"><?php echo $paging_links ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
<?php echo $post_link ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
		<ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a>&nbsp;</li><li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li></ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
		<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
<div id="vf" class="blocktable">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
	<h2><span><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
		<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
			<table cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
			<thead>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
				<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
					<th class="tcl" scope="col"><?php echo $lang_common['Topic'] ?></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
					<th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
					<th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
					<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
				</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
			</thead>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
			<tbody>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
// Fetch list of topics to display on this page
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
if ($pun_user['is_guest'] || $pun_config['o_show_dot'] == '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
	// Without "the dot"
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
   116
	$sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$pun_db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
	// With "the dot"
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
	switch ($db_type)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
		case 'mysql':
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
		case 'mysqli':
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
   125
			$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$pun_db->prefix.'topics AS t LEFT JOIN '.$pun_db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
		case 'sqlite':
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
   129
			$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$pun_db->prefix.'topics AS t LEFT JOIN '.$pun_db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN(SELECT id FROM '.$pun_db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
		default:
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
   133
			$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$pun_db->prefix.'topics AS t LEFT JOIN '.$pun_db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
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
   139
$result = $pun_db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
// If there are topics in this forum.
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
   142
if ($pun_db->num_rows($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
{
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
   144
	while ($cur_topic = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
		$icon_text = $lang_common['Normal icon'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
		$item_status = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
		$icon_type = 'icon';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
		if ($cur_topic['moved_to'] == null)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
			$last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
			$last_post = '&nbsp;';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
		if ($pun_config['o_censoring'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
			$cur_topic['subject'] = censor_words($cur_topic['subject']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
		if ($cur_topic['moved_to'] != 0)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
			$subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
		else if ($cur_topic['closed'] == '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
			$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
			$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
			$icon_text = $lang_common['Closed icon'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
			$item_status = 'iclosed';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
		if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'] && $cur_topic['moved_to'] == null)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
			$icon_text .= ' '.$lang_common['New icon'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
			$item_status .= ' inew';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
			$icon_type = 'icon inew';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
			$subject = '<strong>'.$subject.'</strong>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
			$subject_new_posts = '<span class="newtext">[&nbsp;<a href="viewtopic.php?id='.$cur_topic['id'].'&amp;action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a>&nbsp;]</span>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
			$subject_new_posts = null;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
		// Should we display the dot or not? :)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
		if (!$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
			if ($cur_topic['has_posted'] == $pun_user['id'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
				$subject = '<strong>&middot;</strong>&nbsp;'.$subject;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
			else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
				$subject = '&nbsp;&nbsp;'.$subject;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
		if ($cur_topic['sticky'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
			$subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
			$item_status .= ' isticky';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
			$icon_text .= ' '.$lang_forum['Sticky'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
		$num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
		if ($num_pages_topic > 1)
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
   199
			$subject_multipage = '[ '.pun_paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
			$subject_multipage = null;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
		// Should we show the "New posts" and/or the multipage links?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
		if (!empty($subject_new_posts) || !empty($subject_multipage))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
			$subject .= '&nbsp; '.(!empty($subject_new_posts) ? $subject_new_posts : '');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
			$subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
				<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
					<td class="tcl">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
						<div class="intd">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
							<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
							<div class="tclcon">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
								<?php echo $subject."\n" ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
							</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
					</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
					<td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : '&nbsp;' ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
					<td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : '&nbsp;' ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
					<td class="tcr"><?php echo $last_post ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
				</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
				<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
					<td class="tcl" colspan="4"><?php echo $lang_forum['Empty forum'] ?></td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
				</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   235
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   236
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   237
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   239
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   240
			</tbody>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
			</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   243
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   244
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   245
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   246
<div class="linksb">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   247
	<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
		<p class="pagelink conl"><?php echo $paging_links ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   249
<?php echo $post_link ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   250
		<ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a>&nbsp;</li><li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li></ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   251
		<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   253
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   256
$forum_id = $id;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
$footer_style = 'viewforum';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   259