<?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 last 5 articles MAXIMUS directly...');

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

global $multilingual, $currentlang;

$multilingual = addslashes( $multilingual ) ;
$currentlang  = addslashes( $currentlang ) ;

if ($multilingual == 1) {
    $querylang = "WHERE (`alanguage`='$currentlang' OR `alanguage`='')";
} else {
    $querylang = "";
}
$content = "<table width='100%' border='0'>";
$sql = "SELECT `sid`, `title`, `comments`, `counter` FROM `".TABLE_STORIES."` $querylang ORDER BY `sid` DESC LIMIT 0,5";
if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(CORE_ERROR, 'Could not obtain _stories', '', __LINE__, __FILE__, $sql);}
while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
    $sid      = $GLOBALS['db']->XMFnum($row['sid']);
    $title    = stripslashes($row['title']);
    $comtotal = stripslashes($row['comments']);
    $counter  = $GLOBALS['db']->XMFnum($row['counter']);
    $content .= "<tr><td align=\"left\"><strong><big>&middot;</big></strong>&nbsp;<a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a></td><td align=\"right\">[ $comtotal "._COMMENTS." - $counter "._READS." ]</td></tr>";
}
$content .= "</table>";
$content .= "<br /><center>[ <a href=\"modules.php?name=News\">"._MORENEWS."</a> ]</center>";

closecacheb ( "".$content."", 'Last5Articles', 'html' , "".CACHE_BL_LAST5ARTICLES."", '1' );
}