check(1);
include dirname(__FILE__).'/inc/connexion.php';
$err = '';
$is_editable = false;
$comment_id = '';
$comment_dt = '';
$comment_auteur = '';
$comment_email = '';
$comment_site = '';
$comment_content = '';
$comment_pub = '';
$comment_ip = '';
$post_titre = '';
$post_id = '';
$user_id = '';
if (!empty($_REQUEST['comment_id']))
{
$comment = $blog->getComment($_REQUEST['comment_id']);
if ($comment->isEmpty()) {
$err = '
- '.__('No comment yet.').'
';
} else {
$comment_id = $comment->f('comment_id');
$comment_ldate = dt::str(__('On %A %e %B %Y, %I:%M %p'),$comment->getTS());
$comment_auteur = $comment->f('comment_auteur');
$comment_email = $comment->f('comment_email');
$comment_site = $comment->f('comment_site');
$comment_content = $comment->f('comment_content');
$comment_pub = (integer) $comment->f('comment_pub');
$comment_ip = $comment->f('comment_ip');
$post_titre = $comment->f('post_titre');
$post_id = $comment->f('post_id');
if ($comment->f('user_id') == $_SESSION['sess_user_id'] || $_SESSION['sess_user_level'] == 9)
{
$is_editable = true;
}
}
}
# On arrête tout si le commentaire est pas éditable
if (!$is_editable)
{
$err = '- '.__('You are not allowed to edit a comment').'
';
}
# Modification du commentaire
if (!empty($_POST['update']) && $is_editable)
{
$comment_auteur = $_POST['c_auteur'];
$comment_email = $_POST['c_email'];
$comment_site = preg_replace('|^http://|','',$_POST['c_site']);
$comment_content = $_POST['c_content'];
$comment_pub = $_POST['c_pub'];
if ($blog->updComment($comment_id,$comment_auteur,$comment_email,
$comment_site,$comment_content,$comment_pub) !== false) {
header('Location: poster.php?post_id='.$post_id.'#c'.$comment_id);
exit;
} else {
$err = $blog->error(1);
}
}
# Suppression du commentaire
if (!empty($_POST['delete']) && $is_editable)
{
if ($blog->delComment($comment_id) !== false) {
header('Location: poster.php?post_id='.$post_id.'#comments');
exit;
} else {
$err = $blog->error(1);
}
}
if ($comment_id)
{
$mySubMenu->addItem(
__('XHTML validation'),
array('validpost.php?co_id='.$comment_id,'onclick="popup(this.href); return false;"'),
'images/ico_ok.png',false);
}
openPage(__('Comment'));
if ($err != '')
{
echo ''.__('Error(s)').' :
'.
$err.'
';
}
if ($is_editable)
{
?>
:
: