";
include("news.inc");
include_once("/home/dordingu/public_html/hardkjarni/frettir/database.inc.php");
if (($show_news!="all"))
{
if (isset($start) && !$prev)
{
$start_row=$start;
$start=$start+$show_news;
}
else if (!$start && !$prev)
{
$start=0;
$start_row=0;
}
if ($prev)
{
$start_row=$prev;
$start=$prev-$show_news;
}
if (!$end)
{
$end=$show_news;
}
$limit="Limit $start,$end";
}
// $sql="select count(*) from news where (current_date between n_date and end_date) or end_date='0000-00-00 00:00:00' or end_date is null";
$sql="select count(*) from news";
$result=mysql_query($sql,$db);
$myrow=mysql_fetch_array($result);
$num_rows=$myrow[0];
$data = fread(fopen($show_news_template, "r"), filesize($show_news_template));
// $sql="select n_id,UNIX_TIMESTAMP(n_date) as my_date ,n_title, news,pic_link,n_pic,n_file,n_newstype, n_reporter, newssource from news where (current_timestamp between n_date and end_date) or end_date ='0000-00-00 00:00:00' or end_date is null order by n_id desc,n_date desc $limit";
$sql="select n_id,UNIX_TIMESTAMP(n_date) as my_date ,n_title, news,showorhide,pic_link,n_pic,n_file,n_newstype, n_reporter, newssource from news where showorhide=0 order by n_id desc,n_date desc $limit";
$result=@mysql_query($sql,$db);
while ($myrow=mysql_fetch_array($result))
{
$n_id=$myrow["n_id"];
$n_date=date($date_format,$myrow["my_date"]);
$end_date=$myrow["end_date"];
$news=$myrow["news"];
$pic_link=$myrow["pic_link"];
$news_hold=explode("\n",$news);
$picture=$myrow["n_pic"];
$n_newstype=$myrow["n_newstype"];
$n_reporter=$myrow["n_reporter"];
$dagsetning=strftime("%e. %B %Y %a.", $myrow["my_date"]);;
$newssource=$myrow["newssource"];
$topic=$myrow["n_title"];
// $file=$myrow["n_file"];
for ($i=0;$i".$hold_word[$n]."";
}
else if (substr($hold_word[$n],0,4)=="www.")
{
$hold_word[$n]="".$hold_word[$n]."";
}
else if (strpos($hold_word[$n],"@"))
{
$hold_word[$n]="$hold_word[$n]";
}
}
$news_hold[$i]=implode(" ",$hold_word);
}
$news=implode("\n",$news_hold);
$news=nl2br($news);
if (!$end_date)
{
$end_date="";
}
$hold=$data;
$hold=str_replace("{start_date}",$dagsetning,$hold);
$hold=str_replace("{end_date}",$end_date,$hold);
$hold=str_replace("{news}",$news."",$hold);
$hold=str_replace("{news_number}",$n_id,$hold);
$hold=str_replace("{n_reporter}",$n_reporter,$hold);
$hold=str_replace("{newssource}",$newssource,$hold);
if ($n_newstype == 0) {
$hold=str_replace("{topic}","$topic",$hold);
}
elseif ($n_newstype == 1) {
$hold=str_replace("{topic}","$topic",$hold);
}
elseif ($n_newstype == 2) {
$hold=str_replace("{topic}","$topic",$hold);
}
else {
$hold=str_replace("{topic}","$topic",$hold);
}
if ($picture)
{
if ($pic_link)
{
$hold=str_replace("{picture}"," ",$hold);
}
else
{
$hold=str_replace("{picture}"," ",$hold);
}
}
else
{
$hold=str_replace("{picture}","",$hold);
}
echo $hold;
}
echo " |
";
echo "