<?php
/**
 * $Source: /home/cvs/nukescripts/modules/FAQ/includes/detailsfaq.php,v $
 * $Revision: 1.0.0-1 $
 * $Author: cyril $
 * $Date: 2006/06/30 16:46:04 $
 * Fix categorie manquante ( Bug 175 )
 * Fix cache non valide ( Bug 123 )
 */
/************************************************************************/
/* 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 Header("Location: index.php");



	$id_cat = $GLOBALS['db']->XMFnum($id_cat);
	if ($multilingual == 1) {
		$querylang = "WHERE `flanguage`='".$GLOBALS['db']->XMFlang($currentlang)."'";
	} else {
		$querylang = "";
	}
	$sql = "SELECT `categories` FROM `".TABLE_FAQCATEGORIES."` $querylang";
	if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain faqcategories modules', '', __LINE__, __FILE__, $sql);}
	$row1 = $GLOBALS['db']->sql_fetchrow($result);
	$categories = stripslashes(check_html($row1['categories'], "nohtml"));

	$pagetitle = "- $module_name - $categories";

	incoh( "FAQDetail$id_cat", 'html',  "".CACHE_VFAQ1."", '1' );

	Max_OpenTable();
	echo"<center><font class='content'><b>$sitename "._FAQ2."</b></font></center>";
	br('2');


	echo "<a name=\"top\"></a><br />" /* Bug fix : added missing closing hyperlink tag messes up display */
	.""._CATEGORY.": <a href=\"modules.php?name=$module_name\"><strong>"._MAIN."</strong></a> -> $categories";
	br('2');
	echo "<table width='100%' cellpadding='4' cellspacing='0' border='0'>"
	."<tr bgcolor=\"$bgcolor2\"><td colspan='2'><font class='option'><b>"._QUESTION."</b></font></td></tr><tr><td colspan='2'>";
	$sql = "SELECT `id`, `id_cat`, `question`, `answer` FROM `".TABLE_FAQANSWER."` WHERE `id_cat`='$id_cat'";
	if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain faqanswer modules', '', __LINE__, __FILE__, $sql);}
	while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
		$id       = $GLOBALS['db']->XMFnum($row['id']);
		$id_cat   = $GLOBALS['db']->XMFnum($row['id_cat']);
		$question = stripslashes(check_html($row['question'], "nohtml"));
		$answer   = stripslashes($row['answer']);
		echo "<strong><big>&middot;</big></strong>&nbsp;&nbsp;<a href=\"#$id\">$question</a><br />";
	}
	echo "</td></tr></table><br />";

	echo "<table width='100%' cellpadding='4' cellspacing='0' border='0'>"
	."<tr bgcolor=\"$bgcolor2\"><td colspan='2'><font class='option'><b>"._ANSWER."</b></font></td></tr>";
	$sql = "SELECT `id`, `id_cat`, `question`, `answer` FROM `".TABLE_FAQANSWER."` WHERE `id_cat`='$id_cat'";
	if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(CORE_ERROR, 'Could not obtain faqanswer modules', '', __LINE__, __FILE__, $sql);}
	while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
		$id       = $GLOBALS['db']->XMFnum($row['id']);
		$id_cat   = $GLOBALS['db']->XMFnum($row['id_cat']);
		$question = stripslashes(check_html($row['question'], "nohtml"));
		$answer   = stripslashes($row['answer']);
		echo "<tr><td><a name=\"$id\"></a>"
		."<strong><big>&middot;</big></strong>&nbsp;&nbsp;<b>$question</b>"
		."<p align='justify'>$answer</p>"
		."[ <a href='#top'>"._BACKTOTOP."</a> ]";
		br('2');
		echo "</td></tr>";
	}
	echo "</table>";
	br('2');
	echo "<div align='center'><b>[ <a href=\"modules.php?name=$module_name\">"._BACKTOFAQINDEX."</a> ]</b></div>";
	Max_CloseTable();

	$GLOBALS['db']->sql_freeresult($result);
	$GLOBALS['db']->sql_freeresult($result1);

	incof( "FAQDetail$id_cat", 'html',  "".CACHE_VFAQ1."", '1'  );