All pastes #565130 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-13 21:45 UTC
rendered paste body
<?php

define('PUN_ROOT', './forums/');
require PUN_ROOT.'include/common.php';



if ($pun_user['g_read_board'] == '0')
	message($lang_common['No view']);

$action = isset($_GET['action']) ? $_GET['action'] : null;
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;



if ($id < 1 && $pid < 1)
	message('Bad request');

// Load the viewtopic.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';

// Load the parser
require PUN_ROOT.'include/parser.php';

// Show comment box for only users
$quickpost = false;
if ($pun_config['o_quickpost'] == 
	!$pun_user['is_guest'])
{
	$required_fields = array('req_message' => $lang_common['Message']);
	$quickpost = true;
}

// Only show first post of the "topic" (news)
if($start_from == 0)
$start_from = 1;

// Fetch the news
$result = $db->query("SELECT t.id AS tid, t.poster, t.num_replies, t.subject, p.view_banner, t.posted, p.intro, p.message, p.hide_smilies, p.id, p.edited, p.edited_by, f.id AS forum_id FROM ".$db->prefix."topics AS t INNER JOIN ".$db->prefix."forums AS f ON f.id=t.forum_id INNER JOIN ".$db->prefix."posts AS p ON t.id = p.topic_id WHERE t.id = ".$id." LIMIT 1") or error('Unable to fetch article info', __FILE__, __LINE__, $db->error());
$data = $db->fetch_assoc($result);

// Under News Stuff (date, comment, edit..)
	{
	// Guest
	if ($pun_user['is_guest'])
	$news_actions = ''.$lang_common['On time'].' '.format_time($data['posted']).'
 	| <a href="'.PUN_ROOT.'register.php">register</a> to comment';
	
	// Admin / Editor
	if ($pun_user['g_id'] == PUN_ADMIN || $pun_user['g_id'] == FORTE_OFFICER || $pun_user['g_id'] == FORTE_EDITOR || $pun_user['g_id'] == PUN_MOD)
	$news_actions = ''.$lang_common['On time'].' '.format_time($data['posted']).' | 
	<a href="'.PUN_ROOT.'delete.php?id='.$data['id'].'">delete</a> | <a href="'.PUN_ROOT.'view_edit.php?id='.$data['id'].'">edit</a> | <a href="view?id='.$id.'#c">comment</a>';
	
	// Regular user
	else if ($pun_user['g_id'] != PUN_GUEST)
	$news_actions = ''.$lang_common['On time'].' '.format_time($data['posted']).' | <a href="view?id='.$id.'#c">comment</a>';
	}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="http://fortegaming.com/" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="forums/include/itemstats/overlib/overlib.js"></script>
<style type="text/css" media="screen">@import "css/style.css";</style>
<title>Forte Gaming</title>
</head>
<body>
<?php require 'header.php'; ?>


					<h1><?php echo $data['subject'] ?></h1>
					<?php 
					echo '<p><img class="news_banner" src="'.$data['view_banner'].'" alt="" /><br />';
					echo ''.parse_message($data['intro'], $data['hide_smilies']).'<br />';
					echo ''.parse_message($data['message'], $data['hide_smilies']).'</p>';
					echo '<h3>'.$news_actions.'</h3>';
					echo '<ul></li><div class="r"> &nbsp; <a href="index.php">Index</a>&nbsp; &raquo; &nbsp;'; 
						{if ($data['forum_id'] == 24) 
						echo '<a href="'.PUN_ROOT.'../?s=newslist">News</a>';
						else 
						echo '<a href="'.PUN_ROOT.'../?s=media">Media</a>'; } 
						echo 
						'&nbsp; &raquo; &nbsp;'.$data['subject'].'
						</div><div class="l"></div></li></ul>
						<h5><img align="abmiddle" src="img/icons/threads.gif" alt=""> '.$data['num_replies'].' Comments</h5>';
					?>

<?php

// Keep track of post numbers
$post_count = 0;   
 
// Fetch the comments
$result = $db->query("SELECT g.g_color, g.g_id, p.message, p.hide_smilies, p.edited, p.edited_by, p.posted, p.poster, p.poster_id, u.username, u.location, u.char_class, u.id AS uid FROM ".$db->prefix."posts AS p INNER JOIN ".$db->prefix."users AS u ON p.poster_id = u.id INNER JOIN ".$db->prefix."groups AS g ON g.g_id=u.group_id WHERE p.topic_id = ".$data['tid']." ORDER BY p.posted LIMIT ".$start_from.",30") or error('Unable to fetch article info', __FILE__, __LINE__, $db->error());
while($row = $db->fetch_assoc($result))
{
	$post_count++;
	$class = ($row['char_class'] != '') ? 'class/'.pun_htmlspecialchars($row['char_class']) : 'none';
	$location = ($row['location'] != '') ? $row['location'] : 'none';
	$userclass = '<img align="absbottom" class="vt-bot2" src="'.PUN_ROOT.'../img/side/'.$class.'.gif" alt="class" />&nbsp; ';
	$userloc = '<img src="img/loc/'.$location.'.gif" alt="location" />&nbsp; ';
	// No Images for commenters
	$no_images = 1;
	
	// Guest?
	$username = '<a href="'.PUN_ROOT.'profile.php?id='.$row['poster_id'].'&action=v"><span class="'.$row['g_color'].'-style">'.$row['username'].'</span></a>';
	?>
	<div class="blockpost">
		<h4><span><span class="r">
		<?php echo format_time($row['posted']); ?>&nbsp; &nbsp; 
		#<?php echo ($start_from + $post_count - 1) ?></span>
		<?php echo $userclass ?><a href="<?php echo PUN_ROOT.'profile.php?id='.$row['uid']; ?>&action=v"><?php echo $userloc.$username; ?></a></span></h4>
		<div class="box">
			<div class="inbox">
				<div class="postmsg">
					<div class="<?php echo $row['g_color']; ?>-style">
						<?php 
						echo parse_message($row['message'], $row['hide_smilies'], $no_images);
						if($row['edited'] != '')
							echo '<p class="postedit"><em>Last edited by '.pun_htmlspecialchars($row['edited_by']).' ('.format_time($row['edited']).')</em></p>'; ?>
					</div>
				</div>
			</div>
		</div>
	</div>
	<?php
}

if ($post_count == 0)
echo '<p><br \>There are no comments yet.<br \><br \></p>';

// Display quick post if enabled
if ($quickpost)
{
?>

<div class="blockform">
	<h2><span>Add Your Comment<a name="c"> </a></span></h2>
	<div class="box">
		<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;}">
			<div class="inform">
				<fieldset>
					<legend>Write your comment and submit</legend>
					<div class="infldset txtarea">
						<input type="hidden" name="form_sent" value="1" />
						<input type="hidden" name="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
						<label><textarea name="req_message" style="width:420px;" rows="7" cols="74" tabindex="1"></textarea></label>
					</div>
				</fieldset>
			</div>
			<p><input type="submit" name="submit" tabindex="2" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /></p>
		</form>
	</div>
</div>

<?php
}

require 'copy.php'; ?>
</body>
</html>