//////////////////////////////////View Topic///////////////////
else if($action=="viewtpc"){
gettimebar();
$umsg = getunreadpm(getuid_sid($sid));
$item = mysql_fetch_array(mysql_query("SELECT
a.name, b.id FROM ibwf_users a
INNER JOIN ibwf_private b ON a.id = b.byuid
WHERE b.touid='".$uid."' AND b.unread='1'
ORDER BY b.timesent DESC
LIMIT 1"));
if($umsg>0)
{
echo "
New PM by : <a href="inbox.php?action=readpm&pmid=$item[1]&sid=$sid">$item[0]</a>
";
}
getalert($sid);
$tid = $_GET["tid"];
$go = $_GET["go"];
$seer = getuid_sid($sid);
$tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
$fname = getfname($tfid[0]);
if (isforumblocked($uid)){
boxstart("Error!");
echo "<img src="notok.gif"/>";
echo "Your forum access has been blocked by a moderator!!!
";
echo "<a href="index.php?action=main&sid=$sid">Main Menu</a>";
boxend();
echo "</body></html>";
exit();
}
if(!canaccess($uid, $tfid[0])){
boxstart("Error!");
echo "<img src="notok.gif"/>";
echo "This post belongs to $fname forum which is not available to you presently. To read this post, join $fname club.
";
echo "<a href="index.php?action=main&sid=$sid">Main Menu</a>";
echo "</body></html>";
exit();
}
if($go!="") {
$page=getpage_go($go,$tid,$sid);
}
$tinfo = mysql_fetch_array(mysql_query("SELECT name, text, authorid, crdate, views, fid, pollid from ibwf_topics WHERE id='".$tid."'"));
$tnm = htmlspecialchars($tinfo[0]);
$namewa = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_forums WHERE id = $tinfo[5]"));
$namewa1 = htmlspecialchars($namewa[0]);
$indiatime = time() + (addhours());
addonline($uid,"Viewing $tnm topic in $fname forum","index.php?action=$action&tid=$tid");
boxstart("$tnm");
$vws = $tinfo[4]+1;
$num_pages = getnumpages($tid, $sid);
echo "Subject: $tnm
Viewed: $vws times
Topic # $tid
Page # $page of $num_pages
Pages:";
$pagewa = 1;
while ($pagewa<=$num_pages)
{
echo "[<a href="index.php?action=viewtpc&page=$pagewa&sid=$sid&tid=$tid">$pagewa</a>]";
$pagewa = $pagewa+1;
};
if($page==""||$page<1) {
$page=1;
}
$posts_per_page = getppp($uid);
if($page>$num_pages) {
$page=$num_pages;
}
$limit_start = $posts_per_page ($page-1);
$rpls = mysql_fetch_array(mysql_query("SELECT COUNT() FROM ibwf_posts WHERE tid='".$tid."'"));
///fm here
if($page==1){
mysql_query("UPDATE ibwf_topics SET views='".$vws."' WHERE id='".$tid."'");
$ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate, pollid FROM ibwf_topics WHERE id='".$tid."'"));
$unick = getnick_uid($ttext[0]);
echo "
";
if(isonline($ttext[0])){
$iml = "<img src="../images/onl.gif" alt="+"/>";
}else{
$iml = "<img src="../images/ofl.gif" alt="-"/>";
}
if(isowner($ttext[0]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$ttext[0]">$unick</a>";}
else if(isvip($ttext[0]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$ttext[0]">$unick</a>";}
else if(ismod($ttext[0]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$ttext[0]">$unick</a>";}
else if(ispre($ttext[0]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$ttext[0]">$unick</a>";}
else if(isbanned($ttext[0]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$ttext[0]"><strike>$unick</strike></a>";}
else
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$ttext[0]">$unick</a>";}
$topt = "<a href="index.php?action=tpcopt&sid=$sid&tid=$tid">*</a>";
$thnk = "<a href="genproc.php?action=thanks&sid=$sid&tid=$tid">[Thnx]</a>";
if($go==$tid)
{
$fli = "<img src="../images/flag.gif" alt="!"/>";
}else{
$fli ="";
}
$pst = parsemsg($ttext[1],$sid);
echo "
$usl: $topt $thnk";
$vp = mysql_fetch_array(mysql_query("SELECT tid FROM fun_favtopic WHERE uid='".$uid."'"));
if($tid==$vp[0])
{
echo "<a href="genproc.php?action=delfav&sid=$sid&tid=$tid">[Unlike]</a>
";
}else{
echo "<a href="genproc.php?action=makefav&sid=$sid&tid=$tid">[Like]</a>
";
}
$indiatime = $ttext[2] + (addhours());
$dtot = date("d/m/Y h:i:s A",$indiatime);
echo $dtot."
";
echo "
$pst
";
if($ttext[3]>0){
echo "<a href="index.php?action=viewtpl&sid=$sid&who=$tid">POLL</a>
";
}
}
if($page>1){
$limit_start--;
}
$sql = "SELECT id, text, uid, dtpost FROM ibwf_posts WHERE tid='".$tid."' ORDER BY dtpost LIMIT $limit_start, $posts_per_page";
$posts = mysql_query($sql);
while($post = mysql_fetch_array($posts)){
$unick = getnick_uid($post[2]);
if(isonline($post[2])){
$iml = "<img src="../images/onl.gif" alt="+"/>";
}else{
$iml = "<img src="../images/ofl.gif" alt="-"/>";
}
if(isowner($post[2]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$post[2]">$unick</a>";}
else if(isvip($post[2]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$post[2]">$unick</a>";}
else if(ismod($post[2]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$post[2]">$unick</a>";}
else if(ispre($post[2]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$post[2]">$unick</a>";}
else if(isbanned($post[2]))
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$post[2])"><strike>$unick</strike></a>";}
else
{$usl = "$iml<a href="index.php?action=viewuser&sid=$sid&who=$post[2]">$unick</a>";}
$pst = parsemsg($post[1], $sid);
$quo = parsemsg($post[4], $sid);
$topt = "<a href="index.php?action=pstopt&sid=$sid&pid=$post[0]&page=$page&fid=$tinfo[5]">*</a>";
$quop = "<a href="index.php?action=quote&sid=$sid&pid=$post[0]&tid=$tid">[Q]</a>";
if($go==$tid)
{
$fli = "<img src="../images/flag.gif" alt="!"/>";
}else{
$fli ="";
}
echo "
$usl: $topt $quop
";
$indiantime = $post[3] + (addhours());
$dtot = date("d/m/Y h:i:s A",$indiantime);
echo $dtot."
";
if($quo==NULL)
{echo "";}
else
{echo "
";
echo "$quo";
echo "
";}
echo "
$pst
";
}
echo "
";
boxend();
echo "";
if($page<$num_pages){
$npage = $page+1;
echo "<a href="index.php?action=viewtpc&page=$npage&sid=$sid&tid=$tid">Next»</a>
";
}
if($page>1){
$ppage = $page-1;
echo "<a href="index.php?action=viewtpc&page=$ppage&sid=$sid&tid=$tid">«Previous</a>";
}
echo "
Add reply:
<form action=\"genproc.php?action=post&sid=$sid\" method=\"post\">";
echo "<textarea id=\"inputText\" name=\"reptxt\"></textarea>
";
echo "
<input type="hidden" name="tid" value="$tid"/>
<input type="hidden" name="qut" value=""/>
<input id="inputButton" type="submit" value="Send"/>
</form>";
echo "
Page $page of $num_pages
";
$fid = $tinfo[5];
$fname = getfname($fid);
echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">Back To $fname Forum</a>
";
getfooter($sid);
}