<?php
if (!defined('IN_SAS'))
{
	die("Hacking attempt");
}

print $sas_config['news_welcome_text'] . "<br>";

if (IsSet ($_SESSION['site'])) //are we on protected area
{
	$query = "SELECT id, title FROM $news_articletable 
			  WHERE archive = 0 AND public = 1 ORDER BY id DESC";
}
else
{
	$query = "SELECT id, title FROM $news_articletable 
			  WHERE archive = 0 AND public = 0 ORDER BY id DESC";
}
$result = mysql_query($query) or die_script($query, mysql_error());
while ($article_list = mysql_fetch_array($result))
{
	print "<IMG hspace=0 src=\"" . $cmsdir . "/modules/sn_news/templates/" . $sas_config['news_template'] . "/arrow.gif\" border=0 width=\"8\" height=\"8\">
	&nbsp;<A href=\"#$article_list[0]\"><b>$article_list[1]</b></a><br><br>";
}

print "<br>";
if (IsSet ($_SESSION['site'])) //are we on protected area
{
	$query = "SELECT id, title, date, category, content 
				  FROM $news_articletable WHERE archive = 0 AND public = 1 ORDER BY id DESC";
}
else
{
	$query = "SELECT id, title, date, category, content 
				  FROM $news_articletable WHERE archive = 0 AND public = 0 ORDER BY id DESC";
}

$result = mysql_query($query) or die_script($query, mysql_error());
while ($article_list = mysql_fetch_array($result))
{
	print "<a name=\"$article_list[0]\"></a><b>$article_list[1]</b> &nbsp;&nbsp;$article_list[2]<br>$article_list[4]<br><br>";
}
?>