function print_message($thread, $msg) { global $template_dir, $user, $forum; global $tpl; /* hack to get current page */ $mtpl = new Template($template_dir, "comment"); $mtpl->set_file("message", "message.tpl"); message_set_block($mtpl); $iid = mid_to_iid($msg['mid']); if (isset($iid)) { $sql = "update f_messages{$iid} set views = views + 1 where mid = ?"; db_exec($sql, array($msg['mid'])); } $uuser = new ForumUser($msg['aid']); $mtpl->set_var("parent", ""); render_message($mtpl, $msg, $user, $uuser); /* in threaded mode, subject is a link. override MSG_SUBJECT set above. */ $mtpl->set_var("MSG_SUBJECT", "<a href=\"../msgs/" . $msg['mid'] . ".phtml\" name=\"" . $msg['mid'] . "\">" . $msg['subject'] . "</a>"); $mtpl->set_var("FORUM_SHORTNAME", $forum['shortname']); $mtpl->set_var("PAGE", $tpl->get_var('PAGE')); $mtpl->parse("MESSAGE", "message"); return $mtpl->get_var("MESSAGE"); }
} if (isset($_POST['yes'])) { header("Location: changestate.phtml?state=Deleted&mid={$mid}&page={$_page}&token={$stoken}"); exit; } /* Check the data to make sure they entered stuff */ if (!isset($mid) || !isset($forum)) { /* Hmm, how did this happen? Redirect them back to the main page */ header("Location: http://{$server_name}{$script_name}{$path_info}/"); exit; } require_once "strip.inc"; require_once "message.inc"; $tpl->set_file(array("del" => "delete.tpl", "message" => "message.tpl", "forum_header" => array("forum/" . $forum['shortname'] . ".tpl", "forum/generic.tpl"))); $tpl->set_block("del", "disabled"); message_set_block($tpl); $tpl->set_var("FORUM_NAME", $forum['name']); $tpl->set_var("FORUM_SHORTNAME", $forum['shortname']); $tpl->parse("FORUM_HEADER", "forum_header"); $iid = mid_to_iid($mid); if (!isset($iid)) { echo "Invalid message!\n"; exit; } $sql = "select * from f_messages{$iid} where mid = ?"; $msg = db_query_first($sql, array($mid)); if ($msg['aid'] != $user->aid) { echo "This message does not belong to you!\n"; exit; } if (!isset($forum['option']['PostEdit'])) {