<?php

#############################################################################
#                              Site@School Forum
# Site@School is a website management system designed for schools.
# This is a forum module which can be used in Site@School.
#
# coded by Fred Stuurman (fc.stuurman@hccnet.nl)
############################################################################
# index.php: last changed 20/08/2006  version 2.4.03
#                  by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: index.php,v 1.2 2006/10/15 19:08:53 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
#
# 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[option]))
{
	$option = $_GET[option];
	$option = htmlspecialchars(strip_tags($option)); //remove html tags
}
else
{
	$option = "" ;
}

load_language($cmsdir . '/', 'sn_forum'); //load language file
setlocale(LC_TIME, $sas_lang[forum_locale]); // used for date formatting

$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]";

$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'];
$forum_header_font_colour = $sas_config['forum_header_font_color'];

switch ($option)
{
	default :
		include ("$cmsdir/modules/sn_forum/forums.php"); //list all the forums
		break;

	case forum :
		include ("$cmsdir/modules/sn_forum/forum.php"); //list topics of forum selected
		break;

	case topicdetails :
		include ("$cmsdir/modules/sn_forum/forumtopicdetails.php"); //list topic details
		break;

	case login :
		include ("$cmsdir/modules/sn_forum/forumlogin.php"); //login page
		break;

	case stats :
		include ("$cmsdir/modules/sn_forum/forumviewstats.php"); //view the stats for a user
		break;

	case newacc :
		include ("$cmsdir/modules/sn_forum/forumnewacc.php"); //register a new account form
		break;

	case updateacc :
		include ("$cmsdir/modules/sn_forum/forummodacc.php"); //update a new account form
		break;

	case verifyacc :
		include ("$cmsdir/modules/sn_forum/forumverifymodacc.php"); //modify the new account
		break;

	case verifylogin :
		include ("$cmsdir/modules/sn_forum/forumverifylogin.php"); //veryfiy login
		break;

	case verifynewacc :
		include ("$cmsdir/modules/sn_forum/forumverifynewacc.php"); //verify the new account
		break;

	case reply :
		include ("$cmsdir/modules/sn_forum/forumreply.php"); //topic reply
		break;

	case postreply : //post the reply
		include ("$cmsdir/modules/sn_forum/forumpostreply.php");
		break;

	case newtopic :
		include ("$cmsdir/modules/sn_forum/forumnewtopic.php"); //new topic
		break;

	case postnewtopic :
		include ("$cmsdir/modules/sn_forum/forumpostnewtopic.php"); //post the new topic
		break;

	case emailinfo : //send lost password form
		include ("$cmsdir/modules/sn_forum/forumemailinfo.php");
		break;

	case emaildetails :
		include ("$cmsdir/modules/sn_forum/forumemaildetails.php"); //send the password via email
		break;

	case authdetails :
		include ("$cmsdir/modules/sn_forum/forumauthdetails.php"); //profile of user
		break;

	case search :
		include ("$cmsdir/modules/sn_forum/forumsearch.php"); //search the forum
		break;
}
?>
   		