Location: PHPKode > projects > Promisance Enhanced > 2.2/forums.php
<?php
	include("header.php");

	if (checklevel($users[disabled]) == 2)
		TheEnd("<font size=4>Sorry, You are suspended from the forums!</font>");

	//to display the thread
	if($thread_id)
	{
		echo("<form name=edit method=post action=$config[main]?action=editPost>");
		echo("<p> <table width=95% class=forum><tr><th width=20%>Author<th>Thread</tr>");
		$query=loadThreadData($thread_id);
		while($row=mysql_fetch_array($query))
		{

			$content=parseText($row[content]);
			$title=getTitle(getCheckLevel($row[author]));

			echo("<tr><td></br>$row[author]</br>");
			echo("<i>$title</i></br>");
			echo("<td>$content</tr><tr><td><span class=small> Posted on: $row[added] </span><td> ");

			if(checklevel($users[disabled])>4)
				echo("<div align=right><a class=javalink onclick=editPost($row[thread_id]) >Edit this post</a></div>");

			$forum_id=$row[forum_id];
		}
		echo("</table>");
		echo("<input type=hidden value=0 name=thread_id><input type=hidden name=clan value=0>");
		echo("</form>");
		echo("<form method=post action=$config[main]?action=newthread><input type=hidden name=forum_id value=$forum_id><input type=hidden name=parent_id value=$thread_id><input type=submit name=submit value=\"Post A Reply\"></form></br>");
		echo("<a href=$config[main]?action=forums>Back to forums</a>");
	}
	//display massages within a category
	else if ($forum_id)
	{

		$query=loadForumData($forum_id);
		$query2=forumsData($forum_id);
		$info=mysql_fetch_array($query2);
		if($info[mod]==1)
		{
			if(checklevel($users[disabled])<4)
			{
				echo("Only administrator are allowed to view this board</br>");
				echo("<a href=$config[main]?action=forums>Back to forums</a>");
				$allowed=0;
			}

			else
			{
				$allowed=1;
			}
		}
		else
			$allowed=1;
		if($allowed==1)
		{
			echo("<form name=thread method=post action=$config[main]?action=forums>");
			echo("<font size=4>$info[forum_name]</font>");
			echo("<table width=95% class=forum><tr><th>Thread<th width=20% >Author</th><th width=5%%>Replies</th><th width=30% >Last Posted On</th></tr>");
			while($thread=mysql_fetch_array($query))
			{
			$replies=getReplies($thread[thread_id]);
			$poster=getLastPoster($thread[thread_id],0);
		    echo("<tr><td><a class=javalink onclick=view($thread[thread_id])>$thread[title]</a><td align=center>$thread[author]<td>$replies<td>$thread[modified] by $poster</td></tr>");
			}
			echo("<input type=hidden name=thread_id value=0>");
			echo("</table></form>");
			echo("<form method=post action=$config[main]?action=newthread><input type=hidden name=forum_id value=$forum_id><input type=hidden name=parent_id value=0><input type=submit name=submit align=right value=\"New Thread\"></br></form>");
			echo("<a href=$config[main]?action=forums>Back to forums</a>");
		}
	}
	//dispaly the all categories
	else
	{


		$query=loadAllForums();
		echo("<form name=forum method=post action=$config[main]?action=forums>");
		echo("<table width=95% class=forum><tr><th>Forum Name<th>Thread<th>Post</tr>");
		while($category=mysql_fetch_array($query))
		{
			$thread=getThread($category[forum_id]);
			$post=getPost($category[forum_id]);
			echo("<tr><td><a class=javalink onclick=enter($category[forum_id])>$category[forum_name]</a></br>$category[notes]<td>$thread Thread<td>$post Post");
		}
		echo("<input type=hidden value=0 name=forum_id>");
//		echo("<tr><td colspan><a href=$config[main]?action=ClanForum>Clan Forum</a></br>Your own little private clan forums<td>n/a<td>n/a");
		echo("</table></form>");
	}
	if(checklevel($users[disabled])>5)
	{
		echo("</br><a href=$config[main]?action=forumsAdmin>Forum Administration</a>");
	}

?>

<!--i used a java workaround since if i send a get function promisance.php will try to open the "file + the variable sent".php -->
<script language="JavaScript">
function editPost(x)
{
	document.edit.thread_id.value=x;
	document.edit.submit();
}

function view(x)
{
	document.thread.thread_id.value=x;
	document.thread.submit();

}
function enter(x)
{
	document.forum.forum_id.value=x;
	document.forum.submit();
}
</script>
Return current item: Promisance Enhanced