<?php
    
/**
     *    Forum Module for Mambo portal
     *
     *    09-07-2002
      *
     *    Copyright (C) 2002 Emir Sakic
     *    Distributed under the terms of the GNU General Public License
     *    This software may be used without warranty provided and statements are left intact.
     *    This source is available at http://www.superbosna.com/mambo_hacks
     *
     *    Mambo is Copyright (C) 2000-2001 Miro Construct Pty Ltd
     *    Source is available at http://sourceforge.net/projects/mambo
     *    Site Name: Mambo Open Source Edition Version 3.0.5 - 3.0.7
     *    File Name: forummodule.php
     *    Developer: Emir Sakic - saka@hotmail.com
     *    Date: 09/07/2002
     *     Version #: 1.0
     *    Comments: This script displays links of latest posts of your Mambo (LoudMouth) forum.
     *            It's written as Mambo component. You will need to add an entry into the
     *            components database table. After installation upload forummodule.php
     *            and replace / hack rightComponent.php and/or leftComponent.php.
     *            Then upload this script and you can place this module as any other
     *            Mambo component throught control panel.
     *            Demo can be viewed at http://www.superbosna.com
    **/

/*  Configurations  */

    
$PostNumber "10";        // How many topics to display

/*  Make no changes below this line (unless you know what you are doing)  */

    
$query2 "SELECT id, author, subject, date, time, replytoid, forumid FROM messages WHERE published=1 ORDER BY date DESC, time DESC LIMIT $PostNumber";
    
$result2=$database->openConnectionWithReturn($query2);

    
$content="
<!--
Forum Module for Mambo portal
Copyright (C) 2002 Emir Sakic http://www.sakic.net GNU GPL
Source is available at http://www.superbosna.com/mambo_hacks
-->
"
;

    
// Use mysql_fetch_array to retrieve the results
    
$num mysql_num_rows($result2);
    if (
$num 0){
        while (
$row mysql_fetch_object($result2)){
            
$id $row->id;
            
$author $row->author;
            
$subject $row->subject;
            
$date $row->date;
            
$time $row->time;
            
$replytoid $row->replytoid;
            
$forumid $row->forumid;

            
$query3 "SELECT forumname, moderatorid FROM forum WHERE id=$forumid";
            
$nameresult $database->openConnectionWithReturn($query3);
            
$row mysql_fetch_object($nameresult);
            
$forumName $row->forumname;

            
$content.="<a href=\"#\" onClick=\"javascript: window.open('$live_site/forum/";
            
$content.="mainpage.php?option=viewMessage&forumid=$forumid&id=$id";
            if (
$replytoid!=0$content.="&replyid=$replytoid&displayType=Reply";
            
$content.="', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550');\">";

            
$subject stripslashes($subject);
            
$subject ereg_replace("RE: """$subject); //Take out annoying RE: 's
            
if (strlen($subject)>20$subject substr($subject020) . "...";

            
$content.="$subject";
                                    
// You can display author, time, forum name or even message here
            
$content.="</A>";
            
$content.="<br>\n";
        }
    }
?>