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

if (eregi("<!--pagebreak-->", $text)) {
		$text = ereg_replace("<!--pagebreak-->","&lt;!--pagebreak--&gt;",$text);
	}
	$title = stripslashes(check_html($title, "nohtml"));
	$text = stripslashes(check_html($text, ""));
	$reviewer = stripslashes(check_html($reviewer, "nohtml"));
	$url_title = stripslashes(check_html($url_title, "nohtml"));
	$email = stripslashes(check_html($email, "nohtml"));
	$score = $db->XMFnum($score);
	$cover = stripslashes(check_html($cover, "nohtml"));
	$url = stripslashes(check_html($url, "nohtml"));
	$url_title = stripslashes(check_html($url_title, "nohtml"));
	$hits = $db->XMFnum($hits);
	$id = $db->XMFnum($id);
 	incoh();
	Max_OpenTable();
	echo "<form method=\"post\" action=\"modules.php?name=$module_name\">";

	if ($title == "") {
		$error = 1;
		echo ""._INVALIDTITLE."<br />";
	}
	if ($text == "") {
		$error = 1;
		echo ""._INVALIDTEXT."<br />";
	}
	if (($score < 1) || ($score > 10)) {
		$error = 1;
		echo ""._INVALIDSCORE."<br />";
	}
	if (($hits < 0) && ($id != 0)) {
		$error = 1;
		echo ""._INVALIDHITS."<br />";
	}
	if ($reviewer == "" || $email == "") {
		$error = 1;
		echo ""._CHECKNAME."<br />";
	} else if ($reviewer != "" && $email != "")
	if (!(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email))) {
		$error = 1;
		/* eregi checks for a valid email! works nicely for me! */
		echo ""._INVALIDEMAIL."<br />";
	}
	if (($url_title != "" && $url =="") || ($url_title == "" && $url != "")) {
		$error = 1;
		echo ""._INVALIDLINK."<br />";
	} else if (($url != "") && (!(eregi('(^http[s]*:[/]+)(.*)', $url))))
	$url = "http://" . $url;
	/* If the user ommited the http, this nifty eregi will add it */
	if ($error == 1)
	echo "<br />"._GOBACK."";
	else
	{
		if ($date == "")
		$date = date("Y-m-d", time());
		$year2 = 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,$year2));
		echo "<table border=\"0\" width=\"100%\"><tr><td colspan=\"2\">";
		echo "<p><font class='title'><i><b>$title</b></i></font><br />";
		echo "<blockquote><p>";
		if ($cover != "")
		echo "<img src=\"images/reviews/$cover\" align=\"right\" border=\"1\" vspace=\"2\" alt=\"\" />";
		echo "$text<p>";
		echo "<b>"._ADDED."</b> $fdate<br />";
		if ($multilingual == 1) {
			echo "<b>"._LANGUAGE."</b> $rlanguage<br />";
		}
		echo "<b>"._REVIEWER."</b> <a href=\"mailto:$email\">$reviewer</a><br />";
		echo "<b>"._SCORE."</b> ";
		display_score($score);
		if ($url != "")
		echo "<br /><b>"._RELATEDLINK.":</b> <a href=\"$url\" target=\"new\">$url_title</a>";
		$id = $db->XMFnum($id);
		if ($id != 0) {
			echo "<br /><b>"._REVIEWID.":</b> $id<br />";
			echo "<b>"._HITS.":</b> $hits<br />";
		}
		echo "</font></blockquote>";
		echo "</td></tr></table>";
		$text = urlencode($text);
		echo "<p><i>"._LOOKSRIGHT."</i> ";
		echo "<input type=\"hidden\" name=\"id\" value='$id' />
		  <input type=\"hidden\" name=\"hits\" value=\"$hits\" />
		  <input type=\"hidden\" name=\"rop\" value='send_review' />
		  <input type=\"hidden\" name=\"date\" value=\"$date\" />
		  <input type=\"hidden\" name=\"title\" value=\"$title\" />
		  <input type=\"hidden\" name=\"text\" value=\"$text\" />
		  <input type=\"hidden\" name=\"reviewer\" value=\"$reviewer\" />
		  <input type=\"hidden\" name=\"email\" value=\"$email\" />
		  <input type=\"hidden\" name=\"score\" value=\"$score\" />
		  <input type=\"hidden\" name=\"url\" value=\"$url\" />
		  <input type=\"hidden\" name=\"url_title\" value=\"$url_title\" />
		  <input type=\"hidden\" name=\"cover\" value=\"$cover\" />";
		echo "<input type=\"hidden\" name=\"rlanguage\" value=\"$rlanguage\" />";
		echo "<input type=\"submit\" name=\"rop\" value=\""._YES."\" /> <input type=\"button\" onClick=\"history.go(-1)\" value=\""._NO."\" />";
		$id = $db->XMFnum($id);
		if($id != 0)
		$word = ""._RMODIFIED."";
		else
		$word = ""._RADDED."";
		if(defined('ADMIN_ALLOW'))
		echo "<br /><br /><b>"._NOTE."</b> "._ADMINLOGGED." $word.";
	}
	Max_CloseTable();
 	incof();