<?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 = "forum.tpl";
require('Lib/prependphpfn.php');
//broken, fix in all 'reply' php files
if ($post == "post") {
$r->set_var('METAREFRESH','<meta http-equiv=Refresh content=4;url=forum_view.php?f_id=". $f_id . ">');
}
//end broken
$r->set_block('TPL','FORUM_NEWTHREAD');
if (!$type && !$preview) {
$r->set_block('FORUM_NEWTHREAD','REPLY');
$query = "select ff_name,ff_description from fn_forum where forum_id = '$f_id'";
$db->next_record($db->query($query));
$r->set_var(array(
"F_ID" => $f_id,
"NAME" => $db->f("ff_name"),
"DESC" => $db->f("ff_description")
));
$r->parse('body','REPLY',true);
}
if ($type == "preview") {
$r->set_block('FORUM_NEWTHREAD','PREVIEW');
$query = "select ff_name,ff_description from fn_forum where forum_id = '$f_id'";
$db->next_record($db->query($query));
$r->set_var(array(
"NAME" => $db->f('ff_name'),
"DESC" => $db->f('ff_description'),
"USERNAME" => $handle,
"DATETIME" => date("F d - H:i", time()),
"TEXT_S" => stripslashes($text_s),
"TEXT" => stripslashes($text)
));
$r->parse('body','PREVIEW',true);
$r->set_block('FORUM_NEWTHREAD','REPLY');
$r->set_var(array(
"F_ID" => $f_id,
));
$r->parse('body','REPLY',true);
}
if ($type == "post") {
$now = time();
$text = htmlspecialchars($text);
$text = preg_replace("/(\015\012)|(\015)|(\012)/","<br>",$text);
$text_s = htmlspecialchars($text_s);
if ($handle == $anonname) { $useridfk = '0'; } else { $useridfk = $auth[user_id]; }
$query = "insert into fn_fposts SET forum_idfk='$f_id', subject = '$text_s', body = '$text', fp_cdate = '$now', fp_ldate = '$now', user_idfk = '$useridfk'";
$db->query($query);
$query = "update fn_forum SET subjects = subjects+1 where forum_id = '$f_id'";
$db->query($query);
$query = "update fn_forum SET f_ldate = '$now' where forum_id = '$f_id'";
$db->query($query);
$r->set_block('TPL','DONEPOSTING');
$r->parse('TPL','DONEPOSTING');
}
require('Lib/appendphpfn.php');
?>