<?php

#############################################################################
#           			                   Site@School
# Site@School is a website management system designed for primary schools.
#
# About Site@School:
# Comissioned by: City District 'de Baarsjes', Amsterdam, Netherlands
# Original idea, coding (version 1.0) and design : Mark de Haan (mark@starwave.nl)
# Ideas, improvements, expansions (version 1.1 - 2.4): Fred Stuurman 
# Current coder & maintainer: Fred Stuurman (fc.stuurman@hccnet.nl)
############################################################################
# admin.php: last changed 23/11/2005  , version: 2.4
#              by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: admin.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 (IsSet ($_GET['addarticle']))
{
	$addarticle = $_GET['addarticle'];
}
if (IsSet ($_GET['addcategory']))
{
	$addcategory = $_GET['addcategory'];
}
if (IsSet ($_GET['editarticle']))
{
	$editarticle = $_GET['editarticle'];
}
if (IsSet ($_GET['editcategory']))
{
	$editcategory = $_GET['editcategory'];
}
if (IsSet ($_GET['savearticle']))
{
	$savearticle = $_GET['savearticle'];
}
if (IsSet ($_GET['savecategory']))
{
	$savecategory = $_GET['savecategory'];
}
if (IsSet ($_GET['deletearticle']))
{
	$deletearticle = $_GET['deletearticle'];
}
if (IsSet ($_GET['deletecategory']))
{
	$deletecategory = $_GET['deletecategory'];
}
if (IsSet ($_GET['modoption']))
{
	$modoption = $_GET['modoption'];
}
else
{
	$modoption = "news";
}

if (IsSet ($_POST['category']))
{
	$category = $_POST['category'];
}
if (IsSet ($_POST['content']))
{
	$content = sql_addslashes($_POST['content']);
}
if (IsSet ($_POST['title']))
{
	$title = $_POST['title'];
}
if (IsSet ($_POST['date']))
{
	$date = $_POST['date'];
}
if (IsSet ($_POST['article_category']))
{
	$article_category = $_POST['article_category'];
}
if (IsSet ($_POST['article_archive']))
{
	$article_archive = $_POST['article_archive'];
}
if (IsSet ($_POST['article_date']))
{
	$article_date = $_POST['article_date'];
}
if (IsSet ($_POST['category_title']))
{
	$category_title = $_POST['category_title'];
}
if (IsSet ($_POST['newtemplate']))
{
	$newtemplate = $_POST['newtemplate'];
}

if (IsSet ($_POST['welcome_text']))
{
	$welcome_text = sql_addslashes($_POST['welcome_text']);
	$archive_welcome_text = sql_addslashes($_POST['archive_welcome_text']);
}

if (IsSet ($_POST['ispage']))
{
	$ispage = $_POST['ispage'];
}

if (IsSet ($_POST['article_title']))
{
	$article_title = sql_addslashes($_POST['article_title']);
	$article_content = sql_addslashes($_POST['article_content']);
}

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

$query = "SELECT dbtables FROM $table_modules WHERE location='sn_news'";
$result = mysql_query($query) or die_script($query, mysql_error());
$moduletables = mysql_result($result, 0);
unset ($query);
unset ($result);
$moduletables = explode(",", $moduletables);
$news_articletable = "$moduletables[0]";
$news_categorytable = "$moduletables[1]";

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

$query = "SELECT location FROM $table_editors WHERE id = '$editor'"; // getting the editors location
$result = mysql_query($query) or die_script($query, mysql_error());
$editor_loc = mysql_result($result, 0);
unset ($query);
unset ($result);

if (IsSet ($modoption))
{
	if ($modoption == "configuration")
	{
		include ("interface/header.inc.php");
		include ("interface/menubar.inc.php");
		include ("interface/menustart.inc.php");
		print "<span class=heading>" . $sas_lang['filemanager_menu'] . "</span><p>";
		print "<span class=link>
			  <a href=index.php?option=modulemanager&module=$module&modoption=news>" . $sas_lang['news_module_headlines'] . "</a><p>
			  <a href=index.php?option=modulemanager&module=$module&modoption=archive>" . $sas_lang['news_module_archive'] . "</a><p>
			  <a href=index.php?option=modulemanager&module=$module&modoption=configuration>" . $sas_lang['configuration'] . "</a><p></span>";
		include ("interface/menuend.inc.php");
		include ("interface/pagestart.inc.php");
		print "<span class=\"heading\">" . $sas_lang['configuration'] . "<p></span>";
		print "<FORM METHOD=\"POST\" id=newarticle ACTION=\"index.php?option=modulemanager&module=$module&modoption=saveconfig\">
			  <span class=\"text\">" . $sas_lang['news_module_welcometext'] . ":<br>";
		print "<textarea cols=\"70\" rows=\"8\" name=\"welcome_text\">" . $sas_config['news_welcome_text'] . "</textarea><br><br>\n";
		print "<span class=\"text\">" . $sas_lang['news_module_archive'] . " " . $sas_lang['news_module_welcometext'] . ":<br>";
		print "<textarea cols=\"70\" rows=\"8\" name=\"archive_welcome_text\">" . $sas_config['news_archive_welcome_text'] . "</textarea><br><br>\n";
		print "<span class=\"text\">" . $sas_lang['news_module_template'] . ":<br>";
		print "<select size=\"1\" name=\"newtemplate\">\n";
		$custompath = $serverpath . "/modules/sn_news/templates";
		$dir_handle = @ opendir($custompath) or die("Unable to open $custompath");
		while ($file = readdir($dir_handle))
		{
			if ($file != ".." AND $file != ".")
			{
				if ($file == $sas_config['news_template'])
				{
					echo "<option selected value=\"$file\">$file</option>";
				}
				else
				{
					echo "<option value=\"$file\">$file</option>";
				}
			}
		}
		closedir($dir_handle);
		print "</select><br><br>";
		print "\n<br><input type=\"button\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['cancel'] . "\" name=\"backbutton\" onClick=\"javascript:parent.location='index.php?option=modulemanager&module=$module';\" class=\"cancelbutton\">";
		print "\n&nbsp;<input type=\"submit\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['save'] . "\" name=\"savebutton\" class=\"savebutton\">";
		print "</span></form>";
		include ("interface/pageend.inc.php");
		include ("interface/footer.inc.php");
		exit;
	}
	if ($modoption == "saveconfig")
	{
		$archive_welcome_text = str_replace("<br />", "", $archive_welcome_text);
		$archive_welcome_text = nl2br($archive_welcome_text);
		$welcome_text = str_replace("<br />", "", $welcome_text);
		$welcome_text = nl2br($welcome_text);
		mysql_query("UPDATE $table_configuration SET config_value='$newtemplate' WHERE config_key='news_template'");
		mysql_query("UPDATE $table_configuration SET config_value='$welcome_text' WHERE config_key='news_welcome_text'");
		mysql_query("UPDATE $table_configuration SET config_value='$archive_welcome_text' WHERE config_key='news_archive_welcome_text'");
		$modoption = "news";
	}
}

if (IsSet ($addarticle))
{
	$date1 = time();
	$article_date = strftime($sas_config['dateformat'], $date1);
	$article_content = "<table style=\"border-style: none; width: 300px; height: 222px;\">
	<tbody><tr><td>" . $sas_lang['news_module_picture'] . "</td>
	<td>" . $sas_lang['news_module_text'] . "</td></tr></tbody></table>";
	$editarticle = "new";

	if ($editor_loc == "htmlarea/editor.php")
	{
		//htmlarea editor
		include ("modules/sn_news/edit_content2.php");
	}
	else
	{
		//FCK editor
		include ("modules/sn_news/edit_content.php");
	}

	include ("interface/pageend.inc.php");
	include ("interface/footer.inc.php");
	exit;
}

if (IsSet ($addcategory))
{
	include ("interface/header.inc.php");
	include ("interface/menubar.inc.php");
	include ("interface/menustart.inc.php");
	print "<span class=heading>" . $sas_lang['filemanager_menu'] . "</span><p>";
	print "<span class=link>
	  <a href=index.php?option=modulemanager&module=$module&modoption=news>" . $sas_lang['news_module_headlines'] . "</a><p>
	  <a href=index.php?option=modulemanager&module=$module&modoption=archive>" . $sas_lang['news_module_archive'] . "</a><p>
	  <a href=index.php?option=modulemanager&module=$module&modoption=configuration>" . $sas_lang['configuration'] . "</a><p></span>";

	include ("interface/menuend.inc.php");
	include ("interface/pagestart.inc.php");
	print "<span class=\"heading\">" . $sas_lang['news_module_addcategory'] . "<br><br></span>";
	print "<FORM METHOD=\"POST\" id=newarticle ACTION=\"index.php?option=modulemanager&module=$module&savecategory=new\">
	<span class=\"text\">" . $sas_lang['title'] . ":<br>
	<input type=text name=\"category_title\" size=40 class=\"textfield\">&nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['news_module_categorytitle_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><br><br>";
	print "" . $sas_lang['news_module_category_is_page'] . "  &nbsp;" . $sas_lang['yes'];
	print "<input type=\"radio\" value=\"1\" name=\"ispage\">";
	print "<span class=text>&nbsp;&nbsp;&nbsp; " . $sas_lang['no'] . "</span>";
	print "<input type=\"radio\" name=\"ispage\" value=\"0\" checked>";
	print "<p><span class=\"text\">" . $sas_lang['news_module_welcometext'] . ":<br>
	       <textarea cols=\"70\" rows=\"4\" name=\"welcome_text\"></textarea><br><br>\n";
	print "\n<p><input type=\"button\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['cancel'] . "\" name=\"backbutton\" onClick=\"javascript:history.go(-1)\" class=\"cancelbutton\">";
	print "\n&nbsp;<input type=\"submit\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['save'] . "\" name=\"savebutton\" class=\"savebutton\">";
	print "</span></form>";

	include ("interface/pageend.inc.php");
	include ("interface/footer.inc.php");
	exit;
}

if (IsSet ($editcategory))
{
	include ("interface/header.inc.php");
	include ("interface/menubar.inc.php");
	include ("interface/menustart.inc.php");
	print "<span class=heading>" . $sas_lang['filemanager_menu'] . "</span><p>";
	print "<span class=link>
	  <a href=index.php?option=modulemanager&module=$module&modoption=news>" . $sas_lang['news_module_headlines'] . "</a><p>
	  <a href=index.php?option=modulemanager&module=$module&modoption=archive>" . $sas_lang['news_module_archive'] . "</a><p>
	  <a href=index.php?option=modulemanager&module=$module&modoption=configuration>" . $sas_lang['configuration'] . "</a><p></span>";

	include ("interface/menuend.inc.php");
	include ("interface/pagestart.inc.php");
	$query = "SELECT title, ispage, header FROM $news_categorytable where id=$editcategory"; // getting the category     
	$result = mysql_query($query) or die_script($query, mysql_error());
	$category_title = mysql_result($result, 0, title);
	$ispage_check = mysql_result($result, 0, ispage);
	$welcome_text = mysql_result($result, 0, header);

	unset ($query);
	unset ($result);
	print "<span class=\"heading\">" . $sas_lang['news_module_editcategory'] . "<br><br></span>";
	print "<FORM METHOD=\"POST\" ACTION=\"index.php?option=modulemanager&module=$module&modoption=$modoption&savecategory=$editcategory\">
	<span class=\"text\">" . $sas_lang['title'] . ":<br>
	<input type=text name=\"category_title\" size=40 class=\"textfield\" value=\"$category_title\">&nbsp;<img src=graphics/help.gif 
	ONMOUSEOVER=\"popup('" . $sas_lang['news_module_categorytitle_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><br><br>";
	print "" . $sas_lang['news_module_category_is_page'] . "  &nbsp;" . $sas_lang['yes'] . "";
	if ($ispage_check == "1")
	{
		print "<input type=\"radio\" value=\"1\" name=\"ispage\" checked>";
		print "<span class=text>&nbsp;&nbsp;&nbsp; " . $sas_lang['no'] . "</span>";
		print "<input type=\"radio\" name=\"ispage\" value=\"0\">";
	}
	else
	{
		print "<input type=\"radio\" value=\"1\" name=\"ispage\">";
		print "<span class=text>&nbsp;&nbsp;&nbsp; " . $sas_lang['no'] . "</span>";
		print "<input type=\"radio\" name=\"ispage\" value=\"0\" checked>";
	}

	print "<p><span class=\"text\">" . $sas_lang['news_module_welcometext'] . ":<br>
	       <textarea cols=\"70\" rows=\"5\" name=\"welcome_text\">$welcome_text</textarea><br><br>\n";
	print "\n<p><input type=\"button\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['cancel'] . "\" name=\"backbutton\" 
	onClick=\"location.href='index.php?option=modulemanager&module=$module&modoption=$modoption'\" class=\"cancelbutton\">";
	print "\n&nbsp;<input type=\"submit\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['save'] . "\" name=\"savebutton\" class=\"savebutton\">";
	print "</span></form>";

	include ("interface/pageend.inc.php");
	include ("interface/footer.inc.php");
	exit;
}

if (IsSet ($editarticle))
{
	$query = "SELECT title, content, date, category, archive, public FROM $news_articletable WHERE id='$editarticle'"; // getting the title
	$result = mysql_query($query) or die_script($query, mysql_error());
	$article_title = mysql_result($result, 0, 0);
	$article_content = mysql_result($result, 0, 1);
	$article_date = mysql_result($result, 0, 2);
	$article_category = mysql_result($result, 0, 3);
	$article_archive = mysql_result($result, 0, 4);
	$article_public = mysql_result($result, 0, 5);
	unset ($query);
	unset ($result);

	if ($editor_loc == "htmlarea/editor.php")
	{
		//Xinha editor
		include ("modules/sn_news/edit_content2.php");
	}
	else
	{
		//FCK editor
		include ("modules/sn_news/edit_content.php");
	}

	include ("interface/pageend.inc.php");
	include ("interface/footer.inc.php");
	exit;
}

if (IsSet ($savearticle) && $article_title != "")
{
	if (($article_archive == 0) OR ($article_archive == 3))
	{
		$archive = 0;
		if ($article_archive == 3)
		{
			$is_public = 1;
		}
		else
		{
			$is_public = 0;
		}
	}
	if (($article_archive == 1) OR ($article_archive == 2))
	{
		$archive = 1;
		if ($article_archive == 2)
		{
			$is_public = 1;
		}
		else
		{
			$is_public = 0;
		}
	}

	if ($savearticle == "new")
	{
		mysql_query("INSERT INTO $news_articletable (id, title, date, category, content, archive, public) 
		   VALUES (NULL, '$article_title', '$article_date', '$article_category', '$article_content', '$archive', '$is_public')");
	}
	else
	{
		mysql_query("UPDATE $news_articletable 
		                SET title='$article_title', 
		                    date='$article_date', 
		                    content='$article_content', 
		                    category='$article_category', 
		                    archive='$archive',
		                    public='$is_public'  
		                WHERE id='$savearticle'");
	}

	//send alert and update change date
	$result = mysql_query("SELECT title FROM $news_categorytable WHERE id = '$article_category'"); //find the title of category
	$page_name = mysql_result($result, 0, 0);
	$result2 = mysql_query("SELECT id, section, lastupdate, name FROM $table_pages WHERE module = 'sn_news/frontpage_cat.php' AND name = '$page_name' ");
	if (mysql_num_rows($result2) == 0)
	{
		$result2 = mysql_query("SELECT id, section, lastupdate, name FROM $table_pages WHERE module = 'sn_news/frontpage.php' ");
	}
	if (mysql_num_rows($result2) > 0)
	{
		$d = date("Y-m-d H:i:s"); //todays date
		$change_date = mysql_result($result2, 0, 2);
		$savepage = mysql_result($result2, 0, 0);
		$section = mysql_result($result2, 0, 1);
		$title = mysql_result($result2, 0, 3);
		mysql_query("UPDATE $table_pages SET lastupdate='$d' WHERE id='$savepage'");

		if ($change_date < $d) //send alerts only the first time on a date 
		{
			include ("core/send_alerts.php"); //check to see if need to send alerts  
		}
	}
}

if (IsSet ($savecategory) && $category_title != "")
{
	if ($savecategory == "new")
	{
		mysql_query("INSERT INTO $news_categorytable (id, title,ispage,header) VALUES (NULL, '$category_title', '$ispage', '$welcome_text')");
	}
	else
	{
		mysql_query("UPDATE $news_categorytable 
			   SET title='$category_title',
				   ispage='$ispage',
				   header='$welcome_text'
			   WHERE id='$savecategory'");
	}
}

if (IsSet ($deletearticle))
{
	mysql_query("DELETE from $news_articletable WHERE id = '$deletearticle'");
}

if (IsSet ($deletecategory))
{
	$result = mysql_query("SELECT * from $news_articletable WHERE category = '$deletecategory' AND archive = 0");
	if (mysql_num_rows($result) == 0)
	{
		//mysql_query("DELETE from $news_articletable WHERE category = '$deletecategory'");
		mysql_query("DELETE from $news_categorytable WHERE id = '$deletecategory'");
	}
	else
	{
		print "<font color=\"red\">" . $sas_lang['news_module_category_delete_error'] . "</font>";
	}
}

include ("interface/header.inc.php");
include ("interface/menubar.inc.php");
include ("interface/menustart.inc.php");
print "<span class=heading>" . $sas_lang['filemanager_menu'] . "</span><p>";
print "<span class=link>
  <a href=index.php?option=modulemanager&module=$module&modoption=news>" . $sas_lang['news_module_headlines'] . "</a><p>
  <a href=index.php?option=modulemanager&module=$module&modoption=archive>" . $sas_lang['news_module_archive'] . "</a><p>
  <a href=index.php?option=modulemanager&module=$module&modoption=configuration>" . $sas_lang['configuration'] . "</a><p></span>";
include ("interface/menuend.inc.php");
include ("interface/pagestart.inc.php");
print "<span class=\"heading\">$modulename<br></span>";
print "<span class=\"text\">" . $sas_lang['news_module_introduction'] . "</span><br>";

if ($modoption == "news")
{
	$query = "SELECT id, title FROM $news_categorytable"; // getting the categories     
	$result = mysql_query($query) or die_script($query, mysql_error());
	$Recordcount = mysql_num_rows($result); //number ofnews categories
	if ($Recordcount > 0)
	{
		while ($cat_list = mysql_fetch_array($result))
		{
			print "<br><table><tr><td>";

			print "<img border=\"0\" src=\"graphics/delete.gif\" alt=\"" . $sas_lang['delete'] . "\" title=\"" . $sas_lang['delete'] . "\" width=\"16\" height=\"16\" onClick=\"if(confirm('" . $sas_lang['news_module_deletecategory_confirm'] . "')) parent.location='index.php?option=modulemanager&module=$module&deletecategory=$cat_list[0]';\">";

			print "</td>
					   <td>";
			print "<img border=\"0\" src=\"graphics/edit.gif\" alt=\"" . $sas_lang['edit'] . "\" title=\"" . $sas_lang['edit'] . "\" width=\"16\" height=\"16\" onClick=\"parent.location='index.php?option=modulemanager&module=$module&editcategory=$cat_list[0]'\"><span class=link>&nbsp;" . $sas_lang['category'] . ": $cat_list[1]</span>";

			print "</td></tr></table><br>";
			print "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\">";
			$query1 = "SELECT id, date, title, public FROM $news_articletable WHERE category = '$cat_list[0]' AND (archive = '0' ) "; // getting the news articles
			$result1 = mysql_query($query1) or die_script($query1, mysql_error());
			while ($news_list = mysql_fetch_array($result1))
			{
				print "      <tr>                                                    
									  <td>&nbsp;</td>
									  <td>";

				print "       <img border=\"0\" src=\"graphics/delete.gif\" alt=\"" . $sas_lang['delete'] . "\" title=\"" . $sas_lang['delete'] . "\" width=\"16\" height=\"16\" onClick=\"if(confirm('" . $sas_lang['news_module_deletearticle_confirm'] . "')) parent.location='index.php?option=modulemanager&module=$module&deletearticle=$news_list[0]';\">";

				print "       </td>
									  <td>";

				print "       <img border=\"0\" src=\"graphics/edit.gif\" alt=\"" . $sas_lang['edit'] . "\" title=\"" . $sas_lang['edit'] . "\" width=\"16\" height=\"16\" onClick=\"parent.location='index.php?option=modulemanager&module=$module&modoption=$modoption&editarticle=$news_list[0]'\">";

				print "       </td>
									  <td>
									  <img border=\"0\" src=\"graphics/document.gif\">
									  </td>
									  <td><span class=\"link\"><a href=\"index.php?option=modulemanager&module=$module&modoption=$modoption&editarticle=$news_list[0]\">$news_list[1] - $news_list[2]";
				if ($news_list[3] == "1") //news for protected area
				{
					print "&nbsp;&nbsp; (*)";
					$is_on_prot_area = 1;
				}
				print "</a></span></td>
									</tr>";
			}
			print "</table>";
		}
	}
	else
	{
		print "<p><span class=text>" . $sas_lang['news_module_addcategory_please'] . "</span>";
		print "$categorytable";
	}

	print "<table><tr><td colspan=\"4\">&nbsp;</td><td><span class=\"text\">";
	if ($is_on_prot_area == 1) //news for protected area
	{
		print "(*) " . $sas_lang['protected_area'];
	}
	if ($Recordcount > 0)
	{
		print "</td></tr><tr>
						  <td colspan=\"5\">&nbsp;</td>
						</tr>
						<tr>
						  <td colspan=\"2\">&nbsp;</td>
						  <td>
						  <img border=\"0\" src=\"graphics/document.gif\">
						  </td>
						  <td colspan=\"2\"><span class=\"link\"><a href=\"index.php?option=modulemanager&module=$module&modoption=$modoption&addarticle=new\">" . $sas_lang['news_module_addarticle'] . "</a></span>
						  </td>
						</tr>";
	}
	print "    <tr>
	              <td colspan=\"2\">&nbsp;</td>
	              <td>
	              <img border=\"0\" src=\"graphics/folder_closed.gif\">
	              </td>
	              <td colspan=\"2\"><span class=\"link\"><a href=\"index.php?option=modulemanager&module=$module&modoption=$modoption&addcategory=1\">" . $sas_lang['news_module_addcategory'] . "</a></span>
	              </td>
	            </tr>";

	print "</table>";
}
if ($modoption == "archive") // the archive part
{
	print "<br><span class=\"link\">" . $sas_lang['news_module_archive'] . "</span><p>";
	$query1 = "SELECT id, date, title, public FROM $news_articletable WHERE archive = '1' "; // getting the news articles
	$result1 = mysql_query($query1) or die_script($query1, mysql_error());

	print "<br><table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\">";

	while ($news_list = mysql_fetch_array($result1))
	{
		print "     <tr>
					  <td>&nbsp;</td>
					  <td>";

		print "      <img border=\"0\" src=\"graphics/delete.gif\" alt=\"$sas_lang[delete]\" width=\"16\" height=\"16\" onClick=\"if(confirm('" . $sas_lang['news_module_deletearticle_confirm'] . "')) parent.location='index.php?option=modulemanager&module=$module&deletearticle=$news_list[0]';\">";

		print "       </td>
					  <td>";

		print "       <img border=\"0\" src=\"graphics/edit.gif\" alt=\"" . $sas_lang['edit'] . "\" title=\"" . $sas_lang['edit'] . "\" width=\"16\" height=\"16\" onClick=\"parent.location='index.php?option=modulemanager&module=$module&modoption=$modoption&editarticle=$news_list[0]'\">";

		print "       </td>
					  <td>
					  <img border=\"0\" src=\"graphics/document.gif\">
					  </td>
					  <td><span class=\"link\"><a href=\"index.php?option=modulemanager&module=$module&modoption=$modoption&editarticle=$news_list[0]\">$news_list[1] - $news_list[2]";
		if ($news_list[3] == "1")
		{
			print "&nbsp;&nbsp; (*)";
			$is_on_prot_area = 1;
		}

		print "</a></span></td></tr>";
	}
	print "<tr><td colspan=\"5\">&nbsp;</td></tr>
			<tr><td colspan=\"4\">&nbsp;</td><td><span class=\"text\">";
	if ($is_on_prot_area == 1) //news for protected area
	{
		print "(*) " . $sas_lang['protected_area'];
	}
	print "</td></tr></table>";
}

print "\n<p><input type=\"button\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['goback'] . "\" name=\"backbutton\" 
	   onClick=\"javascript:parent.location='index.php?option=modulemanager';\" class=\"backbutton\">";
include ("interface/pageend.inc.php");
include ("interface/footer.inc.php");
?>