<?php
// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// File ID: profile.php
// Shows a user profile, or a member list.
// **********************************************************************
// Wake the sleeping giant
// **********************************************************************
// Basic Configuration Info
// **********************************************************************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = "templates/default/forumtemp.html";
// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************
$links = getlinks();
// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************
$ads = getads("any");
// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// **********************************************************************
// End Prepwork - Output the page to the user
// **********************************************************************
// This page handles user profiles and shows the site members...
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msg = "
<table width='888px' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#F9AE00' class='ftable'>
<td>
<table width='888px' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#FECF61'>
<tr>
<td><center>You have a new message(s): <a href='messages.php'>Visit Message Center</a>(<b>".$num."</b>)<br></center></td>
</tr>
</table>
</table><br>";
}
$table = "".$msg."<br>".$article_content."";
$status2 = "".grabanysetting("status")."";
$reason2 = "".grabanysetting("reason")."";
if($status2 == "1") {
$article_content = "
<table>
<table width='100%' border='1'>
<tr>
<td width='100' align='center'><strong>Your Administrator has turned the board offline. If your administrator has listed a reason, it is given below:</strong></td>
</tr>
<tr>
<td width='100' align='center'><strong>".$reason2."</strong></td>
</tr></table></table><br>";
}
else {
$fid=$_GET['fid'];
$query = "SELECT * FROM forum_question WHERE fid='".$fid."' ORDER BY id DESC";
$result = mysql_query($query);
$num = mysql_numrows($result);
$id=@mysql_result($result,$i,"id");
$impid=@mysql_result($result,$i,"impid");
if($id == ""){
$not = "<tr><td class='trow' colspan='7'>There are currently no threads in this forum. If you would like to make a thread click the 'Create New Topic' button.</td></tr>";
}
if($impid == "1"){
$imp = "<td width='10%' align='center' class='tr'><strong>Important Thread</strong></td>";
}
else{
$imp = "<td width='10%' align='center' class='tr'><strong>Important Thread</strong></td>";
}
$query = "SELECT * FROM forum WHERE fid='".$fid."'";
$result = mysql_query($query);
$topic=@mysql_result($result,$i,"topic");
$group = getgroup();
$cancp = cancp($group);
if($cancp != "yes"){
}
else if($cancp == "yes"){
$tab = "<td width='10%' align='center' class='tr'><strong>Status</strong></td>";
}
$article_title = "<a href='main_forum2.php'>4U Forum</a> / ".$topic."";
$table = $table."
<table width='90%' border='0' align='center' cellpadding='3' cellspacing='1' class='ftable'>
<tr>
<td width='100%' class='thead'>".$topic."</td>
</tr>
</table>
<table width='90%' border='0' align='center' cellpadding='3' cellspacing='1' class='ftable'>
<tr>
<td width='43%' align='center' class='tr'><strong>Topic</strong></td>
".$imp."
<td width='15%' align='center' class='tr'><strong>Views</strong></td>
<td width='13%' align='center' class='tr'><strong>Replies</strong></td>
<td width='13%' align='center' class='tr'><strong>Date/Time</strong></td>
<td width='40%' class='tr' align='center'><strong>Last Post</strong></td>
".$tab."
</tr>
".$not."";
$fid=$_GET['fid'];
$query = "SELECT * FROM forum_question WHERE fid='".$fid."' ORDER BY id DESC";
$result = mysql_query($query);
$num = mysql_numrows($result);
while ($i < $num) {
$id=@mysql_result($result,$i,"id");
$impid=@mysql_result($result,$i,"impid");
$name=@mysql_result($result,$i,"name");
$topic=@mysql_result($result,$i,"topic");
$view=@mysql_result($result,$i,"view");
$reply=@mysql_result($result,$i,"reply");
$datetime=@mysql_result($result,$i,"datetime");
$status=@mysql_result($result,$i,"status");
$lby=@mysql_result($result,$i,"lby");
$ltopic=@mysql_result($result,$i,"ltopic");
$lname=@mysql_result($result,$i,"lname");
$ldatetime=@mysql_result($result,$i,"ldatetime");
$topic = stripslashes($topic);
$ltopic = stripslashes($ltopic);
$group = getgroup();
$cancp = cancp($group);
if($cancp != "yes"){
}
else if($cancp == "yes"){
$tab2 = "<td align='center' class='trow'>".$status."</td>";
}
if($status == "Open"){
$tname = "".$topic."";
}
else if($status == "Locked"){
$tname = "<s>".$topic."</s>";
}
if($impid == "1"){
$imp2 = "<td align='center' bgcolor='#FECF61'>Important Thread</td>";
}
else{
$imp2 = "<td align='center' class='trow'>Normal Thread</td>";
}
if($ltopic == ""){
$lpost = "<i>Never</i>";
}
else{
$lpost = "".$ldatetime."<br>by: <a href='profile2.php?user=".$lby."'>".$lby."</a>";
}
$table = $table."
<tr>
<td class='trow'><a href='view_topic.php?id=".$id."'>".$tname."</a><BR><strong>Created by:</strong><a href='profile2.php?user=".$name."'>".$name."</a></td>
".$imp2."
<td align='center' class='trow'>".$view."</td>
<td align='center' class='trow'>".$reply."</td>
<td align='center' class='trow'>".$datetime."</td>
<td align='center' class='trow'>".$lpost."</td>
".$tab2."
</tr>
";
$i++;
}
if($isloggedin == "yes"){
$create = "<a href='create_topic.php?fid=".$fid."'><strong>Create New Topic</strong> </a>";
}
else{
$create = "<br>";
}
$table = $table."
<tr>
<td colspan='7' align='right' class='tr'><a href='accountpost.php?act=changesettings&more=".$fid."'>Subscribe to this Forum</a> | ".$create."</td>
</tr></table>
";
}
// **********************************************************************
// Begin Template Definition
// **********************************************************************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':TABLE:',$table,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);
//Define our links
$template = replace(':LINKSBAR:',$links,$template);
//Get the content for the side bar...
$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);
//Get the ad content...
$template = replace(':ADS:',$ads,$template);
//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);
echo $template;
// **********************************************************************
// End Template Definition
// **********************************************************************
?>