|
All content on site copyright © Caravel Games, All Rights Reserved.
|
set_time_limit(10);
include("functions.php");
include("forum_template.php");
MysqlStartup();
GrabSession();
$fSettings = GetSettings();
$BoardID = 10;
if (isset($_GET["UserId"])) {
$CurrentUserInfo = GrabUserInfo("", $_GET["UserId"]);
}
$Board = GrabBoardInfo($BoardID);
$BoardName = $Board["bName"];
$pagetitle = $BoardName;
$LastVisit = GetLastVisit();
//if (!CheckViewAccess($BoardID))
//LogInFirst($txt['CantRead']);
$tIcons = GetPostIcons();
$query = "SELECT COUNT(*) FROM t_messages WHERE BoardID = $BoardID AND FirstMessageBool = 1";
$result = DebugSqlQuery($query);
list($totaltopic) = mysqli_fetch_row($result);
$link = "viewboard.php?BoardID=$BoardID";
if (isset($dayview))
{ $dayview+=0;
$link.= "&dayview=$dayview";
}
$template = ReadTemplate("viewnews");
$pos_start = strpos($template,"")+strlen("");
$pos_end = strpos($template,"",$pos_start);
$first_part = substr($template,0,$pos_start-strlen(""));
$last_part = substr($template,$pos_end,strlen($template)-$pos_end);
print ParseTemp($first_part,$ent);
$first_loop = substr($template,$pos_start,$pos_end-$pos_start);
$table = "";
$limit = 5;
function ViewMessages()
{ global $BoardID,$limit,$txt,$fSettings,$first_loop,$ent,$LastVisit,$tIcons,$CurrentUserInfo;
$query = "SELECT ID,Message,Emoticon,Subject,BoardID,TopicID,Poster,DatePosted,DateEdited,FirstMessageBool,numReplies,numViews FROM t_messages WHERE BoardID = $BoardID AND FirstMessageBool = 1 Order By DatePosted DESC LIMIT 0,$limit";
$result = DebugSqlQuery($query);
if ($row = mysqli_fetch_array($result))
{ do
{ $tInfo = $row;
$totalmessage = $tInfo["numReplies"]+1;
$link = "viewtopic.php?TopicID=".$tInfo['TopicID'];
$pages2 = "";
$ent["NewsTitle"] = $tInfo["Subject"];
$ent["NewsText"] = ParseMSG($tInfo["Message"], $tInfo["Emoticon"]);
$ent["NewsDate"] = FormatDate($tInfo["DatePosted"], $CurrentUserInfo["timezone"]);
$ent["NewsPerson"] = $tInfo["Poster"];
$ent["LinkToForum"] = "(Discuss this article - ".$tInfo["numReplies"]." replies)";
print ParseTemp($first_loop,$ent);
} while ($row = mysqli_fetch_array($result));
}
}
if ($totaltopic > 0)
{
ViewMessages();
print ParseTemp($last_part,$ent);
}
$ent["ScriptURL"] = $fSettings["ScriptURL"];
?>
|