Location: PHPKode > projects > Phpfastnews > forum_posts.php
<?php
/*	Copyright (c) 2001-02 by Ken Williams (hide@address.com)*/
/*	http://phpfastnews.sourceforge.net/ & http://www.phpfastnews.com*/
/*									*/
/*	You can redistribute and/or modify the following code under the	*/
/*	terms of the GNU General Public License as published by the	*/
/*	the Free Software Foundation.					*/
/*									*/
/*	All code by Ken Williams (HDwebdev) unless otherwise noted	*/
/* This is an alpha test release -- not intended for live site	use	*/


$pg = "forum_posts";
$tpl = "forum.tpl";
require('Lib/prependphpfn.php');

$r->set_block('TPL','FORUM_POSTS');

	$r->set_block('FORUM_POSTS','POSTLINKS');
	$r->set_block('FORUM_POSTS','PARENTPOST');

	$query = "select * from fn_fposts,fn_forum,fn_user,fn_user2 where post_id = '$r_id' and (user_idfk = fn_user.user_id2) and (user_idfk = fn_user2.user_id2) and forum_id = '$f_id'";
                $db->next_record($db->query($query));
		forum_posts_array();
                $r->parse('LINKS','POSTLINKS');
                $r->parse('body','PARENTPOST',true);

	$r->set_block('FORUM_POSTS','REPLIES');
	$query = "select * from fn_fposts,fn_user,fn_user2 where parent = '$r_id' and (user_idfk = fn_user.user_id2) and (user_idfk = fn_user2.user_id2) order by fp_cdate";

                $db->query($query);
                while ($db->next_record())	{
		forum_posts_array();
		$r->parse('LINKS','POSTLINKS');
  		$r->parse('body','REPLIES',true);
	}

require('Lib/appendphpfn.php');
?>

<?php 

function forum_posts_array() {
	global $r,$db,$ps_perm,$f_id,$r_id,$ndate;
		$r->set_var(array(

				"BODY"		=> $db->f("body"),
				"SUBJECT"	=> $db->f("subject"),
				"POSTEDBY"	=> $db->f("handle"),
				"POSTCOUNT"	=> $db->f("replies"),
				"DATETIME"	=> $ndate($db->f("fp_cdate")),
				"LASTTIME"	=> $ndate($db->f("fp_ldate")),
				"USERSINCE"	=> $ndate($db->f('cdate')),
				"EMAIL"		=>sp("<a href=mailto:" . $db->f(email) . ">EMAIL</a>"),
				"ICQ"			=>sp("<s>ICQ</s>"),
				"MSN"			=>sp("<s>MSN</s>"),
				"AIM"			=>sp("<s>AIM</s>"),
				"YIM"			=>sp("<s>YIM</s>"),

				));
				if ($db->f("parent"))	{
				$r2_id = $db->f("post_id");
				}
				else
				{
				$r2_id = '';
				}


				$r->set_var(array(
					"REPLY" => sp("<a href=forum_reply.php?f_id=". $f_id . "&r_id=" . $r_id .
						 "&r2_id=" . $r2_id . ">REPLY</a>")));
					//BAD---v
				if ($auth["groups"] == "admin") {
				$r->set_var("aADMIN",sp("| ADMIN FUNCTIONS -&gt;"));
				$r->set_var("aEDIT",sp("<s>EDIT</s>"));
				$r->set_var("aBAN",sp("<s>BAN</s>"));
				$r->set_var("aMUTE",sp("<s>MUTE</s>"));
				$r->set_var("aDELETE",sp("<s>DELETE</s>"));
				}
				
}
?>
Return current item: Phpfastnews