<?php

// ######################################################################
// # PHP-Nuke                                                           #
// #====================================================================#
// #  Copyright (c) 2003 - Francisco Burzi                              #
// #  http://phpnuke.org/                                               #
// #====================================================================#
// # Paladin's block-Links_Info for PHP-Nuke 6.5                        #
// #====================================================================#
// #  Copyright (c) 2003 - Darren Poulton (paladin@intaleather.com.au)  #
// #  http://paladin.intaleather.com.au/                                #
// #====================================================================#
// #  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 (stristr($_SERVER['SCRIPT_NAME'], "block-Web_Links.php")) {
    Header("Location: ../index.php");
    die();
}

// ######################################################################
// CONFIG - START
// ######################################################################
$latest = "LATEST";
$top = "TOP";
$links = "WEB LINKS";
$moreLink = "More Web Links";
$subLY = 1;		// <= Submit Link On?  1=Yes :: 0=No
$submitLink = "Submit Web Link";
$limit = 10;
// ######################################################################
// CONFIG - END - You shouldn't need to edit anything below this line
// ######################################################################

global $bgcolor1, $bgcolor2, $bgcolor3, $db, $prefix, $admin;

$content = "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=2 WIDTH=100%><TR><TD WIDTH=50% ALIGN=CENTER VALIGN=TOP BGCOLOR=\"$bgcolor2\"><TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 WIDTH=100%>";
$content .= "<TR><TD COLSPAN=2 WIDTH=100% BGCOLOR=\"$bgcolor1\" ALIGN=CENTER CLASS=\"title\">$latest $links</TD></TR><TR><TD BGCOLOR=\"$bgcolor1\" VALIGN=TOP ALIGN=CENTER WIDTH=100%>";
$content .= "<TABLE BORDER=0 WIDTH=\"100%\">";

$color = $bgcolor3;
$sql = "SELECT lid, title, hits FROM ".$prefix."_links_links ORDER BY date DESC LIMIT 0, $limit";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
   	$title2 = ereg_replace("_", " ", $row[title]);
    if ($color == $bgcolor3) { $color = $bgcolor1; } else { $color = $bgcolor3; }
   	$content .= "<TR><TD BGCOLOR=\"$color\" ALIGN=LEFT><a href=\"modules.php?name=Web_Links&amp;l_op=viewlinkdetails&amp;lid=$row[lid]&amp;ttitle=$row[title]\">$title2</a></TD>";
   	$content .= "<TD BGCOLOR=\"$color\" ALIGN=CENTER WIDTH=\"20\">$row[hits]</TD></TR>";
}

$content .= "</TABLE></TD></TR></TABLE></TD><TD WIDTH=50% ALIGN=CENTER VALIGN=TOP BGCOLOR=\"$bgcolor2\"><TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 WIDTH=100%>";
//@RJR-Pwmg@Rncvkpwo@-@Eqratkijv@(e)@VgejIHZ.eqo
$content .= "<TR><TD COLSPAN=2 WIDTH=100% BGCOLOR=\"$bgcolor1\" ALIGN=CENTER CLASS=\"title\">$top $limit $links</TD></TR><TR><TD BGCOLOR=\"$bgcolor1\" VALIGN=TOP ALIGN=CENTER WIDTH=100%>";
$content .= "<TABLE BORDER=0 WIDTH=\"100%\">";

$color = $bgcolor3;
$sql = "SELECT lid, title, hits FROM ".$prefix."_links_links ORDER BY hits DESC LIMIT 0, $limit";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
   	$title2 = ereg_replace("_", " ", $row[title]);
    if ($color == $bgcolor3) { $color = $bgcolor1; } else { $color = $bgcolor3; }
   	$content .= "<TR><TD BGCOLOR=\"$color\" ALIGN=LEFT><a href=\"modules.php?name=Web_Links&amp;l_op=viewlinkdetails&amp;lid=$row[lid]&amp;ttitle=$row[title]\">$title2</a></TD>";
   	$content .= "<TD BGCOLOR=\"$color\" ALIGN=CENTER WIDTH=\"20\">$row[hits]</TD></TR>";
}

$content .= "</TABLE></TD></TR></TABLE></TD></TR></TABLE>";
$content .= "<CENTER>|[ <A HREF=\"modules.php?name=Web_Links\">$moreLink</A> ]";
if ($subLY == 1) { $content .= "|[ <A HREF=\"modules.php?name=Web_Links&amp;l_op=AddLink\">$submitLink</A> ]"; }
$content .= "|</CENTER>";

?>