<?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 = "news_index";
$tpl = "news.tpl";
require('Lib/prependphpfn.php');
$r->set_block('TPL','NEWS_VIEW');
$r->set_block('NEWS_VIEW','NEWS_STORY');
$query = "select * from fn_news,fn_user,fn_user2 where news_id = '$r_id' and (user_idfk = fn_user.user_id2)
and (user_idfk = fn_user2.user_id2)";
$db->next_record($db->query($query));
$r->set_block('TPL','POSTLINKS');
tpl_array();
$r->set_var("DATETIME",$ndate($db->f("n_cdate")));
$r->parse('LINKS','POSTLINKS');
$r->parse('body','NEWS_STORY',true);
$r->set_block('NEWS_VIEW','REPLIES');
$query = "select * from fn_nposts,fn_user, fn_user2 where news_idfk = '$r_id'
and (user_idfk = fn_user.user_id2) and (user_idfk=fn_user2.user_id2) order by p_cdate limit 20";
$db->query($query);
while ($db->next_record()) {
tpl_array();
$r->set_var("DATETIME",$ndate($db->f("p_cdate")));
$r->parse('LINKS','POSTLINKS');
$r->parse('NEWS_VIEW','REPLIES');
$r->parse('body','NEWS_VIEW',true);
}
require('Lib/appendphpfn.php');
?>
<?php
// PAGE SPECIFIC FUNCTION(S)
function tpl_array() {
global $auth,$r,$db,$ndate,$r_id;
$r->set_var(array(
"BODY" => $db->f("body"),
"SUBJECT" => $db->f("subject"),
"POSTEDBY" => $db->f("handle"),
"POSTCOUNT" => $db->f("replies"),
"LASTTIME" => $ndate($db->f("p_ldate")),
"USERSINCE" => $ndate($db->f('n_cdate')),
"EMAIL" => sp("<a href=mailto:" . $db->f('pub_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('news_idfk')) {
$r->set_var(
"REPLY",sp("<a href=news_reply.php?r_id=" . $r_id . "&r2_id=" . $db->f('post_id') . ">REPLY</a>"));
}
else
{
$r->set_var("REPLY",sp("<a href=news_reply.php?r_id=" . $db->f('news_idfk') . "&r2_id=" . $db->f('post_id') . ">REPLY</a>"));
}
//need to fix...check for multiple groups!
if ($auth["groups"] == 'admin') {
$r->set_var("aADMIN",sp("| ADMIN FUNCTIONS ->"));
$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>"));
}
}
?>