<?php

#############################################################################
#                              Site@School
# Site@School is a website management system designed for schools.
#
# About Site@School:
# Original Idea: Mark de Haan (mark@starwave.nl)
# PHP coding & Design: Mark de Haan (mark@starwave.nl)
# Comissioned by: Stadsdeel de Baarsjes, Amsterdam, Netherlands
############################################################################
# archive_prot.php: last changed 21/01/2004  , version: 2.0.1
#              by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: archive_prot.php,v 1.1 2006/10/03 09:38:29 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 (file_exists($cmsdir . "/languages/" . $language . "/sn_news/" . $language . ".php"))
{ //get module language file
	include ($cmsdir . "/languages/" . $language . "/sn_news/" . $language . ".php");
}
else
{
	include ($cmsdir . "/languages/EN/sn_news/EN.php");
}

$query = "SELECT dbtables FROM $table_modules WHERE location='sn_news'"; // getting the news tables names
$result = mysql_query($query);
$moduletables = mysql_result($result, 0);
unset ($query);
unset ($result);
$moduletables = explode(",", $moduletables);
$news_articletable = "$moduletables[0]";
$news_categorytable = "$moduletables[1]";

if (IsSet ($_GET['article']))
{
	$article = $_GET['article'];
}

print "<span class=colortext><b>" . $lang['news_module_archive'] . "</b></span><br><br>";

if (IsSet ($_GET[article]))
{
	$query = "SELECT id, title, date, category, content FROM $news_articletable WHERE id = '$article'";
	$result = mysql_query($query);
	while ($article_list = mysql_fetch_array($result))
	{
		$article_list[4] = str_replace("\n", "<br>", $article_list[4]);
		print "<A name=\"$article_list[0]\">
		<FONT face=\"Arial,helvetica\" size=\"3\">
		<B>$article_list[1] &nbsp;&nbsp;  <font size=1>$article_list[2]</B></font><br>
		<FONT face=\"Arial,helvetica\" color=\"#000000\" size=\"2\">
		$article_list[4]
		</font><br><br>";
	}
	print "<span class=text><a href=\"index.php?section=$section&page=$page\"><< " . $lang['news_module_backtoarchive'] . "</a></span>";
}
else
{
	$query = "SELECT id, title, date, category, content FROM $news_articletable WHERE archive=2";
	$result = mysql_query($query);
	while ($article_list = mysql_fetch_array($result))
	{
		print "<IMG hspace=0 src=\"" . $cmsdir . "/modules/sn_news/templates/standard/arrow.gif\" border=0 width=\"8\" height=\"8\">
		  &nbsp;<b><A href=\"index.php?section=$section&page=$page&article=$article_list[0]\"><span class=text>$article_list[2]</span> - <span class=text>$article_list[1]</b></span><br>";
	}
}
?>