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