<?php
/*
 ########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2006 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
 ########################################################################
*/

eval ("\$title_news = \"".gettemplate("title_news")."\";");
echo $title_news;

$newsID = $_GET['newsID'];
$lang = $_GET['lang'];

if(isnewsadmin($userID)) $post='<input type="button" class="button" onClick="MM_openBrWindow(\'news.php?action=new\',\'News\',\'toolbar=no,status=no,scrollbars=yes,width=800,height=600\')" value="post News">';
echo $post.' <input type="button" class="button" onClick="MM_goToURL(\'parent\',\'index.php?site=news&action=archive\');return document.MM_returnValue" value="News-Archive"><hr noshade size="1" color="'.BORDER.'">';

if(!isset($_GET['action'])) {
	$result=safe_query("SELECT * FROM ".PREFIX."news WHERE newsID='$newsID'");
	$ds=mysql_fetch_array($result);
	
  if($ds[intern] <= isclanmember($userID)) {

	$date = date("d.m.Y", $ds[date]);
	$time = date("H:i", $ds[date]);
	$rubrikname=getrubricname($ds[rubric]);
	$rubricpic='images/news-rubrics/'.getrubricpic($ds[rubric]);
	if(!file_exists($rubricpic) OR getrubricpic($ds[rubric])=='') $rubricpic = ''; else $rubricpic = '<img src="'.$rubricpic.'" border="0">';
	if(!isset($lang)) $lang=$ds[lang1];
	
	$language1="[flag]".$ds[lang1]."[/flag]";
	$language2="[flag]".$ds[lang2]."[/flag]";
			
	if($lang==$ds[lang1]) {
	    if($ds[headline1]) $headline = $ds[headline1];
		else $headline = $ds[headline2];
				
		if($ds[content1]) $content = $ds[content1];
		else $content='[b]no version in selected language available![/b].[br][br]'.$ds[content2];
				
		if($ds[headline2]) $langs='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang2].'">'.flags($language2).'</a>';
		else $langs='';
	}
	else {
	    if($ds[headline2]) $headline = $ds[headline2];
		else $headline = $ds[headline1];
			
		if($ds[content2]) $content = $ds[content2];
		else $content='[b]no version in selected language available![/b].[br][br]'.$ds[content1];
				
		if($ds[headline1]) $langs='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang1].'">'.flags($language1).'</a>';
		else $langs='';
	}
			
	$content = htmloutput($content);
	$content = toggle($content, $ds[newsID]);
	$headline = clearfromtags($headline);

	$poster='<a href="index.php?site=profile&id='.$ds[poster].'"><b>'.getnickname($ds[poster]).'</b></a>';
	if($ds[link1] && $ds[url1]!="http://" && $ds[window1]) $related.='&#8226; <a href="'.$ds[url1].'" target="_blank">'.$ds[link1].'</a> ';
	if($ds[link1] && $ds[url1]!="http://" && !$ds[window1]) $related.='&#8226; <a href="'.$ds[url1].'">'.$ds[link1].'</a> ';
		
	if($ds[link2] && $ds[url2]!="http://" && $ds[window2]) $related.='&#8226; <a href="'.$ds[url2].'" target="_blank">'.$ds[link2].'</a> ';
	if($ds[link2] && $ds[url2]!="http://" && !$ds[window2]) $related.='&#8226; <a href="'.$ds[url2].'">'.$ds[link2].'</a> ';
				
	if($ds[link3] && $ds[url3]!="http://" && $ds[window3]) $related.='&#8226; <a href="'.$ds[url3].'" target="_blank">'.$ds[link3].'</a> ';
	if($ds[link3] && $ds[url3]!="http://" && !$ds[window3]) $related.='&#8226; <a href="'.$ds[url3].'">'.$ds[link3].'</a> ';
				
	if($ds[link4] && $ds[url4]!="http://" && $ds[window4]) $related.='&#8226; <a href="'.$ds[url4].'" target="_blank">'.$ds[link4].'</a> ';
	if($ds[link4] && $ds[url4]!="http://" && !$ds[window4]) $related.='&#8226; <a href="'.$ds[url4].'">'.$ds[link4].'</a> ';
		
	if(isnewsadmin($userID)) {
	    $adminaction='<input type="button" class="button" onClick="MM_openBrWindow(\'news.php?action=edit&newsID='.$ds[newsID].'\',\'News\',\'toolbar=no,status=no,scrollbars=yes,width=800,height=600\')" value="edit"> 
	                  <input type="button" class="button" onClick="MM_confirm(\'really delete this entry?\', \'news.php?action=delete&id='.$ds[newsID].'\')" value="delete">';
	}
	else $adminaction='';
			
	$bg1=BG_1;
	
	eval ("\$news = \"".gettemplate("news")."\";");
    echo $news;
	
	if(!$ds[published] && isnewsadmin($userID)) {
		echo'<form method="post" action="news.php?quickactiontype=publish">
			 <input type="hidden" name="newsID[]" value="'.$ds[newsID].'">
			 <input type="submit" name="submit" value="PUBLISH NOW">
			 </form>';
	}
	
	$comments_allowed = $ds[comments];
	$parentID = $newsID;
	$type = "ne";
	$referer = "index.php?site=news_comments&newsID=$newsID";
		
	include("comments.php");
	} else echo "No access!";
}

?>
