Hotnews8.php:
<?php
/***************************************************************************
* (c)2002-2005 Boesch IT-Consulting (info <at> boesch-it <dot> de)
***************************************************************************/
$path_simpnews=dirname(__FILE__);
require_once($path_simpnews.'/config.php');
require_once($path_simpnews.'/functions.php');
if(!isset($sortorder))
$sortorder=0;
if(!isset($$langvar) || !$$langvar)
$act_lang=$default_lang;
else
$act_lang=$$langvar;
include($path_simpnews.'/language/lang_'.$act_lang.'.php');
include($path_simpnews.'/includes/get_settings.inc');
include($path_simpnews.'/includes/styles2.inc');
setlocale(LC_TIME, $def_locales[$act_lang]);
$announceavail=false;
if(!isset($maxannounce))
$maxannounce=0;
if($hn_linklayout)
$layout=$hn_linklayout;
$actdate = date("Y-m-d 23:59:59");
?>
<!-- code generated by SimpNews begin -->
<table width="<?php echo $TableWidth2?>" border="0" CELLPADDING="1" CELLSPACING="0" ALIGN="<?php echo $tblalign?>" class="sntable">
<tr><TD BGCOLOR="<?php echo $bordercolor?>">
<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">
<?php
if((strlen($heading)>0) && ($hotscriptsnoheading==0))
{
?>
<TR BGCOLOR="<?php echo $headingbgcolor?>" ALIGN="CENTER">
<TD ALIGN="CENTER" VALIGN="MIDDLE" colspan="2"><font face="<?php echo $headingfont?>" size="<?php echo $headingfontsize?>" color="<?php echo $headingfontcolor?>"><b><?php echo display_encoded($heading)?></b></font></td></tr>
<?php
}
$sql = "select * from ".$tableprefix."_misc";
if(!$result = mysql_query($sql, $db)) {
die("<tr class=\"errorrow\"><td>Could not connect to the database.");
}
if ($myrow = mysql_fetch_array($result))
{
if($myrow["shutdown"]==1)
{
?>
</tr></table></td></tr>
<tr><TD BGCOLOR="<?php echo $bordercolor?>">
<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">
<tr BGCOLOR="<?php echo $contentbgcolor?>" ALIGN="CENTER">
<TD ALIGN="CENTER" VALIGN="MIDDLE" colspan="2"><font face="<?php echo $contentfont?>" size="<?php echo $contentfontsize?>" color="<?php echo $contentfontcolor?>">
<?php
$shutdowntext=stripslashes($myrow["shutdowntext"]);
$shutdowntext = undo_htmlspecialchars($shutdowntext);
echo $shutdowntext;
echo "</font></td></tr></table></td></tr></table>";
?>
</td></tr></table>
<?php
include($path_simpnews.'/includes/footer2.inc');
echo "</body></html>";
exit;
}
}
if(bittst($announceoptions, BIT_14))
{
$acttime=transposetime(time(), $servertimezone, $displaytimezone);
$tmpsql = "select an.* from ".$tableprefix."_announce an, ".$tableprefix."_hn6cats hn6 where (an.expiredate>=$acttime or an.expiredate=0) and (an.firstdate<=$acttime or an.firstdate=0) and (an.category=hn6.catnr or an.category=0) and hn6.catnr!=0";
if($separatebylang==1)
$tmpsql.=" and an.lang='$act_lang'";
switch($sortorder)
{
case 0:
$tmpsql.=" order by an.date desc";
break;
case 1:
$tmpsql.=" order by an.date asc";
break;
case 2:
$tmpsql.=" order by an.heading asc";
break;
case 3:
$tmpsql.=" order by an.heading desc";
break;
}
if($maxannounce>0)
$tmpsql.=" limit $maxannounce";
else
$tmpsql.=" limit $anhn6numentries";
if(!$tmpresult = mysql_query($tmpsql, $db))
die("<tr class=\"errorrow\"><td>Unable to connect to database.".mysql_error());
if(mysql_num_rows($tmpresult)>0)
{
$announceavail=true;
while($tmprow=mysql_fetch_array($tmpresult))
{
echo "<tr>";
list($mydate, $mytime)=explode(" ", $tmprow["date"]);
list($year, $month, $day) = explode("-", $mydate);
list($hour, $min, $sec) = explode(":", $mytime);
if($month>0)
{
$displaytime=mktime($hour, $min, $sec, $month, $day, $year);
$displaytime=transposetime($displaytime, $servertimezone, $displaytimezone);
$displaydate=strftime($news5dateformat, $displaytime);
}
else
$displaydate="";
if($hotnewsicons==1)
{
echo "<td width=\"2%\" height=\"100%\" align=\"center\" bgcolor=\"$contentbgcolor\">";
if($tmprow["headingicon"])
echo "<img src=\"$url_icons/".$tmprow["headingicon"]."\" border=\"0\" align=\"middle\"> ";
echo "</td>";
}
echo "<td align=\"center\"><table class=\"newsbox\" width=\"100%\" align=\"center\" bgcolor=\"$contentbgcolor\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr><td align=\"left\" bgcolor=\"$timestampbgcolor\">";
echo "<font face=\"$timestampfont\" size=\"$timestampfontsize\" color=\"$timestampfontcolor\">";
if($tmprow["category"]==0)
echo "<img style=\"margin: 1px\" src=\"$url_gfx/$gannouncepic\" border=\"0\" align=\"absmiddle\" alt=\"$l_global_announcement\" title=\"$l_global_announcement\"> ";
else
echo "<img style=\"margin: 1px\" src=\"$url_gfx/$announcepic\" border=\"0\" align=\"absmiddle\" alt=\"$l_announcement\" title=\"$l_announcement\"> ";
echo get_start_tag($timestampstyle);
echo $displaydate;
echo get_end_tag($timestampstyle);
echo "</font></td></tr>";
if(strlen($tmprow["heading"])>0)
{
echo "<tr bgcolor=\"$newsheadingbgcolor\"><td align=\"left\">";
echo "<font face=\"$newsheadingfont\" size=\"$hn_newsheadingfontsize\" color=\"$newsheadingfontcolor\">";
if(($hotnewsmaxchars<1) && ($hnnolinking==0))
{
if($usehnlinkdest==1)
$linkdest="$hnlinkdestan?$langvar=$act_lang&layout=$layout&category=".$tmprow["category"]."&announcenr=".$tmprow["entrynr"];
else
$linkdest=$url_simpnews."/announce.php?$langvar=$act_lang&layout=$layout&category=".$tmprow["category"]."&announcenr=".$tmprow["entrynr"];
echo " <a href=\"$linkdest\"";
if($hotnews6target)
echo " target=\"$hotnews6target\"";
echo ">";
}
$displayheading=$tmprow["heading"];
if($hotnewsnohtmlformatting==1)
$displayheading=strip_tags($displayheading);
$displayheading=do_htmlentities($displayheading);
$displayheading=undo_htmlspecialchars($displayheading);
if($hotnewsnohtmlformatting==0)
echo get_start_tag($newsheadingstyle);
echo $displayheading;
if($hotnewsnohtmlformatting==0)
echo get_end_tag($newsheadingstyle);
if(($hotnewsmaxchars<1) && ($hnnolinking==0))
echo "</a>";
echo "</font></td></tr>";
}
if($hotnewsmaxchars!=0)
{
echo "<tr bgcolor=\"$contentbgcolor\"><td align=\"left\">";
echo "<font face=\"$contentfont\" size=\"$contentfontsize\" color=\"$contentfontcolor\">";
$displaytext=stripslashes($tmprow["text"]);
$displaytext = undo_htmlspecialchars($displaytext);
if(($hotnewsmaxchars>0) && strlen($displaytext)>$hotnewsmaxchars)
{
$displaytext=str_replace("<BR>", " ", $displaytext);
$displaytext=undo_htmlentities($displaytext);
$displaytext=strip_tags($displaytext);
$displaytext=substr($displaytext, 0, $hotnewsmaxchars);
$displaytext=do_htmlentities($displaytext);
if($usehnlinkdest==1)
$linkdest="$hnlinkdestan?$langvar=$act_lang&layout=$layout&category=".$tmprow["category"]."&announcenr=".$tmprow["entrynr"];
else
$linkdest=$url_simpnews."/announce.php?$langvar=$act_lang&layout=$layout&category=".$tmprow["category"]."&announcenr=".$tmprow["entrynr"];
$displaytext.="<br><a href=\"$linkdest\"";
if($hotnews6target)
$displaytext.=" target=\"$hotnews6target\"";
$displaytext.=">$l_wholestory</a>";
} else if($hotnewsnohtmlformatting==1)
strip_tags($displaytext);
echo $displaytext."</font></td></tr>";
}
if($hotnewsdisplayposter && (strlen($tmprow["poster"])>0))
{
echo "<tr bgcolor=\"$posterbgcolor\"><td align=\"left\">";
echo "<font face=\"$posterfont\" size=\"$posterfontsize\" color=\"$posterfontcolor\">";
if($hotnewsnohtmlformatting==0)
echo get_start_tag($posterstyle);
echo "$l_poster: ".do_htmlentities($tmprow["poster"]);
if($hotnewsnohtmlformatting==0)
echo get_end_tag($posterstyle);
echo "</font></td></tr>";
}
echo "</table></td></tr>";
}
}
}
$sql = "select dat.* from ".$tableprefix."_data dat, ".$tableprefix."_hn6cats cat where dat.category=cat.catnr";
if($separatebylang==1)
$sql.=" and dat.lang='$act_lang'";
$sql.=" and date<='$actdate'";
switch($sortorder)
{
case 0:
$sql.=" order by dat.date desc";
break;
case 1:
$sql.=" order by dat.date asc";
break;
case 2:
$sql.=" order by dat.heading asc";
break;
case 3:
$sql.=" order by dat.heading desc";
break;
}
$sql.=" limit $hn6_numentries";
if(!$result = mysql_query($sql, $db))
die("<tr class=\"errorrow\"><td>Unable to connect to database.".mysql_error());
if(!$myrow=mysql_fetch_array($result))
{
if(!$announceavail)
{
echo "<tr>";
echo "<td align=\"center\" bgcolor=\"$contentbgcolor\">";
echo $l_nonewnews;
echo "<font face=\"$contentfont\" size=\"$contentfontsize\" color=\"$contentfontcolor\">";
echo "</font></td></tr>";
}
}
else
{
do
{
if($myrow["linknewsnr"]==0)
$entrydata=$myrow;
else
{
$tmpsql="select * from ".$tableprefix."_data where newsnr=".$myrow["linknewsnr"];
if(!$tmpresult = mysql_query($tmpsql, $db))
die("<tr class=\"errorrow\"><td>Unable to connect to database.".mysql_error());
if(!$tmprow=mysql_fetch_array($tmpresult))
die("<tr class=\"errorrow\"><td>Unable to get data");
$entrydata=$tmprow;
}
list($mydate, $mytime)=explode(" ", $myrow["date"]);
list($year, $month, $day) = explode("-", $mydate);
list($hour, $min, $sec) = explode(":", $mytime);
if($month>0)
{
$displaytime=mktime($hour, $min, $sec, $month, $day, $year);
$displaytime=transposetime($displaytime, $servertimezone, $displaytimezone);
$displaydate=strftime($news5dateformat, $displaytime);
}
else
$displaydate="";
echo "<tr>";
if($hotnewsicons==1)
{
echo "<td width=\"2%\" height=\"100%\" align=\"center\" bgcolor=\"$contentbgcolor\">";
if($entrydata["headingicon"])
echo "<img src=\"$url_icons/".$entrydata["headingicon"]."\" border=\"0\" align=\"middle\"> ";
echo "</td>";
}
echo "<td align=\"center\"><table class=\"newsbox\" width=\"100%\" align=\"center\" bgcolor=\"$contentbgcolor\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr><td align=\"left\" bgcolor=\"$timestampbgcolor\">";
echo "<font face=\"$timestampfont\" size=\"$timestampfontsize\" color=\"$timestampfontcolor\">";
echo get_start_tag($timestampstyle);
echo $displaydate;
echo get_end_tag($timestampstyle);
if(isset($lastvisitdate))
{
list($mydate, $mytime)=explode(" ", $myrow["date"]);
list($year, $month, $day) = explode("-", $mydate);
list($hour, $min, $sec) = explode(":", $mytime);
$thisentrydate=mktime($hour, $min, $sec, $month, $day, $year);
if($thisentrydate>=$lastvisitdate)
echo " <img src=\"$url_gfx/$newentrypic\" border=\"0\" align=\"absmiddle\">";
}
echo "</font></td>";
$srcscript=$url_simpnews."/news.php";
if(($allowcomments==1) && ($entrydata["allowcomments"]==1) && ($hotnewscommentslink==1))
{
$tempsql="select * from ".$tableprefix."_comments where entryref=".$entrydata["newsnr"];
if(!$tempresult = mysql_query($tempsql, $db))
die("<tr class=\"errorrow\"><td>Unable to connect to database.".mysql_error());
$numcomments=mysql_num_rows($tempresult);
if($numcomments>0)
{
echo "<td align=\"right\" bgcolor=\"$timestampbgcolor\" width=\"10%\" valign=\"top\">";
echo "<font face=\"$timestampfont\" size=\"$timestampfontsize\" color=\"$timestampfontcolor\">";
if($commentsinline==0)
$commentlink=$url_simpnews."/comment.php?mode=display&$langvar=$act_lang&entryref=".$entrydata["newsnr"];
else
{
if($usehnlinkdest)
$commentlink=$hnlinkdest;
else
$commentlink=$url_simpnews."/singlenews.php";
$commentlink.="?$langvar=$act_lang&layout=$layout&category=".$entrydata["category"]."&newsnr=".$entrydata["newsnr"]."&srcscript=$srcscript";
}
echo "<a class=\"commentlink\" href=\"$commentlink\">";
if($commentspic)
echo "<img style=\"margin: 1px\" src=\"".$url_gfx."/$commentspic\" border=\"0\" alt=\"$l_comments: $numcomments\" title=\"$l_comments: $numcomments\">";
else
echo "$l_comments: $numcomments";
echo "</a> </font></td>";
}
}
echo "</tr>";
if(strlen($entrydata["heading"])>0)
{
echo "<tr bgcolor=\"$newsheadingbgcolor\"><td align=\"left\">";
echo "<font face=\"$newsheadingfont\" size=\"$hn_newsheadingfontsize\" color=\"$newsheadingfontcolor\">";
if(($hotnewsmaxchars<1) && ($hnnolinking==0))
{
if($usehnlinkdest==1)
$linkdest="$hnlinkdest?$langvar=$act_lang&layout=$layout&category=".$entrydata["category"]."&newsnr=".$entrydata["newsnr"]."&srcscript=$srcscript";
else
$linkdest=$url_simpnews."/singlenews.php?$langvar=$act_lang&layout=$layout&category=".$entrydata["category"]."&newsnr=".$entrydata["newsnr"]."&srcscript=$srcscript";
echo " <a href=\"$linkdest\"";
if($hotnews6target)
echo " target=\"$hotnews6target\"";
echo ">";
}
$displayheading=$entrydata["heading"];
if($hotnewsnohtmlformatting==1)
$displayheading=strip_tags($displayheading);
$displayheading=do_htmlentities($displayheading);
$displayheading=undo_htmlspecialchars($displayheading);
if($hotnewsnohtmlformatting==0)
echo get_start_tag($newsheadingstyle);
echo $displayheading;
if($hotnewsnohtmlformatting==0)
echo get_end_tag($newsheadingstyle);
if(($hotnewsmaxchars<1) && ($hnnolinking==0))
echo "</a>";
echo "</font></td></tr>";
}
if($hotnewsmaxchars!=0)
{
echo "<tr bgcolor=\"$contentbgcolor\"><td align=\"left\">";
echo "<font face=\"$contentfont\" size=\"$contentfontsize\" color=\"$contentfontcolor\">";
$displaytext=stripslashes($entrydata["text"]);
$displaytext = undo_htmlspecialchars($displaytext);
if(($hotnewsmaxchars>0) && strlen($displaytext)>$hotnewsmaxchars)
{
$displaytext=str_replace("<BR>", " ", $displaytext);
$displaytext=undo_htmlentities($displaytext);
$displaytext=strip_tags($displaytext);
$displaytext=substr($displaytext, 0, $hotnewsmaxchars);
$displaytext=display_encoded($displaytext);
$srcscript=$url_simpnews."/news.php";
if($usehnlinkdest==1)
$linkdest="$hnlinkdest?$langvar=$act_lang&layout=$layout&category=".$entrydata["category"]."&newsnr=".$entrydata["newsnr"]."&srcscript=$srcscript";
else
$linkdest=$url_simpnews."/singlenews.php?$langvar=$act_lang&layout=$layout&category=".$entrydata["category"]."&newsnr=".$entrydata["newsnr"]."&srcscript=$srcscript";
$displaytext.="<br><a href=\"$linkdest\"";
if($hotnews6target)
$displaytext.=" target=\"$hotnews6target\"";
$displaytext.=">$l_wholestory</a>";
} else if($hotnewsnohtmlformatting==1)
strip_tags($displaytext);
echo $displaytext."</font></td></tr>";
}
if($hotnewsdisplayposter && (strlen($entrydata["poster"])>0))
{
echo "<tr bgcolor=\"$posterbgcolor\"><td align=\"left\">";
echo "<font face=\"$posterfont\" size=\"$posterfontsize\" color=\"$posterfontcolor\">";
if($hotnewsnohtmlformatting==0)
echo get_start_tag($posterstyle);
echo "$l_poster: ".display_encoded($entrydata["poster"]);
if($hotnewsnohtmlformatting==0)
echo get_end_tag($posterstyle);
echo "</font></td></tr>";
}
echo "</table></td></tr>";
}while($myrow=mysql_fetch_array($result));
}
echo "</table></td></tr></table>";
include($path_simpnews.'/includes/footer2.inc');
?>
Other News Publishing Scripts: