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