<?php if (!isset($_SESSION)) { session_start(); } //legger inn en ny kommmentar i bilder.xml extract($_POST); $id = uniqid(); $dato = str_replace("/", ".", $dato); include_once "../../BildeController.php"; include_once "../renderHelpers.php"; $bildeController = BildeController::getInstance(); $bildeController->addCommentToImageInAlbum($kommentar, $dato, $navn, $bilde, $album, $id); echo renderComment($kommentar, $dato, $navn, $id); //lagre kommentarkreasjonen som en newsfeeditem og sende epost til alle følgere
/** * Renders a hierarchy list of comments on the comments page. * * @param {String} $value: The value of the selected item. */ function renderComments($value) { global $mysqli; $original = $mysqli->prepare("SELECT id, {$value}, user_id FROM {$value} WHERE {$value} != ''"); $original->execute(); $original->store_result(); $original->bind_result($commentID, $comment, $userID); ?> <?php while ($original->fetch()) { ?> <?php $statement = $mysqli->prepare("SELECT id, reply_comment, replied_by FROM reply_{$value} WHERE comments_id = ?"); $statement->bind_param("i", $commentID); $statement->execute(); $statement->store_result(); $statement->bind_result($replyID, $reply, $replier); ?> <div class="comment col-xs-9"> <?php renderComment(findUsername($userID), $comment, $commentID, $value, "original"); ?> </div> <?php while ($statement->fetch()) { ?> <div class="comment-reply col-xs-9"> <?php renderComment($replier, $reply, $replyID, $value, "reply"); ?> </div> <?php } ?> <?php } }
<td class="navitem3"><a id='neste' class="navitems" href='<?php echo "/bilder/" . $album["ID"] . "/" . $nextImage; ?> '>neste</a></td> </tr> </table> </div> <!-- Kommentarer --> <div class="col-xs-12 col-md-4 kommentarboks" id="kommentarboks"> <div class="kommentarene" id="kommentarene"> <table class="kommentartabell"> <?php foreach ($kommentarer as $kommentar) { echo renderComment($kommentar, $kommentar["DATO"], $kommentar["NAVN"], $kommentar["ID"]); } ?> <!-- mulighet for spinner til slutt --> <tr id="progress" style="display: none;"> <td style="text-align: center;" colspan="2"> <img id="spinner" src="/resources/images/progress.gif" alt="Kommenterer.." width="20"> </td> </tr> </table> </div> <table class="kommentartabell nykommentartabell"> <tr class="nykommentar"> <form id="kommentarform" onsubmit="submitkommentar(); return false;"> <td class="kommentarbilde">