Code:<?php
######################################################################
# PHP-Nuke #
#====================================================================#
# Copyright (c) 2003 - Francisco Burzi #
# http://phpnuke.org/ #
#====================================================================#
# Dutchies block-fancy_newsblock.php for PHP-Nuke 6+ #
#====================================================================#
# Copyright (c) 2004 - (webmaster@dutchies.be) #
# http://wwww.dutchies.be/ #
#====================================================================#
# Use of this program is goverened by the terms of the GNU General #
# Public License (GPL - version 1 or 2) as published by the #
# Free Software Foundation (http://www.gnu.org/) #
######################################################################
if (eregi("block-Fancy_Newsblock.php",$_SERVER['PHP_SELF'])) {Header("Location: index.php");
die();}
$limit = 5; // <= Total news items in block
$hnews = 3; // <= Maximum of highlighted news items in block
$showlinks = 1; // Show more links at bottom
$strip = "400"; // Size of the Max Number of characters displayed in highlighted news
$hnbdr = 1; // highlighted News Border off = 0 or border on = 1
$nnbdr = 0; // Normal News Border off = 0 or border on = 1
$blbrd = 0; // border arround all items
//Dont change anything below!!
global $currentlang, $sitename, $ThemeSel;
if ($currentlang == "dutch") {
$title = "Laatste";
$title1 = "Nieuws items";
$from = "Geplaatst door";
$moreLink = "Meer nieuws";
$topicLink = "Onderwerp";
$archiveLink = "Nieuws Archief";
$submitLink = "Nieuws Toevoegen";
$morenews = "Lees meer";
$Printer = "Print vriendelijk";
$friend = "Stuur naar vriend";
$LDcounter = "X Gelezen";
} else if ($currentlang == "french") {
$title = "-";
$title1 = "-";
$from = "-";
$moreLink = "-";
$topicLink = "-";
$archiveLink = "-";
$submitLink = "-";
$morenews = "-";
$Printer = "-";
$friend = "-";
$LDcounter = "-";
} else {
$title = "Latest";
$title1 = "News items";
$from = "Posted by";
$moreLink = "More news";
$topicLink = "Subject";
$archiveLink = "News Archive";
$submitLink = "Submit News";
$morenews = "Read more";
$Printer = "Print frindly";
$friend = "Send to friend";
$LDcounter = "times read";
}
function sa_darkColor($color, $level=16) {
$ret = strval($color);
if ($ret[0] == "#") {
$red = hexdec(substr($ret,1,2));
$grn = hexdec(substr($ret,3,2));
$blu = hexdec(substr($ret,5,2));
$red = (($red-$level) > 0) ? $red-$level : 0;
$grn = (($grn-$level) > 0) ? $grn-$level : 0;
$blu = (($blu-$level) > 0) ? $blu-$level : 0;
$ret = sprintf("#%02X%02X%02X", $red, $grn, $blu);
}
return $ret;
}
function sa_lightColor($color, $level=16) {
$ret = strval($color);
if ($ret[0] == "#") {
$red = hexdec(substr($ret,1,2));
$grn = hexdec(substr($ret,3,2));
$blu = hexdec(substr($ret,5,2));
$red = (($red+$level) < 255) ? $red+$level : 255;
$grn = (($grn+$level) < 255) ? $grn+$level : 255;
$blu = (($blu+$level) < 255) ? $blu+$level : 255;
$ret = sprintf("#%02X%02X%02X", $red, $grn, $blu);
}
return $ret;
}
global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $nukeurl, $db, $prefix, $admin, $topic, $topicname, $topicimage, $topictext, $informant, $multilingual, $currentlang;
$bgdark1 = sa_darkColor ($bgcolor1, 5);
$bgdark2 = sa_darkColor ($bgcolor2, 25);
$bgdark3 = sa_darkColor ($bgcolor3, 25);
$bglight1 = sa_lightColor($bgcolor1, 25);
$bglight2 = sa_lightColor($bgcolor2, 15);
$bglight3 = sa_lightColor($bgcolor3, 5);
if ($multilingual == 1) {$querylang = "AND (alanguage='$currentlang' OR alanguage='')";} else {$querylang = "";}
$content = "<div align=center><img src=\"images/Fancy_NB/dutch-ies.gif\" border=\"0\" Alt=\"$nukeurl\"><table cellspacing=\"2\" cellPadding=\"1\" width=\"100%\" border=\"$blbrd\" bordercolor=\"$bgdark2\" bgcolor=\"$bgcolor1\"><tr><td align=\"center\">";
$sql = "SELECT t1.title AS cat, t0.score, t0.sid, t0.catid, t0.alanguage, t0.informant, t0.title, t0.time, t0.hometext, t0.topic, t0.comments, t0.counter, t2.topicimage, t2.topicid, t2.topictext FROM ".$prefix."_stories t0, ".$prefix."_stories_cat t1, ".$prefix."_topics t2 WHERE t0.catid=t1.catid AND t0.topic=t2.topicid $querylang ORDER BY t0.sid DESC LIMIT 0, $limit";
$result = $db->sql_query($sql);
$rc = 0;
while ($row = $db->sql_fetchrow($result)) {
$score = $row[score];
$sid = $row[sid];
$title = $row[title];
$inform = $row[informant];
$langu = $row[alanguage];
$text = $row[hometext];
$D = substr($row[time], 8, 2);
$M = substr($row[time], 5, 2);
$Y = substr($row[time], 2, 2);
$time = $D."/".$M."/".$Y;
$linkstrip7 = stripslashes($text);
if(strlen($linkstrip7) > $strip) {
$linkstrip7 = substr($linkstrip7,0,$strip);
$linkstrip7 .= "...";}
$comtotal = $row[comments];
$counter = $row[counter];
if ($hnbdr==1) {$hncs = 1;} else {$hncs = 2;}
if ($nnbdr==1) {$nncs = 1;} else {$nncs = 1;}
if ($rc<$hnews) {
$pict = "images/topics/$row[topicimage]";
$size = getimagesize($pict);
$width = "$size[1]";
$content .= "<table cellspacing=\"$hncs\" align=\"center\" cellPadding=\"2\" width=\"100%\" border=\"$hnbdr\" bordercolor=\"$bgdark2\" bgcolor=\"$bgdark1\"><tr><td bgcolor=\"$bglight1\" align=center valign=\"top\" width=\"".$width."\"><b><a href=\"modules.php?name=News&new_topic=$row[topic]\"><img src=\"$pict\" border=\"0\" Alt=\"$row[topictext]\"></a></b></td>";
$content .= "<td bgcolor=\"$bglight1\" valign=\"top\" title=\"$from $inform\" onMouseOver=this.style.backgroundColor=\"$bgdark1\" onMouseOut=this.style.backgroundColor=\"$bglight1\" onclick=\"window.location.href='modules.php?name=News&file=article&sid=$sid'\"><a href=\"modules.php?name=News&file=article&sid=$sid\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$title</b></font></a><br>";
$content .= "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">$linkstrip7</font></td></tr></table>\n";
if ($hnews!=$limit) {$content .= "<table><tr><td height=\"3\"></td></tr></table>";}
} else {
$pict = "images/Fancy_NB/$row[topicid].gif";
$content .= "<table cellspacing=\"$nncs\" align=\"center\" cellPadding=\"2\" width=\"99.5%\" border=\"$nnbdr\" bordercolor=\"$bgdark2\" bgcolor=\"$bgdark1\">";
$content .= "<tr><td bgcolor=\"$bglight1\" align=center width=\"3%\"><b><a href=\"modules.php?name=News&new_topic=$row[topic]\"><img src=\"$pict\" border=\"0\" Alt=\"$row[topictext]\"></a></b></td>";
$content .= "<td bgcolor=\"$bglight1\" align=center width=\"9%\">$time</td><td bgcolor=\"$bglight1\" align=left valign=\"top\" width=\"84%\" title=\"$from $inform\" onMouseOver=this.style.backgroundColor=\"$bgdark1\" onMouseOut=this.style.backgroundColor=\"$bglight1\" onclick=\"window.location.href='modules.php?name=News&file=article&sid=$sid'\"><a href=\"modules.php?name=News&file=article&sid=$sid\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>$title</b></font></a></td><td bgcolor=\"$bglight1\" align=right width=\"4%\" title=\"$LDcounter\">$counter</td></tr></table>\n";
}
$rc = $rc+1;
}
$content .= "</td></tr><tr><td align=center>";
if ($hnews!=$limit) {
$sql1 = "SELECT topicid, topictext FROM ".$prefix."_topics order by topicid";
$result4 = $db->sql_query($sql1);
while( list($topicid, $topictext) = $db->sql_fetchrow( $result4 )){
$content .= "<img src=\"images/Fancy_NB/$topicid.gif\" border=\"0\" Alt=\"$topictext\" align=\"absmiddle\"> $topictext ";
}
}
$content .= "</td></tr>";
if ($showlinks==1){$content .= "<tr><td align=center><A HREF=\"news.html\">$moreLink</A> <strong><big>·</big></strong> <A HREF=\"topics.html\">$topicLink</A> <strong><big>·</big></strong> <A HREF=\"archive.html\">$archiveLink</A> <strong><big>·</big></strong> <A HREF=\"modules.php?name=FCKeditor\">$submitLink</A></td></tr>";}
$content .= "</table>";
?>
|