public static function display_sidebar($photo_id) { $photo = Photo::find_by_id($photo_id); $output = "<a class='thumbnail' href='#'><img width='100' src='{$photo->picture_path()}' ></a>"; $output .= "<p>{$photo->filename}</p>"; $output .= "<p>{$photo->type}</p>"; $output .= "<p>{$photo->size}</p>"; echo $output; }
<?php include "includes/header.php"; if (!$session->is_signed_in()) { redirect_to("login.php"); } if (empty($_GET['id'])) { redirect_to("photos.php"); } else { $photo = Photo::find_by_id($_GET['id']); if (isset($_POST['update'])) { if ($photo) { $photo->title = $_POST['title']; $photo->caption = $_POST['caption']; $photo->alternate_text = $_POST['alternate_text']; $photo->description = $_POST['description']; $photo->save(); } } } ?> <!-- Navigation --> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <!-- Brand and toggle get grouped for better mobile display --> <?php include 'includes/top_nav.php'; ?> <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens --> <?php include "includes/side_nav.php";
<?php include "includes/init.php"; if (!$session->is_signed_in()) { redirect('login.php'); } if (empty($_GET['id']) && !isset($_GET['id'])) { redirect("photos.php"); } $id = urldecode($_GET['id']); $photo = Photo::find_by_id($id); if ($photo && file_exists($photo->full_path_directory . DS . $photo->filename)) { $photo->delete_picture(); redirect("photos.php"); } else { redirect("photos.php"); }
<th>ID</th> <!-- <th>Photo</th>--> <th>Author</th> <th>Comment</th> <th>Date tine</th> <th colspan="2" class="text-center">Action</th> </tr> </thead> <tbody> <?php $comments = Comment::find_all(); $output = ""; $blank = " "; foreach ($comments as $comment) { $photo = Photo::find_by_id($comment->photo_id); $output .= "<tr>"; $output .= "<td>{$comment->id}</td>"; // $output.="<td style='text-center'><img class='user-image' src=\"{$photo->picture_path()}\" alt=''></td>"; $output .= "<td>{$comment->author}</td>"; $output .= "<td>{$comment->body}</td>"; $output .= "<td>" . strftime("%d %M %Y @ %Hh%M", strtotime($comment->input_date)) . "</td>"; $output .= "<td class='text-center'><a class='btn btn-danger btn-xs page-table-action' href='delete_comment.php?id=" . urlencode($comment->id) . "'>Delete</a></td>{$blank}"; $output .= "<td class='text-center'><a class='btn btn-primary btn-xs btn-xs page-table-action' href='edit_comment.php?id=" . urlencode($comment->id) . "'>Edit</a></td>{$blank}"; $output .= "</tr>"; } unset($photo); echo $output; ?>
<?php require "init.php"; $image_info = array(); $photo = Photo::find_by_id($_POST['image_id']); $image_info['filename'] = $photo->filename; $image_info['type'] = $photo->type; $image_info['size'] = $photo->size; echo json_encode($image_info);