<script type="text/javascript">

function View(color) {                  // preview color
  document.getElementById("ColorPreview").style.backgroundColor = '#' + color;
  document.getElementById("ColorHex").value = '#' + color;
}

function Set(string) {                   // select color
  var color = ValidateColor(string);
  if (color == null) { alert("Invalid color code: " + string); }        // invalid color
  else {                                                                // valid color
    View(color);                          // show selected color
    __dlg_close(color);
  }
}

</script>
<?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)
############################################################################
# admin.php: last changed 02/02/2004 version 1.4                                        
#                  by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: admin.php,v 1.2 2006/10/15 19:08:54 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
# Copyright (C) 2002, 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 ($_POST['welcometext']))
{
	$welcometext = sql_addslashes($_POST['welcometext']);
}
if (IsSet ($_POST['topictitle']))
{
	$topictitle = $_POST['topictitle'];
}
if (IsSet ($_POST['topicdetail']))
{
	$topicdetail = $_POST['topicdetail'];
}
if (IsSet ($_POST['replydetail']))
{
	$replydetail = $_POST['replydetail'];
}
if (IsSet ($_POST['replyid']))
{
	$replyid = $_POST['replyid'];
}
if (IsSet ($_POST['topicid']))
{
	$topicid = $_POST['topicid'];
}
if (IsSet ($_POST['name']))
{
	$name = $_POST['name'];
}
if (IsSet ($_POST['email']))
{
	$email = $_POST['email'];
}
if (IsSet ($_POST['forumtype']))
{
	$forumtype = $_POST['forumtype'];
}
if (IsSet ($_POST['forumadd']))
{
	$forumadd = $_POST['forumadd'];
}
if (IsSet ($_POST[changeforum]))
{
	$changeforum = $_POST['changeforum'];
}
if (IsSet ($_POST['MaxTopicBody']))
{
	$MaxTopicBody = $_POST['MaxTopicBody'];
}
if (IsSet ($_POST['MaxReplyBody']))
{
	$MaxReplyBody = $_POST['MaxReplyBody'];
}
if (IsSet ($_POST['EvenBackgroundColor']))
{
	$EvenBackgroundColor = $_POST['EvenBackgroundColor'];
}
if (IsSet ($_POST['OddBackgroundColor']))
{
	$OddBackgroundColor = $_POST['OddBackgroundColor'];
}
if (IsSet ($_POST['SubtitleBackgroundColor']))
{
	$SubtitleBackgroundColor = $_POST['SubtitleBackgroundColor'];
}
if (IsSet ($_POST['HeaderFontColor']))
{
	$HeaderFontColor = $_POST['HeaderFontColor'];
}
if (IsSet ($_GET['deleteforum']))
{
	$deleteforum = $_GET['deleteforum'];
}
if (IsSet ($_GET['changeforum']))
{
	$changeforum = $_GET['changeforum'];
}
if (IsSet ($_GET['deleteuserid']))
{
	$deleteuserid = $_GET['deleteuserid'];
}
if (IsSet ($_GET['deletetopic']))
{
	$deletetopic = $_GET['deletetopic'];
}
if (IsSet ($_GET['deletereply']))
{
	$deletereply = $_GET['deletereply'];
}
if (IsSet ($_GET['type']))
{
	$type = $_GET['type'];
}
if (IsSet ($_GET['modifyid']))
{
	$modifyid = $_GET['modifyid'];
}
if (IsSet ($_GET['replyid']))
{
	$replyid = $_GET['replyid'];
}
if (IsSet ($_GET['topicid']))
{
	$topicid = $_GET['topicid'];
}
if (IsSet ($_GET['modifyreply']))
{
	$modifyreply = $_GET['modifyreply'];
}


include ("interface/header.inc.php");
include ("interface/menubar.inc.php");
include ("interface/menustart.inc.php");

load_language('', 'sn_forum'); //load language file

print "<span class=heading>Menu</span><br><br>";
print "<span class=link>
       <a href=index.php?option=modulemanager&module=$module&modoption=listuser>$sas_lang[forum_list_users]</a><br><br>
       <a href=index.php?option=modulemanager&module=$module&modoption=modifytopic&type=2>$sas_lang[forum_modify_topic]</a><br><br>
       <a href=index.php?option=modulemanager&module=$module&modoption=modifyreply&type=2>$sas_lang[forum_modify_reply]</a><br><br>
       <a href=index.php?option=modulemanager&module=$module&modoption=modifyforums>$sas_lang[forum_change_forums]</a><br><br>
       <a href=index.php?option=modulemanager&module=$module&modoption=config>$sas_lang[configuration]</a><br><br>
       </span>";
include ("interface/menuend.inc.php");
include ("interface/pagestart.inc.php");

$query = "SELECT name FROM $table_modules WHERE id=$module";
$result = mysql_query($query) or die_script($query, mysql_error());
$modulename = mysql_result($result, 0);
unset ($query);
unset ($result);

$query = "SELECT dbtables FROM $table_modules WHERE location='sn_forum'"; //get the forum table names    
$result = mysql_query($query) or die_script($query, mysql_error());
$moduletables = mysql_result($result, 0);
unset ($query);
unset ($result);
$moduletables = explode(",", $moduletables);
$forumuser_table = "$moduletables[0]";
$forumtopics_table = "$moduletables[1]";
$forumreplies_table = "$moduletables[2]";
$forumcat_table = "$moduletables[3]";

if (IsSet ($deleteuserid))
{
	mysql_query("DELETE FROM $forumuser_table WHERE user_index='$deleteuserid'");
}

if (IsSet ($deleteforum))
{
	mysql_query("DELETE FROM $forumcat_table WHERE cat_index='$deleteforum'");
	mysql_query("DELETE FROM $forumtopics_table WHERE cat_index='$deleteforum'");
	mysql_query("DELETE FROM $forumreplies_table WHERE cat_index='$deleteforum'");

}

if ($modoption == "saveconfig")
{
	mysql_query("UPDATE $table_configuration SET config_value='$MaxTopicBody' WHERE config_key='forum_max_topic_char'");
	mysql_query("UPDATE $table_configuration SET config_value='$MaxReplyBody' WHERE config_key='forum_max_reply_char'");
	mysql_query("UPDATE $table_configuration SET config_value='$EvenBackgroundColor' WHERE config_key='forum_even_background_color'");
	mysql_query("UPDATE $table_configuration SET config_value='$OddBackgroundColor' WHERE config_key='forum_odd_background_color'");
	mysql_query("UPDATE $table_configuration SET config_value='$SubtitleBackgroundColor' WHERE config_key='forum_subtitle_background_color'");
	mysql_query("UPDATE $table_configuration SET config_value='$HeaderFontColor' WHERE config_key='forum_header_font_color'");
	mysql_query("UPDATE $table_configuration SET config_value='$welcometext' WHERE config_key='forum_welcome_text'");
	$sas_config['forum_max_topic_char'] = $MaxTopicBody;
	$sas_config['forum_max_reply_char'] = $MaxReplyBody;
	$sas_config['forum_odd_background_color'] = $OddBackgroundColor;
	$sas_config['forum_even_background_color'] = $EvenBackgroundColor;
	$sas_config['forum_subtitle_background_color'] = $SubtitleBackgroundColor;
	$sas_config['forum_header_font_color'] = $HeaderFontColor;
	$sas_config['forum_welcome_text'] = $welcometext;
	$modoption = "config"; // switch to viewing the config
}

if ($modoption == "savetopic")
{
	mysql_query("Update $forumtopics_table set topictitle='$topictitle', topicbody='$topicdetail' WHERE topic_index='$topicid'");
	$modoption = "modifytopic"; // switch to viewing the topics
}

if ($modoption == "savereply")
{
	mysql_query("UPDATE $forumreplies_table SET replybody='$replydetail' WHERE reply_index='$replyid'");
	$modoption = "modifyreply"; // switch to viewing the replies
}

if ($modoption == "saveforum")
{
	mysql_query("UPDATE $forumcat_table SET name='$name', type='$forumtype', email='$email' WHERE cat_index='$changeforum'");
	$modoption = "modifyforums";
	unset ($changeforum);
}

if (IsSet ($forumadd))
{
	mysql_query("Insert into $forumcat_table VALUES (NULL, '$name', '$forumtype', '$email') ");
}

if (IsSet ($deletetopic))
{
	mysql_query("DELETE FROM $forumtopics_table WHERE topic_index='$deletetopic'");
	mysql_query("DELETE FROM $forumreplies_table WHERE topicindex='$deletetopic'");
}

if (IsSet ($deletereply))
{
	mysql_query("DELETE FROM $forumreplies_table WHERE reply_index='" . $deletereply . "'");
	$ins_str = "Select replies FROM $forumtopics_table WHERE topic_index=" . $topicid;
	$result = mysql_query($ins_str);
	$row = mysql_fetch_array($result);
	$newval = $row["replies"];
	$newval--;
	$ins_str = "Update $forumtopics_table set replies=" . $newval . " WHERE topic_index=" . $topicid;
	mysql_query($ins_str);
}

if (IsSet ($modifyid))
{
	$result = mysql_query("SELECT * FROM $forumtopics_table WHERE topic_index = '$modifyid'");
	$row = mysql_fetch_array($result);
	print "<span class=\"heading\">$sas_lang[forum_modify_topic]</span>
		        <br><br>
		        <form method='POST' action='index.php?option=modulemanager&module=$module&modoption=savetopic'>
		        <input type='hidden' name='topicid' value='$modifyid'>
		        <table border='0' cellpadding='0' cellspacing='0' width='80%'>
		        <tr>
		        <td width='100%'>
		        <table border='0' cellpadding='3' cellspacing='0' width='100%'>
		        <tr>
		        <td width='50%'>
		        <span class=\"text\">$sas_lang[forum_topic_title]</span>
		        <input tabindex='1' type='text' name='topictitle' size='50' value='$row[topictitle]'><br><br></td>
		        </tr>
		        <tr>
		        <td width='100%' colspan='2'><span class=\"text\">$sas_lang[forum_text]:</span><br>
		        <textarea tabindex='2' WRAP='VIRTUAL' rows='15' name='topicdetail' cols='80'>$row[topicbody]</textarea><br>
		        </span></td>
		        </tr>
		        <tr>
		        <td width='100%' align='center' colspan='2'>
		        <input tabindex='3' type='submit' value='$sas_lang[forum_send]' name='B1'></td>
		        </tr>
		        </table>
		        </td></tr>
		        </table>
		        </form>";
	exit;
}

if (IsSet ($changeforum))
{

	$result = mysql_query("SELECT * FROM $forumcat_table WHERE cat_index = '$changeforum'");
	$row = mysql_fetch_array($result);
	print "<span class=\"heading\">$sas_lang[forum_modify]</span><br><br>
		        <form method='POST' action='index.php?option=modulemanager&module=$module&modoption=saveforum'>
		        <input type='hidden' name='changeforum' value='$changeforum'>
		        <span class=\"text\">$sas_lang[forum_header] </span><br>
		        <input tabindex='1' type='text' class=\"textfield\" name='name' size='50' value='$row[name]'><br><br>
		        <span class=\"text\">$sas_lang[forum_type] </span><br>
		        <input tabindex='2' type='text' class=\"textfield\" name='forumtype' size='1' value='$row[type]'><br>
		        <span class=\"text\">1 = $sas_lang[forum_type1]<br>
		        2 = $sas_lang[forum_type2]<br>
		        3 = $sas_lang[forum_type3]</span><br><br>
		        <span class=\"text\">$sas_lang[forum_email] </span><br>
		        <input tabindex='3' type='text' class=\"textfield\" name='email' size='100' value='$row[email]'><br><br>
		        <input tabindex='4' type='submit' value='$sas_lang[forum_send]' name='B1'>
		        </form>";
	exit;
}

if ($modoption == "addforum")
{
	print "<span class=\"heading\">$sas_lang[forum_add_forum]</span><br><br>
		        <form method='POST' action='index.php?option=modulemanager&module=$module&modoption=modifyforums'>
		        <span class=\"text\">$sas_lang[forum_header] </span><br>
		        <input type='hidden' name='forumadd' value='forumadd'>
		        <input tabindex='1' type='text' class=\"textfield\" name='name' size='50'><br><br>
		        <span class=\"text\">$sas_lang[forum_type] </span><br>
		        <input tabindex='2' type='text' class=\"textfield\" name='forumtype' size='1'><br>        
		        <span class=\"text\">
		        1 = $sas_lang[forum_type1]<br>
		        2 = $sas_lang[forum_type2]<br>
		        3 = $sas_lang[forum_type3]</span><br><br>
		        <span class=\"text\">$sas_lang[forum_email] </span><br>
		        <input tabindex='3' type='text' class=\"textfield\" name='email' size='100'><br><br>
		        <input tabindex='3' type='submit' value='$sas_lang[forum_send]' name='B1'>
		        </form>";
	exit;
}

if (IsSet ($modifyreply))
{
	$result = mysql_query("SELECT * FROM $forumreplies_table WHERE reply_index = '$replyid'");
	$row = mysql_fetch_array($result);
	print "<span class=\"heading\">$sas_lang[forum_modify_reply]</span><br><br>
		        <form method='POST' action='index.php?option=modulemanager&module=$module&modoption=savereply'>
		        <input type='hidden' name='replyid' value='$replyid'>
		        <table border='0' cellpadding='0' cellspacing='0' width='80%'>
		        <tr>
		        <td width='100%'>
		        <table border='0' cellpadding='3' cellspacing='0' width='100%'>
		        <tr>
		        <td width='100%' colspan='2'>
		        <span class=\"text\">$sas_lang[forum_reply]: </span><br>
		        <textarea tabindex='1' WRAP='VIRTUAL' rows='15' name='replydetail' cols='80'>$row[replybody]</textarea><br>
		        </span></td>
		        </tr>
		        <tr>
		        <td width='100%' align='center' colspan='2'><input tabindex='2' type='submit' value='$sas_lang[forum_send]' name='B1'></td>
		        </tr>
		        </table>
		        </td></tr>
		        </table>
		        </form>";
	exit;
}

print "<span class=\"heading\">$modulename</span><p>";
if ($modoption == "")
{
	$modoption = "listuser"; // default when no modoption is given
}

if ($modoption == "modifyforums")
{
	$result = mysql_query("SELECT * FROM $forumcat_table");
	print "<form method='POST' action='index.php?option=modulemanager&module=$module&modoption=addforum'>
		       <table border='1' cellpadding='2' cellspacing='0' width='100%'>
		       <tr><td width='100%' colspan='6'>
		       <font face='Arial' size='4'>$sas_lang[forum_change_forums]:</font></td></tr>
		       <tr height='40' bgcolor='#638ABD'> 
		       <td >
		       <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_action]</b><br></font></td>
		       <td>
		       <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_header]</b><br></font></td>
		       <td>
		       <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_topics]:</b><br></font></td>
		       <td>
		       <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_date_last_update]</b></font></td>
		       <td>
		       <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_type]</b></font></td>
		       </tr>";
	$bgColor = $OddBackgroundColor;
	while ($row = mysql_fetch_array($result))
	{
		$result2 = mysql_query("Select count(*) FROM $forumtopics_table WHERE cat_index = $row[cat_index]");
		if (mysql_num_rows($result2) > 0) //get the number of topics 
		{
			$reccount = mysql_result($result2, 0);
		}
		$result3 = mysql_query("Select date FROM $forumtopics_table WHERE cat_index = $row[cat_index] order by date desc");
		if (mysql_num_rows($result3) > 0) //get the last update date 
		{
			$lastdate = mysql_result($result3, 0);
		}
		else
		{
			$lastdate = "";
		}

		print "<tr>
				             <td  height='30' bgcolor='$bgColor'><span class=\"text\"><a href='index.php?option=modulemanager&module=$module&modoption=modifyforums&deleteforum=$row[cat_index]' onCLick=\"return confirm('$sas_lang[forum_delete_question]')\">$sas_lang[forum_delete]</a> 
				             <a href='index.php?option=modulemanager&module=$module&modoption=modifyforums&changeforum=$row[cat_index]'>$sas_lang[forum_modify]</a></span></td>
				             <td  height='30' bgcolor='$bgColor'><font face='Arial' size='2'>
				             <b>$row[name]</b></font>
				             <td bgcolor='$bgColor'><font face='Arial' size='2'>$reccount</font></td>
				             <td bgcolor='$bgColor'><font face='Arial' size='2'>$lastdate&nbsp;</td>";
		if ($row[type] == "1")
		{
			$forum_type = $sas_lang[forum_type1];
		}
		if ($row[type] == "2")
		{
			$forum_type = $sas_lang[forum_type2];
		}
		if ($row[type] == "3")
		{
			$forum_type = $sas_lang[forum_type3];
		}

		print "<td bgcolor='$bgColor'><font face='Arial' size='2'>$forum_type</td></tr>";
		if ($bgColor == "#DEE3EF")
		{
			$bgColor = "#FFFFFF";
		}
		else
		{
			$bgColor = $OddBackgroundColor;
		}
	}

	print "</table><br><input type='submit' value='$sas_lang[forum_add_forum]' name='B1'></form>";

}

if ($modoption == "config")
{
	$MaxTopicBody = $sas_config['forum_max_topic_char'];
	$MaxReplyBody = $sas_config['forum_max_reply_char'];
	$OddBackgroundColor = $sas_config['forum_odd_background_color'];
	$EvenBackgroundColor = $sas_config['forum_even_background_color'];
	$SubtitleBackgroundColor = $sas_config['forum_subtitle_background_color'];
	$HeaderFontColor = $sas_config['forum_header_font_color'];
	$welcometext = $sas_config['forum_welcome_text'] ;

	print "<font face='Arial' size='4'>$sas_lang[configuration]<br></font><br>
		       <table border=\"0\">
		       <form method='POST' action='index.php?option=modulemanager&module=$module&modoption=saveconfig'>
		       <tr><td>$sas_lang[forum_subtitle_background_color]: </td>
		       <td><input tabindex=\"1\" type=text size=8 class=\"textfield\" name=\"SubtitleBackgroundColor\" value=\"$SubtitleBackgroundColor\"></td>
		       <td width=\"50\"><table bgcolor=\"$SubtitleBackgroundColor\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"1\"><tr><td>&nbsp;</td></tr></table></td>
		       <td rowspan=\"6\">";
	include ("interface/color_table.html");
	print "</td></tr>
		        <tr><td>$sas_lang[forum_odd_background_color]: </td>
		        <td><input tabindex=\"2\" type=text size=8 class=\"textfield\" name=\"OddBackgroundColor\" value=\"$OddBackgroundColor\"></td>
		        <td width=\"50\"><table bgcolor=\"$OddBackgroundColor\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"1\"><tr><td>&nbsp;</td></tr></table></td></tr>
		        <tr><td>$sas_lang[forum_even_background_color]: </td>
		        <td><input tabindex=\"3\" type=text size=8 class=\"textfield\" name=\"EvenBackgroundColor\" value=\"$EvenBackgroundColor\"></td>
		        <td width=\"50\"><table bgcolor=\"$EvenBackgroundColor\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"1\"><tr><td>&nbsp;</td></tr></table></td></tr>
		        <tr><td>$sas_lang[forum_header_font_color]: </td>
		        <td><input tabindex=\"4\" type=text size=8 class=\"textfield\" name=\"HeaderFontColor\" value=\"$HeaderFontColor\"></td>
		        <td width=\"50\"><table bgcolor=\"$HeaderFontColor\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"1\"><tr><td>&nbsp;</td></tr></table></td></tr>       
		        <tr><td>$sas_lang[forum_max_topic_char]: </td>
		        <td><input tabindex=\"5\" type=text size=8 class=\"textfield\" name=\"MaxTopicBody\" value=\"$MaxTopicBody\"></td>
		        <td>&nbsp;</td></tr>
		        <tr><td>$sas_lang[forum_max_reply_char]: </td>
		        <td><input tabindex=\"6\" type=text size=8 class=\"textfield\" name=\"MaxReplyBody\" value=\"$MaxReplyBody\"></td>
		        <td>&nbsp;</td></tr>  
		        </table>";
print "<br><br><b>".$sas_lang['forum_head_text']."</b><br><textarea cols=\"70\" rows=\"3\" name=\"welcometext\">".$welcometext."</textarea><br><br>\n";

print "<br><br>&nbsp;<input tabindex=\"6\" type=\"submit\" value=\"&nbsp;&nbsp;&nbsp;$sas_lang[save]\" name=\"savebutton\" class=\"savebutton\">
        </form>";
}

if ($modoption == "listuser")
{
	$result = mysql_query("SELECT * FROM $forumuser_table ORDER BY username");
	print "<table border='1' cellpadding='2' cellspacing='0' width='100%'>
		               <tr>
		               <td width='100%' colspan='7'>
		               <font face='Arial' size='4'>$sas_lang[forum_list_users]:</font></td>
		               </tr>";
	if (mysql_num_rows($result) == 0)
	{
		print "<tr>
				                   <td width='100%' colspan='6' bgcolor='#DEE3EF'>
				                   <span class=\"text\">" . $sas_lang['forum_no_users'] . "</span></td>
				                   </tr>";
	}
	else
	{
		print "<tr bgcolor='#638ABD'>
				                   <td>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_action]</b></font></td>
				                   <td>            
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>Forum:</b></font></td>
				                   <td>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_userid]</b></font></td>
				                   <td>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_password]</b></font></td>
				                   <td>            
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_firstname]</b></font></td>
				                   <td>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_name]</b></font></td>
				                   <td>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_email]</b></font></td>
				                   </tr>";
		$bgColor = "#DEE3EF";
		while ($row = mysql_fetch_array($result))
		{
			print "<tr>";
			print "<td bgcolor='$bgColor'>
						                <span class=\"text\"><a href='index.php?option=modulemanager&module=$module&modoption=listuser&deleteuserid=$row[user_index]' onCLick=\"return confirm('$sas_lang[forum_delete_question]')\">$sas_lang[forum_delete]</span></td>";

			$result2 = mysql_query("Select name FROM $forumcat_table WHERE cat_index = '$row[cat_index]'");
			if (mysql_num_rows($result2) > 0) //get the forum title 
			{
				$forum_title = mysql_result($result2, 0);
			}
			print "<td bgcolor='$bgColor'>
						                      <span class=\"text\">$forum_title</span></td>
						                      <td bgcolor='$bgColor'>
						                      <span class=\"text\">$row[username]</span></td>
						                      <td bgcolor='$bgColor'>
						                      <span class=\"text\">********</span></td>
						                      <td bgcolor='$bgColor'>
						                      <span class=\"text\">$row[firstname]</span></td>
						                      <td bgcolor='$bgColor'>
						                      <span class=\"text\">$row[surname]</span></td>
						                      <td bgcolor='$bgColor'>
						                      <span class=\"text\">$row[email]</span></td>
						                      </tr>";
			if ($bgColor == "DEE3EF")
			{
				$bgColor = "#FFFFFF";
			}
			else
			{
				$bgColor = "DEE3EF";
			}
		}
	}
	print "</table></p>";

}

if ($modoption == "modifytopic")
{
	$result = mysql_query("SELECT * FROM $forumtopics_table ORDER BY date DESC");
	print "<table border='1' cellpadding='2' cellspacing='0' width='100%' >
		               <tr>";
	if ($type == 1)
	{
		print "<td align='center' width='100%' colspan='4'>
				               <font face='Arial' size='4'>$sas_lang[forum_delete_topic]</font></td>";
	}
	else
	{
		print "<td align='center' width='100%' colspan='4'>
				               <font face='Arial' size='4'>$sas_lang[forum_modify_topic]</font></td>";
	}
	print "</tr>";
	if (mysql_num_rows($result) == 0)
	{
		print "<tr>
				                   <td width='100%' colspan='4' bgcolor='#DEE3EF'><span class=\"text\">" . $sas_lang['forum_no_topics'] . "</span></td>
				                   </tr>";
	}
	else
	{
		print "<tr bgcolor='#638ABD'>
				                   <td width='50%'>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_topic]</b></font></td>
				                   <td width='30%'>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_author]</b></font></td>
				                   <td width='20%'>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_header]</b></font></td>
				                   </tr>";
		$bgColor = "#DEE3EF";
		while ($row = mysql_fetch_array($result))
		{
			print "<tr>";

			print "<td width='40%' bgcolor='$bgColor'>
						                <span class=\"text\">
						                <a href='index.php?option=modulemanager&module=$module&modoption=modifytopic&type=1&deletetopic=$row[topic_index]' onCLick=\"return confirm('$sas_lang[forum_delete_question]')\">
						                $sas_lang[forum_delete] </a> 
						                <a href='index.php?option=modulemanager&module=$module&modoption=modifytopic&type=2&modifyid=$row[topic_index]'>
						                $sas_lang[forum_modify] </a>$row[topictitle]</span></td>";

			print "<td width='30%' bgcolor='$bgColor'>
						                 <span class=\"text\">$row[userid]</span></td>";
			$result2 = mysql_query("Select name FROM $forumcat_table WHERE cat_index = '$row[cat_index]'");
			$forumname = mysql_result($result2, 0);
			print "<td width='10%' bgcolor='$bgColor'>
						                 <span class=\"text\">$forumname</span></td>
						                 </tr>";
			if ($bgColor == "#DEE3EF")
			{
				$bgColor = "#FFFFFF";
			}
			else
			{
				$bgColor = "#DEE3EF";
			}
		}
	}
	print "</table></p>";
}

if ($modoption == "modifyreply")
{
	$result = mysql_query("SELECT * FROM $forumtopics_table ORDER BY date DESC");
	print "<table border='1' cellpadding='2' cellspacing='0' width='100%' >
		               <tr>";
	if ($type == 1)
	{
		print "<td align='center' width='100%' colspan='4'>
				               <font face='Arial' size='4'>$sas_lang[forum_delete_reply]</font></td>";
	}
	else
	{
		print "<td align='center' width='100%' colspan='4'>
				               <font face='Arial' size='4'>$sas_lang[forum_modify_reply]</font></td>";
	}
	print "</tr>";
	if (mysql_num_rows($result) == 0)
	{
		print "<tr>
				                   <td width='100%' colspan='4' bgcolor='#DEE3EF'>
				                   <span class=\"text\">" . $sas_lang['forum_no_topics'] . "</span></td>
				                   </tr>";
	}
	else
	{
		print "<tr bgcolor='#638ABD'>
				                   <td width='50%'>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_topic]</b></font></td>
				                   <td width='30%'>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_author]</b></font></td>
				                   <td width='20%'>
				                   <font face=\"Arial\" size=\"3\" color=\"FFFFFF\"><b>$sas_lang[forum_header]</b></font></td>
				                   </tr>";
		$bgColor = "#DEE3EF";
		while ($row = mysql_fetch_array($result))
		{
			print "<tr>";
			print "<td width='50%' bgcolor='$bgColor'><span class=\"text\"><b>$row[topictitle]</b></span>";

			print "<table border='1' cellpadding='2' cellspacing='0' width='100%'";
			$replyresult = mysql_query("SELECT * FROM $forumreplies_table WHERE topicindex='$row[topic_index]'");
			if (mysql_num_rows($replyresult) == 0)
			{
				print "<tr>
								                           <td width='100%' bgcolor='$bgColor'><span class=\"text\">$sas_lang[forum_no_reply]</span></td>
								                           </tr>";
			}
			else
			{
				while ($rowreply = mysql_fetch_array($replyresult))
				{
					print "<tr>
										                             <td width='20%' bgcolor='$bgColor'><span class=\"text\">
										                             <a href = 'index.php?option=modulemanager&module=$module&modoption=modifyreply&type=1&deletereply=$rowreply[reply_index]&topicid=$row[topic_index]' onCLick=\"return confirm('$sas_lang[forum_delete_question]')\">$sas_lang[forum_delete]</a>
										                             <a href = 'index.php?option=modulemanager&module=$module&modoption=modifyreply&type=2&modifyreply=$row[topic_index]&replyid=$rowreply[reply_index]'>$sas_lang[forum_modify]</a></span></td>";

					$reply = substr($rowreply[replybody], 0, 99) . "....";
					print "<td width='80%' bgcolor='$bgColor'>
										                               <span class=\"text\">$reply</span></td>
										                               </tr>";
				}
			}
			print "</table>
						                </td>
						                <td width='30%' bgcolor='$bgColor'>
						                <span class=\"text\">$row[userid]</span></td>";
			$result2 = mysql_query("SELECT name FROM $forumcat_table WHERE cat_index = '$row[cat_index]'");
			$forumname = mysql_result($result2, 0);
			print "<td width='10%' bgcolor='$bgColor'>
						                <span class=\"text\">$forumname</span></td>
						                </tr>";
			if ($bgColor == "#DEE3EF")
			{
				$bgColor = "#FFFFFF";
			}
			else
			{
				$bgColor = "#DEE3EF";
			}
		}
	}
	print "</table></p>";
}

include ("interface/pageend.inc.php");
include ("interface/footer.inc.php");
?>
