0 && $allow_avis==0) { $log_ok=1; $allow_avis=1; $allow_avis_ajout=false ; } // pour template des avis require_once($base_path.'/includes/templates/avis.tpl.php'); print $popup_header; if ($opac_avis_allow && !$allow_avis) die($popup_footer); print $avis_tpl_header ; switch($todo) { case 'save': if (!$allow_avis_ajout || !$noticeid) die(); if (!$note) $note="NULL"; $masque="@<[\/\!]*?[^<>]*?>@si"; $commentaire = preg_replace($masque,'',$commentaire); if($charset != "utf-8") $commentaire=cp1252Toiso88591($commentaire); $sql="insert into avis (num_empr,num_notice,note,sujet,commentaire) values ('$id_empr','$noticeid','$note','$sujet','$commentaire')"; if (mysql_query($sql, $dbh)) { print $avis_tpl_post_add; } else { print $avis_tpl_post_add_pb; } break; case 'add' : if (!$allow_avis_ajout) die(); //ajout d'un avis echo $avis_tpl_form; break; default: case 'liste' : if ($log_ok && $allow_avis && $allow_avis_ajout) echo "
"; //affichage de la liste des avis //moyenne des notes $sql="select avg(note) as m from avis where valide=1 and num_notice='".$noticeid."' group by num_notice"; $r = mysql_query($sql, $dbh); $loc = mysql_fetch_object($r); $moyenne=number_format($loc->m,1, ',', ''); $c_notice = new notice_affichage($noticeid,""); $etoiles_moyenne = $c_notice->stars(); //liste des témoignages $requete="select note,sujet,commentaire,DATE_FORMAT(dateajout,'".$msg['format_date']."') as ladate,empr_login,empr_nom, empr_prenom from avis left join empr on id_empr=num_empr where valide=1 and num_notice='".$noticeid."' order by dateajout desc"; $r = mysql_query($requete, $dbh); if (mysql_numrows($r)){ echo "