id_hub=intval(trim($_POST["hub_id"])); else $hub->id_hub=intval(trim($_POST["liste_hubs"])); $form["hub"]=$hub; $post=new FclFlux_post($form); if(!empty($post->erreurs)) $msg_form=array_merge($post->erreurs,$msg_form); if(empty($msg_form)) { if(!empty($_POST["id_post"])) {// mise à jour d'un post $post->id_post=intval(trim($_POST["id_post"])); $action=$post->actualise(); } else {//enregistrement d'un nouveau post. $auteur=new FclFlux_utilisateur(); $auteur->id_utilisateur=intval(trim($_POST["auteur_id"])); $post->set_auteur($auteur); if(empty($post->erreurs)) $action=$post->ajout(); } if(!empty($post->erreurs)) $msg_form=array_merge($post->erreurs,$msg_form); elseif($action===false) $msg_form[]=ERREUR_IMPREVUE; if(empty($msg_form)) { $msg_form[]=MSG_ADMIN_VALID; $form["id_post"]=$post->id_post;//utile pour réaffichage si pas en ajax } } $Bd=null; } } if((!empty($msg_form))&&($ajax_on)) { if(($msg_form[0]==MSG_ADMIN_VALID)&&(!empty($post->id_post))) echo $post->id_post;//tout s'est bien passé, je recharge le post en ajax else echo get_html_alerte_msg($msg_form); }