FrameBeurk File
Fmbk/Module/Rhum/Commentaire/Maj/repondreCommentaire.php
<?php //FrameBeurk V0.65 Copyright ToolOscope 2016. Licence CeCILL-C.
if (! isset($_REQUEST["titre$IdMaj"]) || $_REQUEST["titre$IdMaj"] == '')
Beurk_messageEtape('Titre du commentaire obligatoire', true, 'Commentaire');
else {
$result1 = db_QUERY("SELECT IdElementDe, IdCommentaireRef FROM Rhum_Commentaire WHERE IdCommentaire = '$IdMaj'"); // recherche du commentaire en référence
if (list($IdElementDe, $IdCommentaireRef) = db_FETCH_ROW($result1)) {
if ($EtatEnsemble = Beurk_etat($IdElementDe)) {
if ($EtatEnsemble == 'V') { // Vérification discussion active
if ($IdCommentaireRef == 0) // les réponses aux réponses sont regroupées dans le commentaire initial
$IdCommentaireRef = $IdMaj;
$EtatCommentaire = (Uzers_estLogue()) ? 'V' : 'T';
$requete = array('INSERT' => 'Rhum_Commentaire',
'VALUES' => array('Commentaire' => Beurk_Request2DB($_REQUEST["titre$IdMaj"]),
'Donnees' => Beurk_Request2DB($_REQUEST["donnees$IdMaj"]),
'IdElementDe' => $IdElementDe,
'IdCommentaireRef' => $IdCommentaireRef,
'Alerte' => '',
'NbrVotes' => 0,
'Note' => 0));
if (Uzers_estAdmin())
$requete['VALUES']['Import'] = (isset($_REQUEST["import$IdMaj"])) ? Beurk_Request2DB($_REQUEST["import$IdMaj"]) : '';
if ($IdCommentaire = Beurk_creeEntite($requete, 'Réponse créée', $EtatCommentaire, $IdElementDe)) {
// incrementation nbre de commentaire et maj de la date de dernière modif du sujet
db_QUERY("UPDATE Rhum_Sujet SET NbrCommentaires = NbrCommentaires + 1, TsMajElements = " . $TRANSAC['Stat']['TsBeurkIni'] . " WHERE IdSujet = '$IdElementDe'"); //
// incrémentation nombre de commentaires créés par le user
db_QUERY("UPDATE Uzers_User SET NbrCommentaires = NbrCommentaires + 1 WHERE IdUser = '" . $DIALOG['IdUser'] . "'");
}
} else Beurk_messageEtape('Sujet fermé', true);
} else Beurk_messageEtape('Sujet inconnu', true);
} else Beurk_messageEtape('Commentaire initial non trouvé', true);
db_FREE($result1);
}
© 2010-2015 by ToolOscope SASU. © 2016-2018 by Arnaud De Rette. All rights reserved