<?php

#############################################################################
#                              WIZZ FORUM
#  Wizz Forum is a KISS Forum: Keep It Small and Simple.
#
# About the Wizz Forum:
# Original Idea & PHP coding: Mike Kroger (mikek@icon.co.za),
# who granted permission to put Wizz forum uder the GNU GPL.  
# Code adaptations and modularization for Site@School:
# Fred Stuurman (fc.stuurman@hccnet.nl)
############################################################################
# forumauthdetails.php: last changed 05/10/2006  version 2.4.10
#                       by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: forumauthdetails.php,v 1.2 2006/10/15 19:08:53 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
# Copyright (C) 2006, Rosa Boekdrukker Primary School, Holland.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
##############################################################################
if (!defined('IN_SAS'))
{
	die("Hacking attempt");
}

if (IsSet ($_GET[forumid]))
{
	$forumid = intval($_GET[forumid]);
}
if (IsSet ($_GET[authid]))
{
	$authid = $_GET[authid];
}

setlocale(LC_ALL, '$sas_lang[forum_locale]');

$result = mysql_query("SELECT * FROM $forumuser_table WHERE username = '$authid'");
if ($row = mysql_fetch_array($result))
{
	print "<p><table cellspacing=\"0\" cellpadding=\"0\"><tr height=\"25\">
	<td background=\"$cmsdir/modules/sn_forum/left.gif\" width=\"10\">&nbsp;</td>
	<td background=\"$cmsdir/modules/sn_forum/middle.gif\" align=\"center\">
	<a href='index.php?section=$section&page=$page&option=forum&forumid=$forumid'><b>$sas_lang[forum_main_page]</b></a></td>
	<td background=\"$cmsdir/modules/sn_forum/right.gif\" width=\"10\">&nbsp;</td>
	</tr></table></p>";
	print "<table border='0' cellpadding='2' cellspacing='0' width='100%'>";
	print "<tr>";
	print "<td width='100%' bgcolor='$TitleBackgroundColor'><font face='Arial' size='4'>$sas_lang[forum_stats] $row[userid]</font></td>";
	print "</tr>";
	print "</table>";
	print "<center>";
	print "<p><table border='1' cellpadding='0' cellspacing='0' width='80%' bordercolor='" . $sas_lang[forum_bordercolor] . "'>";
	print "<tr>";
	print "<td width='100%'>";
	print "<table border='0' cellpadding='3' cellspacing='0' width='100%'>";
	print "<tr>";
	print "<td width='50%' align='right' bgcolor='$OddBackgroundColor'><font face='Arial' size='2'>$sas_lang[forum_userid]</font></td>";
	print "<td width='50%' bgcolor='" . $OddBackgroundColor . "'><font face='Arial' size='2'><b>" . $row["username"] . "</b></font></td>";
	print "</tr>";
	print "<tr>";
	print "<td width='50%' align='right' bgcolor='$EvenBackgroundColor'><font face='Arial' size='2'>$sas_lang[forum_firstname]</font></td>";
	print "<td width='50%' bgcolor='" . $EvenBackgroundColor . "'><font face='Arial' size='2'>" . $row["firstname"] . "</font></td>";
	print "</tr>";
	print "<tr>";
	print "<td width='50%' align='right' bgcolor='$OddBackgroundColor'>
	                  <font face='Arial' size='2'>$sas_lang[forum_name]</font></td>";
	print "<td width='50%' bgcolor='" . $OddBackgroundColor . "'><font face='Arial' size='2'>" . $row["surname"] . "</font></td>";
	print "</tr>";
	$bgColor = $EvenBackgroundColor;
	if ($row["showemail"] == 1)
	{
		print "<tr>";
		print "<td width='50%' align='right' bgcolor='$bgColor'>
		                      <font face='Arial' size='2'>$sas_lang[forum_email]</font></td>";
		print "<td width='50%' bgcolor='$bgColor'><font face='Arial' size='2'>
		                <a href = 'mailto:" . $row["email"] . "'>" . $row["email"] . "</a></font></td>";
		print "</tr>";
		$bgColor = $OddBackgroundColor;
	}
	print "<tr>";
	print "<td width='50%' align='right' bgcolor='$bgColor'>
	                  <font face='Arial' size='2'>$sas_lang[forum_joined_date]</font></td>";
	$ts = mktime(substr($row["joindate"], 11, 2), substr($row["joindate"], 14, 2), substr($row["joindate"], 17, 2), substr($row["joindate"], 5, 2), substr($row["joindate"], 8, 2), substr($row["joindate"], 0, 4));
	print "<td width='50%' bgcolor='" . $bgColor . "'><font face='Arial' size='2'>" . strftime("%A %d %B %Y, %H:%M:%S", $ts) . "</font></td>";
	print "</tr>";
	if ($bgColor == $EvenBackgroundColor)
	{
		$bgColor = $OddBackgroundColor;
	}
	else
	{
		$bgColor = $EvenBackgroundColor;
	}
	print "<tr>";
	print "<td width='50%' align='right' bgcolor='$bgColor'>
	                  <font face='Arial' size='2'>$sas_lang[forum_login_date]</font></td>";
	$ts = mktime(substr($row["lastlogin"], 11, 2), substr($row["lastlogin"], 14, 2), substr($row["lastlogin"], 17, 2), substr($row["lastlogin"], 5, 2), substr($row["lastlogin"], 8, 2), substr($row["lastlogin"], 0, 4));
	print "<td width='50%' bgcolor='" . $bgColor . "'><font face='Arial' size='2'>" . strftime("%A %d %B %Y, %H:%M:%S", $ts) . "</font></td>";
	print "</tr>";
	if ($bgColor == $EvenBackgroundColor)
	{
		$bgColor = $OddBackgroundColor;
	}
	else
	{
		$bgColor = $EvenBackgroundColor;
	}
	print "<tr>";
	print "<td width='50%' align='right' bgcolor='$bgColor'>
	                  <font face='Arial' size='2'>$sas_lang[forum_contribution_date]</font></td>";
	if ($row["lastcontribution"] == NULL)
	{
		print "<td width='50%' bgcolor='" . $bgColor . "'><font face='Arial' size='2'>&nbsp;</font></td>";
	}
	else
	{
		$ts = mktime(substr($row["lastcontribution"], 11, 2), substr($row["lastcontribution"], 14, 2), substr($row["lastcontribution"], 17, 2), substr($row["lastcontribution"], 5, 2), substr($row["lastcontribution"], 8, 2), substr($row["lastcontribution"], 0, 4));
		print "<td width='50%' bgcolor='" . $bgColor . "'><font face='Arial' size='2'>" . strftime("%A %d %B %Y,%H:%M:%S", $ts) . "</font></td>";
	}
	print "</tr>";
	if ($bgColor == $EvenBackgroundColor)
	{
		$bgColor = $OddBackgroundColor;
	}
	else
	{
		$bgColor = $EvenBackgroundColor;
	}
	print "<tr>";
	print "<td width='50%' align='right' bgcolor='$bgColor'>
	                  <font face='Arial' size='2'>$sas_lang[forum_topic_posted]</font></td>";
	print "<td width='50%' bgcolor='" . $bgColor . "'>
	                  <font face='Arial' size='2'>" . $row["topics"] . "</font></td>";
	print "</tr>";
	if ($bgColor == $EvenBackgroundColor)
	{
		$bgColor = $OddBackgroundColor;
	}
	else
	{
		$bgColor = $EvenBackgroundColor;
	}
	print "<tr>";
	print "<td width='50%' align='right' bgcolor='$bgColor'>
	                  <font face='Arial' size='2'>$sas_lang[forum_topic_replies]</font></td>";
	print "<td width='50%' bgcolor='" . $bgColor . "'>
	                  <font face='Arial' size='2'>" . $row["replies"] . "</font></td>";
	print "</tr>";
	print "</table>";
	print "</td></tr>";
	print "</table></p>";
	print "</center>";
	$result = mysql_query("Select * from $forumtopics_table where userid='" . $authid . "'");
	if (mysql_num_rows($result) != 0)
	{
		print "<center><table border='0' cellpadding='2' cellspacing='0' width='100%'>";
		print "<tr>";
		print "<td width='100%' bgcolor='" . $TitleBackgroundColor . "'>
		                      <font face='Arial' size='4'>$sas_lang[forum_posted_by] $authid</font></td>";
		print "</tr>";
		print "</table>";
		print "<p><table border='1' cellpadding='2' cellspacing='0' width='80%' bordercolor='" . $sas_lang[forum_bordercolor] . "'>";
		print "<tr>";
		print "<td width='80%' bgcolor='" . $SubtitleBackgroundColor . "'>
		                      <font face='Arial' size='3' color='$forum_header_font_colour'><b>$sas_lang[forum_topic]</b></font></td>";
		print "<td width='10%' bgcolor='" . $SubtitleBackgroundColor . "'>
		                      <font face='Arial' size='3' color='$forum_header_font_colour'><b>$sas_lang[forum_replies]</b></font></td>";
		print "<td width='10%' bgcolor='" . $SubtitleBackgroundColor . "'>
		                      <font face='Arial' size='3' color='$forum_header_font_colour'><b>$sas_lang[forum_read]</b></font></td>";
		print "</tr>";
		$bgColor = $OddBackgroundColor;
		while ($row = mysql_fetch_array($result))
		{
			print "<tr>";
			print "<td width='80%' bgcolor='" . $bgColor . "'><font face='Arial' size='2'><ahref='index.php?page=" . $page . "&section=" . $section . "&option=topicdetails&topicid=" . $row["topic_index"] . "&forumid=" . $forumid . "'>" . $row["topictitle"] . "</a></font></td>";
			print "<td width='10%' bgcolor='$bgColor'><font face='Arial' size='2'>" . $row["replies"] . "</font></td>";
			print "<td width='10%' bgcolor='$bgColor'><font face='Arial' size='2'>" . $row["topic_reads"] . "</font></td>";
			print "</tr>";
			if ($bgColor == $OddBackgroundColor)
			{
				$bgColor = $EvenBackgroundColor;
			}
			else
			{
				$bgColor = $OddBackgroundColor;
			}
		}
		print "</table></center></p>";
	}
	print "<p><table cellspacing=\"0\" cellpadding=\"0\"><tr height=\"25\">
	<td background=\"$cmsdir/modules/sn_forum/left.gif\" width=\"10\">&nbsp;</td>
	<td background=\"$cmsdir/modules/sn_forum/middle.gif\" align=\"center\">
	<a href='index.php?section=$section&page=$page&option=forum&forumid=$forumid'><b>$sas_lang[forum_main_page]</b></a></td>
	<td background=\"$cmsdir/modules/sn_forum/right.gif\" width=\"10\">&nbsp;</td>
	</tr></table></p>";

}
else
{
	print "<table border='0' cellpadding='2' cellspacing='0' width='100%'>";
	print "<tr>";
	print "<td width='100%' bgcolor='" . $TitleBackgroundColor . "'><font face='Arial' size='4'>Error</font></td>";
	print "</tr>";
	print "</table>";
	print "<p><font face='Arial' size='2'>A database error occured while trying to read your forum stats.</font>";
	print "<font face='Arial' size='2'><br><A HREF=JavaScript:history.back()>$sas_lang[forum_back]</a></font></p>";
}
?>
