function afficher_commentaire($comment, $with_link) { afficher_form_commentaire($comment['bt_article_id'], 'admin', '', $comment); echo '<div class="commentbloc' . (!$comment['bt_statut'] ? ' privatebloc' : '') . '" id="' . article_anchor($comment['bt_id']) . '">' . "\n"; if ($comment['bt_statut'] == '0') { echo '<img class="img_inv_flag" src="style/deny.png" title="' . $GLOBALS['lang']['comment_is_invisible'] . '" alt="icon"/>'; } echo '<span onclick="reply(\'[b]@[' . str_replace('\'', '\\\'', $comment['bt_author']) . '|#' . article_anchor($comment['bt_id']) . '] :[/b] \'); ">@</span> '; echo '<h3 class="titre-commentaire">' . $comment['auteur_lien'] . '</h3>' . "\n"; echo '<p class="email"><a href="mailto:' . $comment['bt_email'] . '">' . $comment['bt_email'] . '</a></p>' . "\n"; echo $comment['bt_content']; echo '<p class="p-edit-button">' . "\n"; echo $GLOBALS['lang']['le'] . ' ' . date_formate($comment['bt_id']) . ', ' . heure_formate($comment['bt_id']); if ($with_link == 1 and !empty($comment['bt_title'])) { echo ' ' . $GLOBALS['lang']['sur'] . ' <a href="' . $_SERVER['PHP_SELF'] . '?post_id=' . $comment['bt_article_id'] . '">' . $comment['bt_title'] . '</a>'; } echo "\t" . '<button class="comm-link cl-suppr" type="button" onclick="ask_suppr(this);" title="' . $GLOBALS['lang']['supprimer'] . '"></button>' . "\n"; echo "\t" . '<button class="comm-link cl-edit" type="button" onclick="unfold(this);" title="' . $GLOBALS['lang']['editer'] . '"></button> '; echo '</p>' . "\n"; echo $GLOBALS['form_commentaire']; echo '</div>' . "\n\n"; }
$query = "SELECT * FROM articles WHERE bt_id=? LIMIT 1"; $billets = liste_elements($query, array($id), 'articles'); } if (!empty($billets[0])) { // TRAITEMENT new commentaire $erreurs_form = array(); if (isset($_POST['_verif_envoi'], $_POST['commentaire'], $_POST['captcha'], $_POST['_token'], $_POST['auteur'], $_POST['email'], $_POST['webpage']) and $billets[0]['bt_allow_comments'] == '1') { // COMMENT POST INIT $comment = init_post_comment($id, 'public'); if (isset($_POST['enregistrer'])) { $erreurs_form = valider_form_commentaire($comment, 'public'); } } else { unset($_POST['enregistrer']); } afficher_form_commentaire($id, 'public', $erreurs_form); if (empty($erreurs_form) and isset($_POST['enregistrer'])) { traiter_form_commentaire($comment, 'public'); } afficher_index($billets[0], 'post'); } else { afficher_index(NULL, 'list'); } } elseif (isset($_GET['id']) and preg_match('#\\d{14}#', $_GET['id'])) { $tableau = liste_elements("SELECT * FROM links WHERE bt_id=? AND bt_statut=1", array($_GET['id']), 'links'); afficher_index($tableau, 'list'); } elseif (isset($_GET['liste'])) { $query = "SELECT bt_date,bt_id,bt_title,bt_nb_comments,bt_link FROM articles WHERE bt_date <= " . date('YmdHis') . " AND bt_statut=1 ORDER BY bt_date DESC"; $tableau = liste_elements($query, array(), 'articles'); afficher_liste($tableau); } else {
function afficher_commentaire($comment, $with_link) { afficher_form_commentaire($comment['bt_article_id'], 'admin', '', $comment); echo '<div class="commentbloc' . (!$comment['bt_statut'] ? ' privatebloc' : '') . '" id="' . article_anchor($comment['bt_id']) . '">' . "\n"; echo '<div class="comm-header">' . "\n"; echo "\t" . '<div class="comm-title">' . "\n"; echo "\t\t" . '<span class="reply" onclick="reply(\'[b]@[' . str_replace('\'', '\\\'', $comment['bt_author']) . '|#' . article_anchor($comment['bt_id']) . '] :[/b] \'); ">@</span> '; echo "\t\t" . '<span class="author">' . $comment['auteur_lien'] . '</span>' . "\n"; echo "\t\t" . '<span class="email"><a href="mailto:' . $comment['bt_email'] . '">' . $comment['bt_email'] . '</a></span>' . "\n"; echo "\t" . '</div>' . "\n"; echo "\t" . '<div class="comm-options">' . "\n"; echo "\t\t" . '<ul>' . "\n"; echo "\t\t\t" . '<li class="cl-edit" onclick="unfold(this);">' . $GLOBALS['lang']['editer'] . '</li>' . "\n"; echo "\t\t\t" . '<li class="cl-activ" onclick="activate_comm(this);" data-comm-id="' . $comment['ID'] . '" data-comm-art-id="' . $comment['bt_article_id'] . '">' . $GLOBALS['lang'][(!$comment['bt_statut'] ? '' : 'des') . 'activer'] . '</li>' . "\n"; echo "\t\t\t" . '<li class="cl-suppr" onclick="suppr_comm(this);" data-comm-id="' . $comment['ID'] . '" data-comm-art-id="' . $comment['bt_article_id'] . '">' . $GLOBALS['lang']['supprimer'] . '</li>' . "\n"; echo "\t\t" . '</ul>' . "\n"; echo "\t" . '</div>' . "\n"; echo '</div>' . "\n"; echo $comment['bt_content']; echo '<p class="p-date-title">' . "\n"; echo $GLOBALS['lang']['le'] . ' ' . date_formate($comment['bt_id']) . ', ' . heure_formate($comment['bt_id']); if ($with_link == 1 and !empty($comment['bt_title'])) { echo ' ' . $GLOBALS['lang']['sur'] . ' <a href="' . basename($_SERVER['PHP_SELF']) . '?post_id=' . $comment['bt_article_id'] . '">' . $comment['bt_title'] . '</a>'; } echo '</p>' . "\n"; echo $GLOBALS['form_commentaire']; echo '</div>' . "\n\n"; }