Esempio n. 1
0
function rechercher_potins_d_un_groupe_de_user($id_user, $id_groupe, $bdd)
{
    $i = 0;
    // Recherche les potins du groupe
    $req = $bdd->prepare('SELECT id_potin
                          FROM potins
                          WHERE id_groupe = ?
                          ORDER BY date_potin DESC');
    $req->execute(array($id_groupe));
    while ($donnees = $req->fetch()) {
        // On cherche si l'utilisateur est concerné par le potin courant(et s'il l'a pas découvert)
        $req2 = $bdd->prepare('SELECT COUNT(*) FROM cor_potin_users WHERE id_concerne = ? AND id_potin = ? AND decouvert = 0');
        $req2->execute(array($id_user, $donnees['id_potin']));
        $donnees2 = $req2->fetch();
        $req2->closeCursor();
        // Si le potin est référencé
        $req3 = $bdd->prepare('SELECT COUNT(*) FROM cor_potin_users WHERE id_potin = ?');
        $req3->execute(array($donnees['id_potin']));
        $donnees3 = $req3->fetch();
        $req3->closeCursor();
        if ((!$donnees2['COUNT(*)'] || $donnees2['COUNT(*)'] && auteur_du_potin($donnees['id_potin'], $bdd) == $id_user) && $donnees3['COUNT(*)']) {
            $potins_cherches[$i] = $donnees['id_potin'];
            $i++;
        }
    }
    $req->closeCursor();
    if (isset($potins_cherches)) {
        return $potins_cherches;
    } else {
        return 0;
    }
}
<?php

include_once 'modele/requetes_vote.php';
if (isset($_POST['vote_potin']) && $_POST['vote_potin'] == 'ok') {
    if (!deja_vote($_POST['numero_potin'], $id_user, $bdd)) {
        include_once 'modele/infos_potin.php';
        if ($id_user != auteur_du_potin($_POST['numero_potin'], $bdd)) {
            if (isset($_POST['vote_positif']) && $_POST['vote_positif'] == 'vote_positif') {
                $req = $bdd->prepare('INSERT INTO vote_potin(id_auteur, id_potin, valeur) VALUES(?, ?, ?)');
                $req->execute(array($id_user, $_POST['numero_potin'], 1));
            } else {
                if (isset($_POST['vote_negatif']) && $_POST['vote_negatif'] == 'vote_negatif') {
                    $req = $bdd->prepare('INSERT INTO vote_potin(id_auteur, id_potin, valeur) VALUES(?, ?, ?)');
                    $req->execute(array($id_user, $_POST['numero_potin'], -1));
                } else {
                    if (isset($_POST['vote_neutre']) && $_POST['vote_neutre'] == 'vote_neutre') {
                        $req = $bdd->prepare('INSERT INTO vote_potin(id_auteur, id_potin, valeur) VALUES(?, ?, ?)');
                        $req->execute(array($id_user, $_POST['numero_potin'], 0));
                    }
                }
            }
            // On ajoute un point
            $req = $bdd->prepare('INSERT INTO points(id_user, valeur, date) VALUES(?, ?, NOW())');
            $req->execute(array($id_user, 1));
            // On regarde si l'auteur a gagné des points
        } else {
            echo 'Vous ne pouvez pas voter sur ce potin car vous en êtes l\'auteur';
        }
    } else {
        echo 'Vous avez déjà voté pour ce potin !';
    }
Esempio n. 3
0
function vue_affichage_potin($potin_courant, $id_user, $bdd)
{
    include_once 'controleur/includes/fonctions/parse_smiley.php';
    include_once 'modele/infos_potin.php';
    include_once 'modele/requetes_vote.php';
    include_once 'modele/commentaires.php';
    include_once 'modele/contenu_vu.php';
    // Si on n'avait pas vu ce potin
    if (!contenu_deja_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd)) {
        // On l'enregistre comme vu
        new_contenu_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd);
    }
    $resultat = '';
    $resultat .= '<div class="col-xs-12 col-potin-test" id="potin-' . $potin_courant['id_Potin'] . '"  typePotin="v3">

	<div class="row row-potin-test">
					
				<div class="potin-g-test">';
    if ($potin_courant['id_auteur'] == $id_user) {
        $resultat .= '<div class="dropdown dropdown-potin">
					    <span id="dLabel" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					    	<span class="caret"></span>
					    </span>
					    
					  
					  <ul class="dropdown-menu dropdown-potin-menu" role="menu" aria-labelledby="dLabel">
					    <li><a class="drop-supprimer-potin" idPotin="' . $potin_courant['id_Potin'] . '" href="#">Supprimer</a></li>
					  </ul>
					</div>';
    }
    $resultat .= '<div class="potin-potin">
						<h4>';
    $nom_concernes = explode(',', $potin_courant['concernes']);
    $id_concernes = explode(',', $potin_courant['id_Concernes']);
    $nb_concernes = count($nom_concernes);
    $resultat .= 'Sur ';
    for ($i = 0; $i < $nb_concernes - 1; $i++) {
        //index.php?page=page_membre&id_concerne=3&onglet=potins
        $resultat .= '<a href="' . INDEX . '?page=page_membre&id_concerne=' . $id_concernes[$i] . '&onglet=potins">' . htmlspecialchars($nom_concernes[$i]) . '</a>';
        if ($i == $nb_concernes - 2) {
            $resultat .= ' et ';
        } else {
            $resultat .= ', ';
        }
    }
    $resultat .= '<a href="' . INDEX . '?page=page_membre&id_concerne=' . $id_concernes[$i] . '&onglet=potins">' . htmlspecialchars($nom_concernes[$nb_concernes - 1]) . '</a>';
    $resultat .= ' dans <a href="' . INDEX . '?page=groupe&id_groupe=' . $potin_courant['id_Groupe'] . '">' . htmlspecialchars($potin_courant['nom_groupe']) . '</a>';
    $resultat .= '</h4>
					
						<h5>';
    $resultat .= 'Quelqu\'un a écrit, le ' . htmlspecialchars($potin_courant['nom_jour_potin']) . ' ' . htmlspecialchars($potin_courant['jour_potin']) . ' ' . htmlspecialchars($potin_courant['mois_potin']) . ' ' . htmlspecialchars($potin_courant['annee_potin']) . '<br>';
    $resultat .= '</h5>
					
						<p>' . parse_smileys(str_replace("\n", "<br/>", $potin_courant['Potin'])) . '</p>

						<p>';
    // Affichage de l'image, si il y en a une
    if ($potin_courant['Image'] != '') {
        $resultat .= '<img class="image-potin-test" src="' . $potin_courant['Image'] . '" alt="Photo du potin"/>';
    } else {
        $resultat .= '<br>';
    }
    $resultat .= '</p>

					</div>';
    // On détermine la véracité du potin
    switch (resultat_vote($potin_courant['id_Potin'], $bdd)) {
        case 'sur':
            $resv_css = 'sur';
            $resv_text = 'C\'est sûr !';
            $resultat .= '<br>';
            // On ajoute un espacement
            break;
        case 'possible':
            $resv_css = 'possible';
            $resv_text = 'C\'est possible.';
            $resultat .= '<br>';
            break;
        case 'surement_faux':
            $resv_css = 'surement_faux';
            $resv_text = 'C\'est sûrement faux ...';
            $resultat .= '<br>';
            break;
        case 'faux':
            $resv_css = 'faux';
            $resv_text = 'C\'est faux !';
            $resultat .= '<br>';
            break;
        case 'calomnie':
            $resv_css = 'calomnie';
            $resv_text = 'Ce n\'est que pure calomnie !';
            $resultat .= '<br>';
            break;
        default:
            $resv_css = 'none';
            $resv_text = '';
            break;
    }
    $resultat .= '<div class="potin-vote-wrapper">';
    // Affichage de la véracité du potin
    $resultat .= '<div class="potin-resultat-vote resv-' . $resv_css . '" data-toggle="tooltip" data-placement="top" title="Cet avis est donné par un algorithme secret">
						' . $resv_text . '
					</div>';
    $resultat_votes = resultat_vote($potin_courant['id_Potin'], $bdd);
    $nb_votes_pos = nb_votes_positif($potin_courant['id_Potin'], $bdd);
    $nb_votes_neut = nb_votes_ne_sait_pas($potin_courant['id_Potin'], $bdd);
    $nb_votes_neg = nb_votes_negatif($potin_courant['id_Potin'], $bdd);
    $nb_de_votants = nb_votants($potin_courant['id_Potin'], $bdd);
    if ($nb_de_votants != 0) {
        $barre_positif = $nb_votes_pos / $nb_de_votants * 100;
        $barre_negatif = $nb_votes_neg / $nb_de_votants * 100;
        $barre_neutre = $nb_votes_neut / $nb_de_votants * 100;
    } else {
        $barre_positif = 0;
        $barre_negatif = 0;
        $barre_neutre = 0;
    }
    if ($id_user == auteur_du_potin($potin_courant['id_Potin'], $bdd)) {
        $resultat .= '<div class="vote-progressbar-wraper">';
        if ($barre_positif != 0) {
            $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5cb85c; width: ' . $barre_positif . '%;"></span>';
        }
        if ($barre_neutre != 0) {
            $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5bc0de; width: ' . $barre_neutre . '%;"></span>';
        }
        if ($barre_negatif != 0) {
            $resultat .= '<span class="vote-progressbar" style="border: 1px solid #d9534f; width: ' . $barre_negatif . '%;"></span>';
        }
        $resultat .= '</div>';
    } else {
        if (deja_vote($potin_courant['id_Potin'], $id_user, $bdd)) {
            $resultat .= '<div class="vote-progressbar-wraper">';
            if ($barre_positif != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5cb85c; width: ' . $barre_positif . '%;"></span>';
            }
            if ($barre_neutre != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5bc0de; width: ' . $barre_neutre . '%;"></span>';
            }
            if ($barre_negatif != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #d9534f; width: ' . $barre_negatif . '%;"></span>';
            }
            $resultat .= '</div>';
            $vote_user = vote_user($potin_courant['id_Potin'], $id_user, $bdd);
            $resultat .= '<div class="boutons-vote-wrapper">';
            $resultat .= '<span class="potin-bouton Bvrai';
            if ($vote_user == 1) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="vrai" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">C\'est vrai</span>';
            $resultat .= '<span class="potin-bouton Bnesaitpas';
            if ($vote_user == 0) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="nesaitpas" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">Je ne sais pas</span>';
            $resultat .= '<span class="potin-bouton Bfaux';
            if ($vote_user == -1) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="faux" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">C\'est faux</span>';
            $resultat .= '</div>';
        } else {
            $resultat .= '<div class="boutons-vote-wrapper">';
            $resultat .= '<span class="potin-bouton Bvrai" typeBouton="vrai" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">C\'est vrai</span>';
            $resultat .= '<span class="potin-bouton Bnesaitpas" typeBouton="nesaitpas" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">Je ne sais pas</span>';
            $resultat .= '<span class="potin-bouton Bfaux" typeBouton="faux" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">C\'est faux</span>';
            $resultat .= '</div>';
        }
    }
    $resultat .= '</div>
				</div>
		
				<div class="potin-d-test">
					<div class="potin-commentaires">
					
					  	<h4>Commentaires</h4>';
    $commentaires = rechercher_commentaires($potin_courant['id_Potin'], $bdd);
    if ($commentaires != 'erreur_nocom') {
        foreach ($commentaires as $clef => $valeur) {
            $com_courant = infos_commentaire($valeur, $bdd);
            // Si on n'avait pas vu ce commentaire
            if (!contenu_deja_vu($id_user, $com_courant['id_com'], 'comment', $bdd)) {
                // On l'enregistre comme vu
                new_contenu_vu($id_user, $com_courant['id_com'], 'comment', $bdd);
            }
            //$resultat .=  '<h5>'.$com_courant['prenom'].' '.$com_courant['nom'].'</h5>';
            $resultat .= '<p><span class="fa fa-comment-o" style="color:grey;" aria-hidden="true"></span> ' . parse_smileys(str_replace("\n", "<br/>", $com_courant['texte'])) . '</p>';
        }
    } else {
        $resultat .= '<h5>Soyez le premier à commenter !</h5>';
    }
    $resultat .= '</div>

					<div class="potin-form-com">
						<textarea class="potin-textarea-com" rows="1" id="potin-com" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3" placeholder="Commentez !"></textarea>
					

						<div class="potin-envoyer-com" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3"><span class="glyphicon glyphicon-send" aria-hidden="true"></span></div>
					</div>
				</div>
				
	</div>

</div>';
    return $resultat;
}
Esempio n. 4
0
        echo '-active';
    }
    echo '" typeBouton="vrai" idUser="******" idPotin="' . $_POST['id_Potin'] . '">C\'est vrai</span>';
    echo '<span class="potin-bouton Bnesaitpas';
    if ($vote_user == 0) {
        echo '-active';
    }
    echo '" typeBouton="nesaitpas" idUser="******" idPotin="' . $_POST['id_Potin'] . '">Je ne sais pas</span>';
    echo '<span class="potin-bouton Bfaux';
    if ($vote_user == -1) {
        echo '-active';
    }
    echo '" typeBouton="faux" idUser="******" idPotin="' . $_POST['id_Potin'] . '">C\'est faux</span>';
    echo '</div>';
} else {
    if ($_POST['auteur'] == auteur_du_potin($_POST['id_Potin'], $bdd)) {
        echo '<div class="vote-progressbar-wraper">';
        if ($barre_positif != 0) {
            echo '<span class="vote-progressbar" style="border: 1px solid #5cb85c; width: ' . $barre_positif . '%;"></span>';
        }
        if ($barre_neutre != 0) {
            echo '<span class="vote-progressbar" style="border: 1px solid #5bc0de; width: ' . $barre_neutre . '%;"></span>';
        }
        if ($barre_negatif != 0) {
            echo '<span class="vote-progressbar" style="border: 1px solid #d9534f; width: ' . $barre_negatif . '%;"></span>';
        }
        echo '</div>';
    } else {
        echo '<div class="boutons-vote-wrapper">';
        echo '<span class="potin-bouton Bvrai" typeBouton="vrai" idUser="******" idPotin="' . $_POST['id_Potin'] . '">C\'est vrai</span>';
        echo '<span class="potin-bouton Bnesaitpas" typeBouton="nesaitpas" idUser="******" idPotin="' . $_POST['id_Potin'] . '">Je ne sais pas</span>';
$offset = $limit * $num_page;
include_once 'modele/rechercher_potins.php';
include_once 'vue/potin/affichage_potin.php';
include_once 'vue/potin/potin_v4.php';
include_once 'vue/potin/potin_v4_brouille.php';
include_once 'modele/infos_potin.php';
$reponse = NULL;
$j = 0;
$potins_cherches = rechercher_potins_sur_user($id_user, $bdd);
if ($potins_cherches != 0) {
    $potins_cherches = array_slice($potins_cherches, $offset, $limit);
    foreach ($potins_cherches as $i => $potin_courant) {
        $potin_courant = infos_potin($potin_courant, $bdd);
        //$reponse['potin'.$j] = vue_potin_v4($potin_courant, $id_user, $bdd);
        $reqa = $bdd->prepare('SELECT decouvert FROM cor_potin_users WHERE id_concerne = ? AND id_potin = ?');
        $reqa->execute(array($id_user, $potin_courant['id_Potin']));
        $donneesa = $reqa->fetch();
        $reqa->closeCursor();
        if ($donneesa['decouvert'] == 1 || auteur_du_potin($potin_courant['id_Potin'], $bdd) == $id_user) {
            // Si on l'a écouvert ou qu'on en est l'auteur
            $reponse['potin' . $j] = vue_potin_v4($potin_courant, $id_user, $bdd);
        } else {
            $reponse['potin' . $j] = vue_potin_v4_brouille($potin_courant, $id_user, $bdd);
        }
        $j++;
    }
    $reponse['nb_potins'] = $j;
} else {
    $reponse['nb_potins'] = 0;
}
echo json_encode($reponse);
Esempio n. 6
0
?>

<div id="inserer_vote">

<?php 
$potin_courant['id_Potin'] = $_GET['num_potin'];
?>

          <?php 
include_once 'modele/infos_potin.php';
include_once 'modele/requetes_vote.php';
if (deja_vote($potin_courant['id_Potin'], $id_user, $bdd)) {
    echo '<p>Vous avez déjà voté !</p>';
    $afficher_resultat = true;
} else {
    if ($id_user == auteur_du_potin($potin_courant['id_Potin'], $bdd)) {
        echo '<p>Vous êtes l\'auteur de ce potin</p>';
        $afficher_resultat = true;
    } else {
        include 'vue/affichage_potin/formulaire_de_vote.php';
        $afficher_resultat = false;
    }
}
?>

        </div>
        <div class="modal-body contenu-centre">

          <?php 
if ($afficher_resultat) {
    include_once 'modele/infos_potin.php';
Esempio n. 7
0
<?php

// Si on reçoit des infos du formulaire
if (isset($_POST['new_comment']) && $_POST['new_comment'] == 'ok') {
    $commentaire = trim($_POST['nouv_comment']);
    // On récupère le message
    // On cherche l'auteur du potin
    include_once 'modele/infos_potin.php';
    $auteur_potin = auteur_du_potin($_POST['id_potin'], $bdd);
    if ($auteur_potin != $id_user) {
        // Notification à l'auteur du potin
        include_once 'modele/notifications.php';
        nouvelle_notif($auteur_potin, 'comment_mypotin', $_POST['id_potin'], '', $bdd);
    }
    // On cherche tous les commentateurs du potin
    include_once 'modele/commentaires.php';
    $auteurs_com = qui_a_commente_potin($_POST['id_potin'], $bdd);
    if ($auteurs_com != 'erreur_nocom') {
        // Notification à tous ceux qui ont commenté, sauf l'auteur du potin
        foreach ($auteurs_com as $key => $auteur_courant) {
            if ($auteur_courant != $id_user && $auteur_courant != $auteur_potin) {
                include_once 'modele/notifications.php';
                nouvelle_notif($auteur_courant, 'reply_comment', $_POST['id_potin'], '', $bdd);
            }
        }
    }
    // On écrit le commentaire dans la bdd
    $req = $bdd->prepare('INSERT INTO commentaires(id_auteur, id_potin, date_com, texte) VALUES(?, ?, NOW(), ?)');
    $req->execute(array($id_user, $_POST['id_potin'], $_POST['nouv_comment']));
}
Esempio n. 8
0
/**
Refaire, en ne prenant que l'id du potin comme paramètre
**/
function vue_potin_v4($potin_courant, $id_user, $bdd)
{
    $groupe_courant = infos_groupe($potin_courant['id_Groupe'], $bdd);
    // Si on n'avait pas vu ce potin
    if (!contenu_deja_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd)) {
        // On l'enregistre comme vu
        new_contenu_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd);
    }
    $resultat = '';
    $resultat .= '<div class="row-potin-v4 item" id="potin-' . $potin_courant['id_Potin'] . '" typePotin="v4">';
    // Header
    $resultat .= '<div class="header-potin-v4">';
    if ($groupe_courant['image'] != '') {
        $bandeau_groupe = $groupe_courant['image'];
    } else {
        $bandeau_groupe = 'default';
    }
    $resultat .= '<div class="hp4-bandeau">
			        <img src="images/groupe/' . $bandeau_groupe . '-bd.jpg">
			      </div>';
    // Affichage des concernes
    $resultat .= '<div class="hp4-wrapper-profile">';
    $nom_concernes = explode(',', $potin_courant['concernes']);
    $id_concernes = explode(',', $potin_courant['id_Concernes']);
    $nb_concernes = count($nom_concernes);
    foreach ($id_concernes as $key => $concerne_courant) {
        $concerne_courant = infos_user($concerne_courant, $bdd);
        if ($concerne_courant['avatar'] != '') {
            $photo_profile = $concerne_courant['avatar'];
            $initiales = '';
        } else {
            $photo_profile = 'default';
            $initiales = substr($concerne_courant['prenom'], 0, 1) . ' ' . substr($concerne_courant['nom'], 0, 1);
        }
        $resultat .= '<a href="' . INDEX . '?page=page_membre&id_concerne=' . $concerne_courant['id_user'] . '&onglet=potins">
						<div class="hp4-wrp"><div class="hp4-rounded-profile" style="background:url(images/profile/' . $photo_profile . '-50.jpg) no-repeat 0px 0px;"  data-toggle="tooltip" data-placement="top" title="' . $concerne_courant['prenom'] . ' ' . $concerne_courant['nom'] . '">' . $initiales . '</div></div></a>';
    }
    $resultat .= '</div>';
    $padding_nom = 10 + $nb_concernes * 55 + 10;
    // Calcul du décalage du nom du groupe
    $resultat .= '<div class="hp4-nom-gp">' . '<a href="' . INDEX . '?page=groupe&id_groupe=' . $potin_courant['id_Groupe'] . '" style="padding-left:' . $padding_nom . 'px">' . htmlspecialchars($potin_courant['nom_groupe']) . '</a>' . '</div>';
    $resultat .= '</div>';
    // Corps du potin
    $resultat .= '<div class="corps-potin-v4">';
    $resultat .= '<div class="date-potin-v4">' . $potin_courant['nom_jour_potin'] . ' ' . $potin_courant['jour_potin'] . ' ' . $potin_courant['mois_potin'] . ' ' . $potin_courant['annee_potin'];
    if ($potin_courant['id_auteur'] == $id_user) {
        $resultat .= '<span id="dLabel" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		    	<span class="caret"></span>
		    </span>
		  <ul class="dropdown-menu dropdown-potin-menu" role="menu" aria-labelledby="dLabel">
		    <li><a class="drop-supprimer-potin" idPotin="' . $potin_courant['id_Potin'] . '" href="#">Supprimer</a></li>
		  </ul>';
    }
    $resultat .= '</div>';
    // Le texte du potin
    $resultat .= '<div class="texte-potin-v4">' . parse_smileys(str_replace("\n", "<br/>", $potin_courant['Potin'])) . '</div>';
    $resultat .= '</div>';
    // Fin corps
    // Image
    $resultat .= '<div class="image-potin-v4">';
    if ($potin_courant['Image'] != '') {
        $resultat .= '<img class="imagePotin" src="' . $potin_courant['Image'] . '" alt="Photo du potin">';
    }
    $resultat .= '</div>';
    // Fin image
    // On détermine la véracité du potin
    switch (resultat_vote($potin_courant['id_Potin'], $bdd)) {
        case 'sur':
            $resv_css = 'sur';
            $resv_text = 'C\'est sûr !';
            //$resultat .= '<br>'; // On ajoute un espacement
            break;
        case 'possible':
            $resv_css = 'possible';
            $resv_text = 'C\'est possible.';
            //$resultat .= '<br>';
            break;
        case 'surement_faux':
            $resv_css = 'surement_faux';
            $resv_text = 'C\'est sûrement faux ...';
            //$resultat .= '<br>';
            break;
        case 'faux':
            $resv_css = 'faux';
            $resv_text = 'C\'est faux !';
            //$resultat .= '<br>';
            break;
        case 'calomnie':
            $resv_css = 'calomnie';
            $resv_text = 'Ce n\'est que pure calomnie !';
            //$resultat .= '<br>';
            break;
        default:
            $resv_css = 'none';
            $resv_text = '';
            break;
    }
    $resultat .= '<div class="potin-vote-wrapper-v4">';
    if ($resv_text != '') {
        // Affichage de la véracité du potin
        $resultat .= '<div class="potin-resultat-vote resv-' . $resv_css . '" data-toggle="tooltip" data-placement="top" title="Cet avis est donné par un algorithme secret">
			' . $resv_text . '
		</div>';
    }
    $resultat_votes = resultat_vote($potin_courant['id_Potin'], $bdd);
    $nb_votes_pos = nb_votes_positif($potin_courant['id_Potin'], $bdd);
    $nb_votes_neut = nb_votes_ne_sait_pas($potin_courant['id_Potin'], $bdd);
    $nb_votes_neg = nb_votes_negatif($potin_courant['id_Potin'], $bdd);
    $nb_de_votants = nb_votants($potin_courant['id_Potin'], $bdd);
    if ($nb_de_votants != 0) {
        $barre_positif = $nb_votes_pos / $nb_de_votants * 100;
        $barre_negatif = $nb_votes_neg / $nb_de_votants * 100;
        $barre_neutre = $nb_votes_neut / $nb_de_votants * 100;
    } else {
        $barre_positif = 0;
        $barre_negatif = 0;
        $barre_neutre = 0;
    }
    if ($id_user == auteur_du_potin($potin_courant['id_Potin'], $bdd)) {
        if ($nb_de_votants != 0) {
            $resultat .= '<div class="vote-progressbar-wraper">';
            if ($barre_positif != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5cb85c; width: ' . $barre_positif . '%;"></span>';
            }
            if ($barre_neutre != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5bc0de; width: ' . $barre_neutre . '%;"></span>';
            }
            if ($barre_negatif != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #d9534f; width: ' . $barre_negatif . '%;"></span>';
            }
            $resultat .= '</div>';
        }
    } else {
        if (deja_vote($potin_courant['id_Potin'], $id_user, $bdd)) {
            $resultat .= '<div class="vote-progressbar-wraper">';
            if ($barre_positif != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5cb85c; width: ' . $barre_positif . '%;"></span>';
            }
            if ($barre_neutre != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5bc0de; width: ' . $barre_neutre . '%;"></span>';
            }
            if ($barre_negatif != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #d9534f; width: ' . $barre_negatif . '%;"></span>';
            }
            $resultat .= '</div>';
            $vote_user = vote_user($potin_courant['id_Potin'], $id_user, $bdd);
            $resultat .= '<div class="boutons-vote-wrapper">';
            $resultat .= '<span class="potin-bouton Bvrai';
            if ($vote_user == 1) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="vrai" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v4">C\'est vrai</span>';
            $resultat .= '<span class="potin-bouton Bnesaitpas';
            if ($vote_user == 0) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="nesaitpas" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v4">Je ne sais pas</span>';
            $resultat .= '<span class="potin-bouton Bfaux';
            if ($vote_user == -1) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="faux" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v4">C\'est faux</span>';
            $resultat .= '</div>';
        } else {
            $resultat .= '<div class="boutons-vote-wrapper">';
            $resultat .= '<span class="potin-bouton Bvrai" typeBouton="vrai" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v4">C\'est vrai</span>';
            $resultat .= '<span class="potin-bouton Bnesaitpas" typeBouton="nesaitpas" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v4">Je ne sais pas</span>';
            $resultat .= '<span class="potin-bouton Bfaux" typeBouton="faux" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v4">C\'est faux</span>';
            $resultat .= '</div>';
        }
    }
    $resultat .= '</div>';
    // Commentaires
    $resultat .= '<div class="com-potin-v4">';
    $commentaires = rechercher_commentaires($potin_courant['id_Potin'], $bdd);
    if ($commentaires != 'erreur_nocom') {
        $resultat .= '<div class="cp4-wrapper">';
        foreach ($commentaires as $clef => $valeur) {
            $com_courant = infos_commentaire($valeur, $bdd);
            // Si on n'avait pas vu ce commentaire
            if (!contenu_deja_vu($id_user, $com_courant['id_com'], 'comment', $bdd)) {
                // On l'enregistre comme vu
                new_contenu_vu($id_user, $com_courant['id_com'], 'comment', $bdd);
            }
            //$resultat .=  '<h5>'.$com_courant['prenom'].' '.$com_courant['nom'].'</h5>';
            $resultat .= '<p><span class="fa fa-comment-o" style="color:grey;" aria-hidden="true"></span> ' . parse_smileys(str_replace("\n", "<br/>", $com_courant['texte'])) . '</p>';
        }
        $resultat .= '<div class="prochain-com"></div>
				     	</div>';
        $texte_textarea = 'Commentez !';
    } else {
        $texte_textarea = 'Soyez le premier à commenter !';
    }
    $resultat .= '<div class="potin-form-com-v4">
				        <textarea class="potin-textarea-com" rows="1" id="potin-com" placeholder="' . $texte_textarea . '!" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v4"></textarea>
				      
				        <div class="potin-envoyer-com" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v4"><span class="glyphicon glyphicon-send" aria-hidden="true"></span></div>
				      </div>
				    </div>';
    $resultat .= '</div>';
    return $resultat;
}