<?php

#############################################################################
#                              Site@School Template editor module
# Site@School is a website management system designed for schools.
# This is a Template editor module which can be used in Site@School.
#
# idea and design Fred Stuurman (fc.stuurman@hccnet.nl)
############################################################################
# exprt.php: last changed 15/11/2005 s@s version 2.4
#                    by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: export.php,v 1.1 2006/10/03 10:49:08 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.
##############################################################################
include ("../../configuration/database.inc.php");
mysql_connect("$db_server", "$db_username", "$db_password");
mysql_select_db("$db_name");
require ("../../core/session.php"); //build a session

$query = "SELECT config_value FROM $table_configuration WHERE config_key='sessioncode'";
if ($result = mysql_query($query))
{
	$check_sessioncode = mysql_result($result, 0);
	unset ($query);
	unset ($result);
}
if ($_SESSION['sessioncode'] != "$check_sessioncode")
{
	//if we don't have a session present the login screen
	Header("Location: ../../index.php");
	exit;
}

header("Content-Type: text/x-delimtext; name=\"template_config.txt\"");
header("Content-disposition: attachment; filename=template_config.txt");

$query = "select config_value from $table_configuration WHERE config_key = 'template_content'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_content_prot'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_footer'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_footer_prot'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_general'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_general_prot'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_header'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_header_prot'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_menu'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_menu_prot'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_section'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_section_prot'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_status'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
$query = "SELECT config_value FROM $table_configuration WHERE config_key = 'template_status_prot'";
$result = mysql_query($query);
print mysql_result($result, 0, 0) . ";";
?>