Location: PHPKode > projects > NetworX - Social networking Service > group_news_latest_versions.php
<?php
/*
NetworX - open-source social networks platform
Copyright (C) 2009 SocialABC, Inc. http://www.socialabc.com
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 3 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 in a file called LICENSE; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ 

require_once('includes/application_top.php');

if (!Session::isCurrentSessionLoggedIn())
{
	cmn_unauthorized_action();
}

$group_id = isset($_GET['group_id']) ? $_GET['group_id'] : ( isset($_POST['GroupID']) ? $_POST['GroupID'] : -1 );
$news_id = isset($_GET['news_id']) ? $_GET['news_id'] : ( isset($_POST['NewsID']) ? $_POST['NewsID'] : -1 );
$group = new Group($group_id);
$news = new News($news_id);

if ($group->checkEditNewsPrivacy())
{
	$latest_news = $news->getLatestNews();	

	if (count($latest_news))
	{
		foreach ($latest_news as $news)
		{
			$template->setVariable("NewsDate", $news->NewsDate);
			$template->setVariable("NewsText", $news->NewsText);
			$template->setVariable("NewsID", $news_id);
			$template->setVariable("NewsVersionID", $news->NewsID);
			$template->setVariable('GroupID', $news->GroupID);
			$template->parse('latest_news');
		}
	}
	else 
	{
		cmn_redirect('group_news.php?group_id=' . $group_id);
	}
}

require_once('includes/application_bottom.php');
Return current item: NetworX - Social networking Service