<?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                                 */
/************************************************************************/
defined('MAXIMUS') or Header("Location: index.php");

incoh();
	$letter = substr("$rop", 0,1);
	if ($multilingual == 1) {
		$querylang = "AND `rlanguage`='$currentlang'";
	} else {
		$querylang = "";
	}
	Max_OpenTable();
	echo "<center><b>$sitename "._REVIEWS."</b><br />";
	echo "<i>"._REVIEWSLETTER." \"$letter\"</i>";
	br('2');
	switch ($field) {

		case "reviewer":
		$result = $db->sql_query("SELECT id, title, hits, reviewer, score FROM ".TABLE_REVIEWS." WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by reviewer $order");
		break;

		case "score":
		$result = $db->sql_query("SELECT id, title, hits, reviewer, score FROM ".TABLE_REVIEWS." WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by score $order");
		break;

		case "hits":
		$result = $db->sql_query("SELECT id, title, hits, reviewer, score FROM ".TABLE_REVIEWS." WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by hits $order");
		break;

		default:
		$result = $db->sql_query("SELECT id, title, hits, reviewer, score FROM ".TABLE_REVIEWS." WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
		break;

	}
	$numresults = $db->sql_numrows($result);
	if ($numresults == 0) {
		echo "<i><b>"._NOREVIEWS." \"$letter\"</b></i><br /><br />";
	} elseif ($numresults > 0) {
		echo "<table border=\"0\" width=\"100%\" cellpadding=\"2\" cellspacing=\"4\">
		<tr>
		<td width=\"50%\" bgcolor=\"$bgcolor4\">
		<p align=\"left\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=title&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" alt=\""._SORTASC."\" /></a><b> "._PRODUCTTITLE." </b><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=title&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" alt=\""._SORTDESC."\" /></a>
		</td>
		<td width=\"18%\" bgcolor=\"$bgcolor4\">
		<p align=\"center\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=reviewer&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" alt=\""._SORTASC."\" /></a><b> "._REVIEWER." </b><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=reviewer&amp;order=desc\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" alt=\""._SORTDESC."\" /></a>
		</td>
		<td width=\"18%\" bgcolor=\"$bgcolor4\">
		<p align=\"center\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" alt=\""._SORTASC."\" /></a><b> "._SCORE." </b><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" alt=\""._SORTDESC."\" /></a>
		</td>
		<td width=\"14%\" bgcolor=\"$bgcolor4\">
		<p align=\"center\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=hits&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" alt=\""._SORTASC."\" /></a><b> "._HITS." </b><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=hits&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" alt=\""._SORTDESC."\" /></a>
		</td>
		</tr>";
		while($myrow = $db->sql_fetchrow($result)) {
			$title    = stripslashes(check_html($myrow["title"], "nohtml"));
			$id       = $db->XMFnum($myrow['id']);
			$reviewer = stripslashes($myrow['reviewer']);
			$email    = stripslashes($myrow['email']);
			$score    = $db->XMFnum($myrow['score']);
			$hits     = $db->XMFnum($myrow['hits']);
			echo "<tr>
		    <td width=\"50%\" bgcolor=\"#EEEEEE\"><a href=\"modules.php?name=$module_name&amp;rop=showcontent&amp;id=$id\">$title</a></td>
		    <td width=\"18%\" bgcolor=\"#EEEEEE\">";
			if ($reviewer != "")
			echo "<center>$reviewer</center>";
			echo "</td><td width=\"18%\" bgcolor=\"#EEEEEE\"><center>";
			display_score($score);
			echo "</center></td><td width=\"14%\" bgcolor=\"#EEEEEE\"><center>$hits</center></td>
		  </tr>";
		}
		echo "</table>";
		echo "<br />$numresults "._TOTALREVIEWS."<br /><br />";
	}
	echo "[ <a href=\"modules.php?name=$module_name\">"._RETURN2MAIN."</a> ]";
	Max_CloseTable();
 incof();