-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphoto.php
executable file
·110 lines (77 loc) · 3.23 KB
/
photo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php include("includes/header.php"); ?>
<?php
require_once("admin/includes/init.php");
if(empty($_GET['id'])) redirect("index.php");
$photo = Photo::find_by_id($_GET['id']);
if(isset($_POST['submit'])) {
$cmt_user = $_POST['users'];
$cmt_body = trim($_POST['comments']);
$new_comment = Comment::create_comment($photo->pht_id,$cmt_user,$cmt_body);
if($new_comment && $new_comment->save())
redirect("photo.php?id={$photo->pht_id}");
else
$message = "There was some on error on the server";
}
$comments = Comment::find_comment($photo->pht_id);
?>
<div class="row">
<!-- Blog Post Content Column -->
<div class="col-lg-12">
<!-- Blog Post -->
<!-- Title -->
<h1><?=$photo->pht_title?></h1>
<!-- Author -->
<p class="lead">
by <a href="#">Start Bootstrap</a>
</p>
<hr>
<!-- Date/Time -->
<p><span class="glyphicon glyphicon-time"></span> Posted on <?=date('F d, \a\t H:i A',strtotime($photo->pht_dateadded))?></p>
<hr>
<!-- Preview Image -->
<img class="img-responsive" src="<?='admin' . DS . $photo->file_path()?>" alt="">
<hr>
<!-- Post Content -->
<p class="lead"><?=$photo->pht_caption?></p>
<p><?=$photo->pht_description?></p>
<hr>
<!-- Blog Comments -->
<!-- Comments Form -->
<div class="well">
<h4>Leave a Comment:</h4>
<form role="form" method="post">
<div class="form-group">
<input type="hidden" name="users" value="1">
</div>
<div class="form-group">
<textarea name="comments" class="form-control" rows="3"></textarea>
</div>
<button type="submit" name="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<hr>
<!-- Posted Comments -->
<?php if($comments) {
foreach ($comments as $value) :
$user = User::find_by_id($value->cmt_user); ?>
<!-- Comment -->
<div class="media">
<a class="pull-left" href="#">
<img class="media-object user-image" src="<?='admin' . DS . $user->image_path_placehold()?>" alt="">
</a>
<div class="media-body">
<h4 class="media-heading"><?=$user->usr_username?>
<small><?=$value->cmt_dateadded?></small>
</h4>
<?=$value->cmt_body?>
</div>
</div>
<?php endforeach;
} ?>
</div>
<!-- <div class="col-md-4">
<?php //include("includes/sidebar.php"); ?>
</div> -->
</div>
<!-- /.row -->
<?php include("includes/footer.php"); ?>