<?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");

$id = $db->XMFnum($id);
 	incoh();
	Max_OpenTable();
	if (($id == 0) || (!is_admin($admin)))
	echo "This function must be passed argument id, or you are not admin.";
	else if (($id != 0) && (is_admin($admin)))
	{
		$result = $db->sql_query("SELECT * from `".TABLE_REVIEWS."` where `id` = '$id'");
		while ($myrow = $db->sql_fetchrow($result)) {
			$id = $db->XMFnum($myrow['id']);
			$date = stripslashes($myrow['date']);
			$title = stripslashes($myrow['title']);
			$title = stripslashes(FixQuotes(check_html($title, nohtml)));
			$text = stripslashes($myrow['text']);
			$cover = stripslashes($myrow['cover']);
			$reviewer = stripslashes($myrow['reviewer']);
			$email = stripslashes($myrow['email']);
			$hits = $db->XMFnum($myrow['hits']);
			$url = stripslashes($myrow['url']);
			$url_title = stripslashes(check_html($myrow['url_title'], "nohtml"));
			$score = $db->XMFnum($myrow['score']);
			$rlanguage = stripslashes($myrow['rlanguage']);
		}
		echo "<center><b>"._REVIEWMOD."</b></center><br /><br />";
		echo "<form method='POST' action='modules.php?name=$module_name&rop=preview_review'><input type='hidden' name='id' value='$id' />";
		echo "<table border='0' width='100%'>
			<tr>
				<td width='12%'><b>"._RDATE."</b></td>
				<td><input type='text' name='date' size='15' value=\"$date\" maxlength='10' /></td>
			</tr>
			<tr>
				<td width='12%'><b>"._RTITLE."</b></td>
				<td><input type='text' name='title' size='50' maxlength='150' value=\"$title\" /></td>
			</tr>
			<tr>";
		echo "<td width='12%'><b>"._LANGUAGE."</b></td>
				<td><select name=\"rlanguage\">";
		$handle=opendir('language');
		while ($file = readdir($handle)) {
			if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
				$langFound = $matches[1];
				$languageslist .= "$langFound ";
			}
		}
		closedir($handle);
		$languageslist = explode(" ", $languageslist);
		for ($i=0; $i < sizeof($languageslist); $i++) {
			if($languageslist[$i]!="") {
				echo "<option value=\"$languageslist[$i]\" ";
				if($languageslist[$i]==$rlanguage) echo "selected";
				echo ">$languageslist[$i]</option>\n";
			}
		}

		echo "</select></td></tr>";
		echo "<tr>
				<td width='12%'><b>"._RTEXT."</b></td>
				<td><textarea class='textbox' name='text' rows='20' wrap='virtual' cols='60'>$text</TEXTAREA></td>
			</tr>
			<tr>
				<td width='12%'><b>"._REVIEWER."</b></td>
				<td><input type='text' name='reviewer' size='41' maxlength='40' value=\"$reviewer\" /></td>
			</tr>
			<tr>
				<td width='12%'><b>"._REVEMAIL."</b></td>
				<td><input type='text' name='email' value=\"$email\" size='30' maxlength='80' /></td>
			</tr>
			<tr>
				<td width='12%'><b>"._SCORE."</b></td>
				<td><input type='text' name='score' value=\"$score\" size='3' maxlength='2' /></td>
			</tr>
			<tr>
				<td width='12%'><b>"._RLINK."</b></td>
				<td><input type='text' name='url' value=\"$url\" size='30' maxlength='100' /></td>
			</tr>
			<tr>
				<td width='12%'><b>"._RLINKTITLE."</b></td>
				<td><input type='text' name='url_title' value=\"$url_title\" size='30' maxlength='50' /></td>
			</tr>
			<tr>
				<td width='12%'><b>"._COVERIMAGE."</b></td>
				<td><input type='text' name='cover' value=\"$cover\" size='30' maxlength='100' /></td>
			</tr>
			<tr>
				<td width='12%'><b>"._HITS.":</b></td>
				<td><input type='text' name='hits' value=\"$hits\" size='5' maxlength='5' /></td>
			</tr>
		</table>";
		echo "<input type='hidden' name='rop' value='preview_review' /><input type='submit' value=\""._PREMODS."\" />&nbsp;&nbsp;<input type='button' onClick='history.go(-1)' value="._CANCEL." /></form>";
	}
	Max_CloseTable();
 	incof();