<?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                                 */
/************************************************************************/
/********************************************************/
/* NSN News                                             */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright  2000-2005 by NukeScripts Network         */
/********************************************************/
defined('MAXIMUS') OR die('Access denied associates directly');

$module_name = "News";
get_lang($module_name);
$sid = $db->XMFnum($sid);
$sql = "SELECT * FROM `".TABLE_STORIES."` WHERE `sid`='$sid' ";
if ( !($result= $db->sql_query($sql)) )
{ query_die(MODULE_ERROR, 'Could not SELECT stories WebSite', '', __LINE__, __FILE__, $sql);}

$araow = $db->sql_fetchrow($result);
$associatedx = stripslashes( $araow['associated'] );

 if(!empty($associatedx)) {
    Max_OpenTable();
    echo "<center><b>"._ASSOTOPIC."</b>";
    br('2');
    $asso_t = explode("-",$associatedx);
    for ($i=0; $i<sizeof($asso_t); $i++) {
	if (!empty($asso_t[$i])) {
	    $asso_t[$i] = $db->XMFnum( $asso_t[$i] );
	    $sqla = "SELECT `topicimage`, `topictext` FROM `".TABLE_TOPICS."` WHERE `topicid`='$asso_t[$i]'";
	    if ( !($aresult= $db->sql_query($sqla)) )
{ query_die(MODULE_ERROR, 'Could not obtain _topics', '', __LINE__, __FILE__, $sqla);}
	    $atop = $db->sql_fetchrow($aresult);
	    echo "<a href=\"modules.php?name=$module_name&amp;new_topic=$asso_t[$i]\"><img src=\"$tipath$atop[topicimage]\" border=\"0\" hspace=\"10\" alt=\"$atop[topictext]\" title=\"$atop[topictext]\" /></a>";
	    $db->sql_freeresult($aresult);
	}
    }
    echo "</center>";
    Max_CloseTable();
}
$db->sql_freeresult($result);