<?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                                                   #
#                                                                        #
 ########################################################################
*/

//options
$topnews_maxlength = "200"; //maximal length of the topnews-text

//to not edit under this line

$ergebnis=safe_query("SELECT * FROM ".PREFIX."news WHERE newsID='$topnewsID' AND intern<=".isclanmember($userID)." LIMIT 0,1");
$anz = mysql_num_rows($ergebnis);
if($anz) {

 $dn=mysql_fetch_array($ergebnis);

 $headline1 = clearfromtags($dn[headline1]);
 $headline2 = clearfromtags($dn[headline2]);
 $content1 = $dn[content1];
 $content2 = $dn[content2];

 if(strlen($content1)>=$topnews_maxlength) {
  $content1 = substr($content1,0,$topnews_maxlength);
  $content1 = substr($content1,0,strrpos($content1,' '))." ...";
 }
 if(strlen($content2)>=$topnews_maxlength) {
  $content2 = substr($content2,0,$topnews_maxlength);
  $content2 = substr($content2,0,strrpos($content1,' '))." ...";
 }
 $content1 = clearfromtags($content1);
 $content2 = clearfromtags($content2);

  eval ("\$sc_topnews = \"".gettemplate("sc_topnews")."\";");
  echo $sc_topnews;
} else echo 'Can not find topnews for your accesslevel.';
?>
