$message = $topic->create($_POST['contenu']); } catch (Exception $e) { $error = $e->getMessage(); } if (empty($error)) { // $_SERVER // url du fichier index.php header('Location: ' . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . 'home/' . $topic->getCategory()->getCategory() . '/' . urlencode($topic->getTitre())); exit; } } else { //Récupération des infos message, topic, category if (isset($_GET['id'])) { $id = $_GET['id']; $manager = new Topic($link); $message = $manager->selectById($id); $topic = $message->getTopic(); $categorie = $topic->getCategory(); $categoryName = $topic->getCategory()->getCategory(); $topicName = urlencode($topic->getTitre()); } //Mise à jour d'un message if (isset($_POST['update'], $_POST['contenu'])) { try { $message->setContenu($_POST['contenu']); } catch (Exception $e) { $error = $e->getMessage(); } if (empty($error)) { $topic->update($message); // /!\ header('Location : ');
$manager = new CategorieManager($link); try { $manager->create($_POST['nom']); } catch (Exception $e) { $error = $e->getMessage(); } } elseif (isset($_POST['delete'], $_GET['id'])) { $manager = new CategorieManager($link); $manager->delete($_GET['id']); } elseif (isset($_POST['update'], $_POST['nom'], $_GET['id'])) { $manager = new CategorieManager($link); $category = $manager->select($_GET['id']); $category->setTitre($_POST['nom']); $manager->update($category); } elseif (isset($_POST['update'], $_POST['statut'], $_GET['id'])) { $manager = new UserManager($link); $user = $manager->selectById($_GET['id']); $user->setStatut($_POST['statut']); $manager->update($user); } elseif (isset($_POST['bannir'], $_GET['id'])) { $manager = new UserManager($link); $user = $manager->selectById($_GET['id']); $manager->ban($user); } elseif (isset($_POST['reset'], $_GET['id'])) { // /!\ $topic = new Topic($link); $message = $topic->selectById($_GET['id']); $message->resetSignalement(); $topic->update($message); } }