-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog.php
67 lines (56 loc) · 2.62 KB
/
blog.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
<?php
include 'init.php';
if(!logged_in()){
header('Location: index.php');
exit;
}
include 'template/header.php';
?>
<section id="main_section" class="blog">
<?php
$user_id = $_GET['user_id'];
$blog_posts = get_blog_posts($user_id);
if (empty ($blog_posts)){
echo '
<article id="blog_album_page">
<h2>You don\'t have any blog posts yet.</h2>
</article>
';
} else {
foreach ($blog_posts as $blog_post){
?>
<article class="transparent" id="blog_album_page">
<?php
if(blog_post_check($blog_post['post_id']) === FALSE){
echo '
<hgroup>
<h2><a href="view_blog_post.php?post_id=', $blog_post['post_id'],'">', $blog_post['title'], '</a></h2>
</hgroup>
<p>', nl2br(substr($blog_post['content'],0,120)) ,'<br><br/><b><a href="view_blog_post.php?post_id=', $blog_post['post_id'] ,'">Continue Reading....</a></b></p><br />
<footer>
<p align="right"><b>Posted on '.date('D', $blog_post['timestamp']).', '.date('d M Y / h:m', $blog_post['timestamp']).'</b></p>
</footer>
';
} else{
echo '
<hgroup>
<h2><a href="view_blog_post.php?post_id=', $blog_post['post_id'] ,'">', $blog_post['title'], '</a></h2>
</hgroup>
<p>', nl2br(substr($blog_post['content'],0,120)) ,'....... <br><br/><b><a href="view_blog_post.php?post_id=', $blog_post['post_id'] ,'">Continue Reading....</a></b></p><br />
<footer>
<p><a href="edit_blog_post.php?post_id=', $blog_post['post_id'],'">Edit</a> / <a href="delete_blog_post.php?post_id=', $blog_post['post_id'],'">Delete</a></p>
<p align="right"><b>Posted on '.date('D', $blog_post['timestamp']).', '.date('d M Y / h:m', $blog_post['timestamp']).'</b></p>
</footer>
';
}
?>
</article>
<?php
}
}
?>
</section>
<?php
include 'widgets/blog_options.php';
include 'template/footer.php';
?>