<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
defined('MAXIMUS') or die ('Access denied block top10 MAXIMUS directly...');

if ( $content = opencacheb ( 'Top10Links', 'html' , "".CACHE_BL_TOP10LINKS."", '1' ) ) {
} else {

$a = 1;
$sql = "SELECT `lid`, `title` FROM `".TABLE_LINKS_LINKS."` ORDER BY `hits` DESC LIMIT 0,10";
if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(BLOCK_ERROR, 'Could not obtain _links_links Blocks', '', __LINE__, __FILE__, $sql);}
while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
    $lid    = $GLOBALS['db']->XMFnum($row['lid']);
    $title  = stripslashes($row['title']);
    $title2 = ereg_replace("_", " ", $title);
    $content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a href=\"modules.php?name=Web_Links&amp;l_op=viewlinkdetails&amp;lid=$lid&amp;ttitle=$title\">$title2</a><br />";
    $a++;
}

closecacheb ( "".$content."", 'Top10Links', 'html' , "".CACHE_BL_TOP10LINKS."", '1' );
}