$user_histoClass = new User_histo(); session_start(); // On démarre la session AVANT toute chose if (isset($_SESSION["ip"])) { $user_ip = $_SESSION["ip"]; } if (isset($_SESSION["user_mail"])) { $user_mail = $_SESSION["user_mail"]; } $messageUpdate = "Tous les champs doivent être remplis."; if (isset($_POST['id']) and isset($_POST['updated_arg'])) { $arg_id = $_POST['id']; $arg_action = "arg_u"; $nb = $propClass->setNewProp($arg_id, $_POST['updated_arg'], $arg_action, $user_ip, $user_mail, $_SESSION['prop_arg_u_rank_default']); //proposition de modification pour un argument $user_histoClass->setUser_histo($user_mail, $debat_id, $arg_id, $arg_action, $user_ip); $_SESSION['message'] = htmlentities("Reformulation enregistrée. Pour le moment il s'agit d'une proposition. Si le score de la proposition devient suffisamment élevé, la reformulation remplacera l'argument"); } else { if (isset($_POST['id']) and isset($_POST['new_arg'])) { $debat_id = $_POST['id']; $arg_lib_fr = $_POST['new_arg']; $arg_action = "arg"; $nb = $propClass->setNewProp($debat_id, $arg_lib_fr, $arg_action, $user_ip, $user_mail, $_SESSION['prop_arg_rank_default']); //proposition d'ajout d'argument $user_histoClass->setUser_histo($user_mail, $debat_id, $arg_id, $arg_action, $user_ip); $_SESSION['message'] = htmlentities("Proposition d'argument enregistré. Pour le moment il s'agit d'une proposition. Si le score de la proposition devient suffisamment élevé, elle deviendra un argument"); } else { if (isset($_POST['new_debat_lib'])) { $arg_lib_fr = $_POST['new_debat_lib']; $arg_action = "debat"; $nb = $propClass->setNewProp("", $arg_lib_fr, $arg_action, $user_ip, $user_mail, $_SESSION['prop_debat_rank_default']);
if ($vote_type == "arg") { // $logClass->setNewLog($vote." ".$vote_id." ".$vote_type,$user_ip); $args = $argClass->getArgById($vote_id); $arg_id = $args[0]->arg_id; $debat_id = $args[0]->debat_id; $arg_rank = $args[0]->arg_rank; $arg_type = $args[0]->arg_type; $arg_link_id = $args[0]->arg_link_id; $arg_lib_fr = $args[0]->arg_lib_fr; // $arg_lib_fr = htmlentities($arg_lib_fr,ENT_QUOTES); //Convertit tous les caractères éligibles en entités HTML. // $logClass->setNewLog($arg_id." ".$arg_rank." ".$arg_type." ".$arg_link_id." ".$arg_lib_fr, $user_ip); if (isset($args) and $vote == "plus") { //vote + pour un argument $nb = $argClass->setArgByIdForRank($arg_id, intval($arg_rank) + 1); //ajouter le * user_rank $user_histoClass->setUser_histo($user_mail, $debat_id, $arg_id, $vote_type . $vote, $user_ip); $_SESSION['message'] = htmlentities("Vote + pour l'argument enregistré"); } else { if (isset($args) and $vote == "moins" and intval($arg_rank) > $_SESSION['prop_arg_rank_default']) { //vote - pour un argument $nb = $argClass->setArgByIdForRank($arg_id, intval($arg_rank) - 1); $user_histoClass->setUser_histo($user_mail, $debat_id, $arg_id, $vote_type . $vote, $user_ip); $_SESSION['message'] = htmlentities("Vote - pour l'argument enregistré"); } else { if (isset($args) and $vote == "moins" and intval($arg_rank) <= $_SESSION['prop_arg_rank_default']) { //vote - et suppression du débat ou de l'argument //$logClass->setNewLog($arg_id." ".$arg_rank." ".$arg_type." ".$arg_link_id." ".$arg_lib_fr, $user_ip); //$arg_lib_fr = $_POST['updated_arg']; $arg_action = "arg"; $nb = $propClass->setNewProp($debat_id, $arg_lib_fr, $arg_action, $user_ip, $user_mail, intval($arg_rank) - 1); //vote - passage de argument à proposition