-
Notifications
You must be signed in to change notification settings - Fork 0
/
modificarComentario.php
48 lines (37 loc) · 1.49 KB
/
modificarComentario.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once "/usr/local/lib/php/vendor/autoload.php";
include("bd.php");
$loader = new \Twig\Loader\FilesystemLoader('templates');
$twig = new \Twig\Environment($loader);
$conexion = new BDGestion();
$comentario = array();
session_start();
if(isset($_SESSION['nameUsuario'])) {
$usuario = $conexion->cargarUsuario($_SESSION['nameUsuario']);
}
$identificado = false;
if(isset($_SESSION['identificado'])) {
$identificado = true;
}
if(isset($_GET['comen']) && ctype_digit($_GET['comen'])) {
if($usuario['moderador'] == 1 && $identificado) {
$idComen = $_GET['comen'];
$comentario = $conexion->obtenerComentario($idComen);
$evento = $conexion->getEvento($idEv);
}
}
if(isset($_GET['ev']) && ctype_digit($_GET['ev'])) {
$idEven = $_GET['ev'];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if($usuario['moderador'] == 1 && $identificado) {
if(isset($_POST['comentario']) && !empty($_POST['comentario'])) {
$conexion->modificarComentario($idComen, htmlspecialchars($_POST['comentario']));
header("Location: evento.php?ev=" . $idEven);
}
}
exit();
}
$palabras = $conexion->getPalabrasCensuradas();
echo $twig->render('modificarComentario.html', ['evento' => $evento, 'comentario' => $comentario, 'palabras' => $palabras, 'identificado' => $identificado, 'usuario' => $usuario]);
?>