en | fr  | Contact  | Print  | Share

FrameBeurk File

Fmbk/Module/Rhum/Commentaire/Maj/creeCommentaire.php

<?php //FrameBeurk V0.65 Copyright ToolOscope 2016. Licence CeCILL-C.

if (! isset($_REQUEST["titre$IdMaj"]) || trim($_REQUEST["titre$IdMaj"]) == '')
    
Beurk_messageEtape('Titre du commentaire obligatoire'true"titre$IdMaj");
elseif ((! 
Uzers_estLogue()) && (! isset($_REQUEST['attention']) || $_REQUEST['attention'] != '1'))
    
Beurk_messageEtape("Merci d'acquitter le message d'attention"true'attention');    
elseif (
$IdRef == $CONFIG['Entite']['News']['Id'])
    
Beurk_messageEtape('Pas de commentaire dans les nouvelles'true);
else {
    if (
$EtatEnsemble Beurk_etat($IdRef)) {
        if (
$EtatEnsemble == 'V') {                                        // Vérification discussion active
            
$EtatCommentaire = (Uzers_estLogue()) ? 'V' 'T';
        
            
$requete = array('INSERT' => 'Rhum_Commentaire',
                        
'VALUES' => array('Commentaire' => Beurk_Request2DB(trim($_REQUEST["titre$IdMaj"])),
                                        
'Donnees' => Beurk_Request2DB($_REQUEST["donnees$IdMaj"]),
                                        
'IdElementDe' => $IdRef,
                                        
'IdCommentaireRef' => 0,
                                        
'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'Commentaire créé'$EtatCommentaire$IdRef)) {
                
// 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 = '$IdRef'");
            
                
// 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); 
}


© 2010-2015 by ToolOscope SASU. © 2016-2018 by Arnaud De Rette. All rights reserved