<?php require "includes/navigation.php"; ?> <!-- Page Content --> <div class="container"> <div class="row"> <!-- Blog Post Content Column --> <div class="col-lg-8"> <!-- Blog Post --> <?php $post = findPostById($post_id); ?> <!-- Title --> <h1> <?php echo $post['title']; if (isset($_SESSION['user']) && $_SESSION['user']['role'] == "Administrator") { ?> <a class="btn btn-xs btn-primary" href="admin/edit_post.php?post_id=<?php echo $post['id']; ?> ">Edit</a> <?php } ?> </h1>
<thead> <tr> <th class="hide">ID</th> <th>Author</th> <th class="col-xs-3">Comment</th> <th class="col-xs-1">Status</th> <th class="col-xs-3">In response to</th> <th>Email</th> <th>Date</th> </tr> </thead> <tbody> <?php $comments = getAllComments(); foreach ($comments as $comment) { $comment_post = findPostById($comment['post_id']); ?> <tr> <td class="hide"><?php echo $comment['id']; ?> </td> <td><?php echo $comment['author']; ?> </td> <td> <?php echo $comment['content']; ?> <br>
<?php require_once "../database/posts_functions.php"; ?> <?php require_once "../database/category_functions.php"; ?> <?php /** GET POST INFORMATION **/ // Used to fill all the camps with the current data if (isset($_GET['post_id'])) { $id = $_GET['post_id']; $post = findPostById($id); } /** UPDATE POST **/ if (isset($_POST['submit_edit'])) { $post['title'] = $_POST['post_title']; $post['category_id'] = $_POST['post_category']; $post['tags'] = $_POST['post_tags']; $post['content'] = $_POST['post_content']; $new_post_image = $_FILES['post_image']['name']; $new_post_image_tmp = $_FILES['post_image']['tmp_name']; if (!empty($new_post_image)) { move_uploaded_file($new_post_image_tmp, "../images/{$new_post_image}"); } else { $new_post_image = $post['image']; } // Error handling