punbb/viewtopic.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
$action = isset($_GET['action']) ? $_GET['action'] : null;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
$pid = isset($_GET['pid']) ? intval($_GET['pid']) : 0;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
if ($id < 1 && $pid < 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
	message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
// Load the viewtopic.php language file
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
// If a post ID is specified we determine topic ID and page number so we can redirect to the correct message
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
if ($pid)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    46
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
	$result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
	if (!$db->num_rows($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    49
		message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
	$id = $db->result($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
	// Determine on what page the post is located (depending on $pun_user['disp_posts'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
	$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
	$num_posts = $db->num_rows($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
	for ($i = 0; $i < $num_posts; ++$i)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
		$cur_id = $db->result($result, $i);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
		if ($cur_id == $pid)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
			break;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
	++$i;	// we started at 0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
	$_GET['p'] = ceil($i / $pun_user['disp_posts']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
// If action=new, we redirect to the first new post (if any)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
else if ($action == 'new' && !$pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
	$result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted>'.$pun_user['last_visit']) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
	$first_new_post_id = $db->result($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
	if ($first_new_post_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
		header('Location: viewtopic.php?pid='.$first_new_post_id.'#p'.$first_new_post_id);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
	else	// If there is no new post, we go to the last post
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
		header('Location: viewtopic.php?id='.$id.'&action=last');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
	exit;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
// If action=last, we redirect to the last post
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
else if ($action == 'last')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
	$result = $db->query('SELECT MAX(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
	$last_post_id = $db->result($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
	if ($last_post_id)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
		header('Location: viewtopic.php?pid='.$last_post_id.'#p'.$last_post_id);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
		exit;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
// Fetch some info about the topic
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
if (!$pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
	$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['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) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
	$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_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) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
if (!$db->num_rows($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
	message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
$cur_topic = $db->fetch_assoc($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
// Sort out who the moderators are and if we are currently a moderator (or an admin)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
$mods_array = ($cur_topic['moderators'] != '') ? unserialize($cur_topic['moderators']) : array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
$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
   110
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
// Can we or can we not post replies?
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
if ($cur_topic['closed'] == '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
	if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1' || $is_admmod)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
		$post_link = '<a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
		$post_link = '&nbsp;';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
	$post_link = $lang_topic['Topic closed'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
	if ($is_admmod)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
		$post_link .= ' / <a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
// Determine the post offset (based on $_GET['p'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
$num_pages = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
$start_from = $pun_user['disp_posts'] * ($p - 1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
// Generate paging links
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
$paging_links = $lang_common['Pages'].': '.paginate($num_pages, $p, 'viewtopic.php?id='.$id);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
if ($pun_config['o_censoring'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
	$cur_topic['subject'] = censor_words($cur_topic['subject']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
$quickpost = false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
if ($pun_config['o_quickpost'] == '1' &&
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
	!$pun_user['is_guest'] &&
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
	($cur_topic['post_replies'] == '1' || ($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1')) &&
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
	($cur_topic['closed'] == '0' || $is_admmod))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
	$required_fields = array('req_message' => $lang_common['Message']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
	$quickpost = true;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
if (!$pun_user['is_guest'] && $pun_config['o_subscriptions'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
	if ($cur_topic['is_subscribed'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
		// I apologize for the variable naming here. It's a mix of subscription and action I guess :-)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
		$subscraction = '<p class="subscribelink clearb">'.$lang_topic['Is subscribed'].' - <a href="misc.php?unsubscribe='.$id.'">'.$lang_topic['Unsubscribe'].'</a></p>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
		$subscraction = '<p class="subscribelink clearb"><a href="misc.php?subscribe='.$id.'">'.$lang_topic['Subscribe'].'</a></p>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
	$subscraction = '<div class="clearer"></div>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
$page_title = pun_htmlspecialchars($pun_config['o_board_title'].' / '.$cur_topic['subject']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
define('PUN_ALLOW_INDEX', 1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
<div class="linkst">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
	<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
		<p class="pagelink conl"><?php echo $paging_links ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
		<p class="postlink conr"><?php echo $post_link ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
		<ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&nbsp;&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li><li>&nbsp;&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li></ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
		<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
require PUN_ROOT.'include/parser.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
$bg_switch = true;	// Used for switching background color in posts
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
$post_count = 0;	// Keep track of post numbers
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
// Retrieve the posts (and their respective poster/online status)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
while ($cur_post = $db->fetch_assoc($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
	$post_count++;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
	$user_avatar = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
	$user_info = array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
	$user_contacts = array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
	$post_actions = array();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
	$is_online = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
	$signature = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
	// If the poster is a registered user.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
	if ($cur_post['poster_id'] > 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
		$username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['username']).'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
		$user_title = get_title($cur_post);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
		if ($pun_config['o_censoring'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
			$user_title = censor_words($user_title);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
		// Format the online indicator
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
		$is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? '<strong>'.$lang_topic['Online'].'</strong>' : $lang_topic['Offline'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
		if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
			if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
				$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' alt="" />';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
			else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
				$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' alt="" />';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
			else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
				$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' alt="" />';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
			$user_avatar = '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
		// We only show location, register date, post count and the contact links if "Show user info" is enabled
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
		if ($pun_config['o_show_user_info'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
			if ($cur_post['location'] != '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
			{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
				if ($pun_config['o_censoring'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
					$cur_post['location'] = censor_words($cur_post['location']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
				$user_info[] = '<dd>'.$lang_topic['From'].': '.pun_htmlspecialchars($cur_post['location']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
			$user_info[] = '<dd>'.$lang_common['Registered'].': '.date($pun_config['o_date_format'], $cur_post['registered']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
			if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   235
				$user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   236
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   237
			// Now let's deal with the contact links (E-mail and URL)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
			if (($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) || $pun_user['g_id'] < PUN_GUEST)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   239
				$user_contacts[] = '<a href="mailto:'.$cur_post['email'].'">'.$lang_common['E-mail'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   240
			else if ($cur_post['email_setting'] == '1' && !$pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
				$user_contacts[] = '<a href="misc.php?email='.$cur_post['poster_id'].'">'.$lang_common['E-mail'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   243
			if ($cur_post['url'] != '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   244
				$user_contacts[] = '<a href="'.pun_htmlspecialchars($cur_post['url']).'">'.$lang_topic['Website'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   245
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   246
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   247
		if ($pun_user['g_id'] < PUN_GUEST)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   249
			$user_info[] = '<dd>IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   250
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   251
			if ($cur_post['admin_note'] != '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
				$user_info[] = '<dd>'.$lang_topic['Note'].': <strong>'.pun_htmlspecialchars($cur_post['admin_note']).'</strong>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   253
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
	// If the poster is a guest (or a user that has been deleted)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   256
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
		$username = pun_htmlspecialchars($cur_post['username']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   259
		$user_title = get_title($cur_post);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   260
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   261
		if ($pun_user['g_id'] < PUN_GUEST)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   262
			$user_info[] = '<dd>IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   263
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   264
		if ($pun_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   265
			$user_contacts[] = '<a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['E-mail'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   266
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   267
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   268
	// Generation post action array (quote, edit, delete etc.)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   269
	if (!$is_admmod)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   270
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   271
		if (!$pun_user['is_guest'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   272
			$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   273
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   274
		if ($cur_topic['closed'] == '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   275
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   276
			if ($cur_post['poster_id'] == $pun_user['id'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   277
			{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   278
				if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1'))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   279
					$post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   280
				if ($pun_user['g_edit_posts'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   281
					$post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   282
			}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   283
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   284
			if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   285
				$post_actions[] = '<li class="postquote"><a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   286
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   287
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   288
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   289
		$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.$lang_topic['Link separator'].'</li><li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>'.$lang_topic['Link separator'].'</li><li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.$lang_topic['Link separator'].'</li><li class="postquote"><a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   290
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   291
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   292
	// Switch the background color for every message.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   293
	$bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   294
	$vtbg = ($bg_switch) ? ' roweven' : ' rowodd';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   295
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   296
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   297
	// Perform the main parsing of the message (BBCode, smilies, censor words etc)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   298
	$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   299
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   300
	// Do signature parsing/caching
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   301
	if ($cur_post['signature'] != '' && $pun_user['show_sig'] != '0')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   302
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   303
		if (isset($signature_cache[$cur_post['poster_id']]))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   304
			$signature = $signature_cache[$cur_post['poster_id']];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   305
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   306
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   307
			$signature = parse_signature($cur_post['signature']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   308
			$signature_cache[$cur_post['poster_id']] = $signature;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   309
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   310
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   311
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   312
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   313
<div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo $vtbg ?><?php if (($post_count + $start_from) == 1) echo ' firstpost'; ?>">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   314
	<h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?>&nbsp;</span><a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   315
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   316
		<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   317
			<div class="postleft">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   318
				<dl>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   319
					<dt><strong><?php echo $username ?></strong></dt>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   320
					<dd class="usertitle"><strong><?php echo $user_title ?></strong></dd>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   321
					<dd class="postavatar"><?php echo $user_avatar ?></dd>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   322
<?php if (count($user_info)) echo "\t\t\t\t\t".implode('</dd>'."\n\t\t\t\t\t", $user_info).'</dd>'."\n"; ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   323
<?php if (count($user_contacts)) echo "\t\t\t\t\t".'<dd class="usercontacts">'.implode('&nbsp;&nbsp;', $user_contacts).'</dd>'."\n"; ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   324
				</dl>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   325
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   326
			<div class="postright">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   327
				<h3><?php if (($post_count + $start_from) > 1) echo ' Re: '; ?><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></h3>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   328
				<div class="postmsg">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   329
					<?php echo $cur_post['message']."\n" ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   330
<?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   331
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   332
<?php if ($signature != '') echo "\t\t\t\t".'<div class="postsignature"><hr />'.$signature.'</div>'."\n"; ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   333
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   334
			<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   335
			<div class="postfootleft"><?php if ($cur_post['poster_id'] > 1) echo '<p>'.$is_online.'</p>'; ?></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   336
			<div class="postfootright"><?php echo (count($post_actions)) ? '<ul>'.implode($lang_topic['Link separator'].'</li>', $post_actions).'</li></ul></div>'."\n" : '<div>&nbsp;</div></div>'."\n" ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   337
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   338
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   339
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   340
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   341
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   342
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   343
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   344
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   345
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   346
<div class="postlinksb">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   347
	<div class="inbox">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   348
		<p class="postlink conr"><?php echo $post_link ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   349
		<p class="pagelink conl"><?php echo $paging_links ?></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   350
		<ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&nbsp;&raquo;&nbsp;<a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li><li>&nbsp;&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li></ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   351
		<?php echo $subscraction ?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   352
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   353
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   354
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   355
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   356
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   357
// Display quick post if enabled
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   358
if ($quickpost)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   359
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   360
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   361
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   362
<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   363
	<h2><span><?php echo $lang_topic['Quick post'] ?></span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   364
	<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   365
		<form method="post" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   366
			<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   367
				<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   368
					<legend><?php echo $lang_common['Write message legend'] ?></legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   369
					<div class="infldset txtarea">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   370
						<input type="hidden" name="form_sent" value="1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   371
						<input type="hidden" name="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   372
						<label><textarea name="req_message" rows="7" cols="75" tabindex="1"></textarea></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   373
						<ul class="bblinks">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   374
							<li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   375
							<li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   376
							<li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   377
						</ul>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   378
					</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   379
				</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   380
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   381
			<p><input type="submit" name="submit" tabindex="2" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   382
		</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   383
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   384
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   385
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   386
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   387
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   388
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   389
// Increment "num_views" for topic
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   390
$low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   391
$db->query('UPDATE '.$low_prio.$db->prefix.'topics SET num_views=num_views+1 WHERE id='.$id) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   392
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   393
$forum_id = $cur_topic['forum_id'];
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   394
$footer_style = 'viewtopic';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   395
require PUN_ROOT.'footer.php';