en | fr  | Contact  | Print  | Share

FrameBeurk File

Fmbk/Module/Rhum/News/Maj/creeNews.php

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

if (! isset($_REQUEST["titre$IdMaj"]) || $_REQUEST["titre$IdMaj"] == '')
    
Beurk_messageEtape('Titre de la nouvelle obligatoire'true"titre$IdMaj");
else {
    
$IdNews $CONFIG['Entite']['News']['Id'];
    
$result db_QUERY("SELECT IdEtat FROM Rhum_Sujet WHERE IdSujet = '$IdNews'");
    if (list(
$IdEtatSujet) = db_FETCH_ROW($result)) {

        if (
$IdEtatSujet == Beurk_id('V')) {            //Vérification discussion active
        
            
$requete = array('INSERT' => 'Rhum_Commentaire',
                            
'VALUES' => array('Commentaire' => Beurk_Request2DB($_REQUEST["titre$IdMaj"]),
                                        
'Donnees' => Beurk_Request2DB($_REQUEST["donnees$IdMaj"]),
                                        
'IdElementDe' => $IdNews,                        //les news sont des commentaires rattachées à l'entité "News"
                                        
'IdCommentaireRef' => 0,
                                        
'Alerte' => '',
                                        
'NbrVotes' => 0,
                                        
'Note' => 0));

            if (
$IdCommentaire Beurk_creeEntite($requete'Nouvelle créée''V'$IdNews'Commentaire'))
                
// 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 = '$IdNews'"); 

        } else 
Beurk_messageEtape('News fermées'true);

        
db_FREE($result);
    }
}


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