<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2001 by Francisco Burzi (fbc@mandrakesoft.com)         */
/* http://phpnuke.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.       */
/************************************************************************/
/* Blocco Ultime dal Forum  											*/
/* =========================											*/
/*																		*/
/* Autore: Giorgio Ciranni {Splatt}										*/
/* http://www.splatt.it													*/
/* webmaster@splatt.it												    */	/*																		*/
/************************************************************************/ 

if (eregi("block-Forums.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

global $prefix;

$result = mysql_query("SELECT   t1.topic_id,t1.topic_title,t1.topic_time,t1.forum_id  FROM ${prefix}_forums t0,${prefix}_forumtopics t1   WHERE t0.forum_type = 0  AND t0.forum_id = t1.forum_id     ORDER BY t1.topic_time  DESC  LIMIT 0, 10");
while(list($topic_id, $topic_title, $topic_time, $forum_id) = mysql_fetch_row($result)) {
    $res = mysql_query("select image from ".$prefix."_posts where topic_id='$topic_id'");
    list ($image) = mysql_fetch_row($res);
    if($image == "") {
	$image= "icon33.gif";
    }
    $title2 = ereg_replace("_", " ", $topic_title);
    $title2 = stripslashes($title2);
    $title3 = substr("$title2", 0,18);
    $content1 .= "<table><tr><td width=\"25\"><img src=\"images/forum/subject/$image\" alt=\"$title2 - $topic_time\"></td><td><a href=\"modules.php?name=Forums&amp;file=viewtopic&amp;topic=$topic_id&amp;forum=$forum_id \">  $title3...</a></td></tr>";
}

$content = "<center><form action=\"modules.php?name=Forums&amp;file=searchbb\" method=\"post\">";
$content .= "<input type=\"hidden\" name=\"addterm\" value=\"any\">";
$content .= "<input type=\"hidden\" name=\"sortby\" value=\"p.post_time\">";
$content .= "<table width=\"95%\"><tr><td class=\"headgreyline\" align=\"center\"><b>Cerca nei Forum</b><br>&nbsp;<input type=\"text\" name=\"term\" class=\"formbut\" size=\"15\">";
$content .= "<input type=\"hidden\" name=\"submit\" value=\"submit\"><br>[ <a href=\"modules.php?name=Forums&amp;file=index\"><i>Indice Forum</i></a> ]</form>";
$content .= "</td></tr></table>";
$content .= "<i>Ultimi dieci messaggi.</i></center><br>$content1 </table><br><center><hr width=\"50%\"><a href=\"http://www.splatt.it\" target=\"_blank\">Splatt Forum V 3.1 in testing!</a></center>";

?>
