<?php
/* Written by Gerben Schmidt, http://scripts.zomp.nl */
ob_start();
include_once("functions.php");
include('config.php');
include("session.php");
include("header.php");
$user = loadUser($_SESSION['login'],$link,$table_users);
if(!$_SESSION["loggedIn"] || !$user['admin']){ echo "You don't have enough privileges to view this page."; exit; }
else
{
$comment = loadOneComment($_GET[id],$link,$table_comments);
if($_POST[addreview]){
if(!$_POST[name])
{
$messages[]="$lang_message030";
}
if(!$_POST[comment])
{
$messages[]="$lang_error_comment";
}
if(empty($messages)) {
changeComment($comment['id'],$link,$table_comments);
header("Location: comments_editor.php?id=$comment[id]&message=8");
ob_end_flush();
}
}
$user = loadUser($_SESSION['login'],$link,$table_users);
?>
<div id="submenu"><a href="newentry.php" class="sub"><?php echo "$lang_newentry"; ?></a> | <a href="entry.php" class="sub"><?php echo "$lang_edit_delete"; ?></a><?php if($user[admin]){ ?> | <a href="comments.php" class="sub"><?php echo "$lang_manage_comments"; ?></a> | <a href="category.php" class="sub"><?php echo "$lang_manage_categories"; ?></a><?php } ?></div>
<div id="side">
<div class="title"> </div>
<div class="box"><?php
if(!empty($messages)){
displayErrors($messages);
}
elseif($_GET[message] && empty($messages)){
displayMessage($_GET[message]);
}
else{
echo "Edit the comment you just selected.";
}
?>
</div></div>
<div id="main">
<form method="POST" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h1><?php echo "$lang_edit_comment"; ?></h1></td>
<td><input type="submit" name="addreview" value="Submit ››" id="button" /></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<fieldset id="titlediv">
<legend><?php echo "$lang_comment_name"; ?></legend>
<input name="name" type="text" id="name" value="<?php echo "$comment[name]"; ?>"></fieldset></td>
</tr>
<tr>
<td class="title"> </td>
</tr>
<tr>
<td><fieldset id="titlediv">
<legend><?php echo "$lang_comment"; ?></legend><textarea name="comment" cols="65" rows="8" id="comment"><?php echo "$comment[comment]"; ?></textarea>
</fieldset> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><input type="submit" name="addreview" value="Submit ››" id="submit"></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form></div>
<?php
}
include("footer.php");
?>