<?php
/**
 * $Source: /home/cvs/nukescripts/modules/Reviews/includes/showcontent.php,v $
 * $Revision: 1.0.0-1 $
 * $Author: cyril $
 * $Date: 2006/08/01 11:44:01 $
 * Fix 'aucun article' ( Bug 136 ) philippe_jmh
 */
/************************************************************************/
/* 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   = $GLOBALS['db']->XMFnum($id);
	$page = $GLOBALS['db']->XMFnum($page);
 	incoh();
	Max_OpenTable();
	if (($page == 1) OR ($page == "")) {
		$GLOBALS['db']->sql_query("UPDATE `".TABLE_REVIEWS."` SET `hits`=hits+1 WHERE `id`='$id'");
	}
	$result       = $GLOBALS['db']->sql_query("SELECT * FROM `".TABLE_REVIEWS."` WHERE `id`='$id'");
	$myrow        = $GLOBALS['db']->sql_fetchrow($result);
	$id           = $GLOBALS['db']->XMFnum($myrow['id']);
	$date         = stripslashes($myrow['date']);
	$year         = substr($date,0,4);
	$month        = substr($date,5,2);
	$day          = substr($date,8,2);
	//$fdate        = date("F jS Y",mktime (0,0,0,$month,$day,$year));
	$fdate        = date("j m Y",mktime (0,0,0,$day,$month,$year));
	$title        = stripslashes(FixQuotes(check_html($myrow['title'], "nohtml")));
	$text         = stripslashes($myrow['text']);
	$cover        = stripslashes($myrow['cover']);
	$reviewer     = stripslashes($myrow['reviewer']);
	$email        = stripslashes($myrow['email']);
	$hits         = $GLOBALS['db']->XMFnum($myrow['hits']);
	$url          = stripslashes($myrow['url']);
	$url_title    = stripslashes($myrow['url_title']);
	$score        = $GLOBALS['db']->XMFnum($myrow['score']);
	$rlanguage    = stripslashes($myrow['rlanguage']);
	$contentpages = explode( "<!--pagebreak-->", $text );
	$pageno       = count($contentpages);
	if ( $page=="" || $page < 1 )
	$page = 1;
	if ( $page > $pageno )
	$page = $pageno;
	$arrayelement = (int)$page;
	$arrayelement --;
	echo "<p>&nbsp;<font class='title'><i><b>$title</b></i></font><br />"
	    ."<blockquote><p align='justify'>";
	if ($cover != "") {
		echo "<img src='images/reviews/$cover' align='right' border='1' vspace='2' alt='' />";
	}
	echo "$contentpages[$arrayelement]</blockquote><p>";
	if (defined('ADMIN_ALLOW'))
	echo "<b>"._ADMIN."</b> [ <a href='modules.php?name=$module_name&amp;rop=mod_review&amp;id=$id'>"._EDIT."</a> | <a href='modules.php?name=$module_name&amp;rop=del_review&amp;id_del=$id'>"._DELETE."</a> ]<br />"
	    ."<b>"._ADDED."</b> $fdate<br />";
	if ($reviewer != "")
	echo "<b>"._REVIEWER."</b> <a href='mailto:$email'>$reviewer</a><br />";
	if ($score != "")
	echo "<b>"._SCORE."</b> ";
	display_score($score);
	if ($url != "") {
		echo "<br /><b>"._RELATEDLINK.":</b> <a href='$url' target='new'>$url_title</a>";
	}
	echo "<br /><b>"._HITS.":</b> $hits"
	    ."<br /><b>"._LANGUAGE.":</b> $rlanguage";
	if ($pageno > 1) {
		echo "<br /><b>"._PAGE.":</b> $page/$pageno<br />";
	}
	echo "</font></center>";
	$title = urlencode($title);
	if($page >= $pageno) {
		$next_page = "";
	} else {
		$next_pagenumber = $page + 1;
		if ($page != 1) {
			$next_page .= "<img src='images/blackpixel.gif' width='10' height='2' border='0' alt='' /> &nbsp;&nbsp; ";
		}
		$next_page .= "<a href='modules.php?name=$module_name&amp;rop=showcontent&amp;id=$id&amp;page=$next_pagenumber'>"._NEXT." ($next_pagenumber/$pageno)</a> <a href='modules.php?name=$module_name&amp;rop=showcontent&amp;id=$id&amp;page=$next_pagenumber'><img src='images/right.gif' border='0' alt='"._NEXT."' /></a>";
	}
	if($page <= 1) {
		$previous_page = "";
	} else {
		$previous_pagenumber = $page - 1;
		$previous_page = "<a href='modules.php?name=$module_name&amp;rop=showcontent&amp;id=$id&amp;page=$previous_pagenumber'><img src='images/left.gif' border='0' alt='"._PREVIOUS."' /></a> <a href='modules.php?name=$module_name&amp;rop=showcontent&amp;id=$id&amp;page=$previous_pagenumber'>"._PREVIOUS." ($previous_pagenumber/$pageno)</a>";
	}
	echo "<center>"
	."$previous_page &nbsp;&nbsp; $next_page<br /><br />"
	."[ <a href='modules.php?name=$module_name'>"._RBACK."</a> | "
	."<a href='modules.php?name=$module_name&amp;rop=postcomment&amp;id=$id&amp;title=$title'>"._REPLYMAIN."</a> ]";
	Max_CloseTable();
	if (($page == 1) OR ($page == "")) {
		br('1');
		r_comments($id, $title);
	}
 	incof();