-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
111 lines (86 loc) · 3.59 KB
/
index.php
File metadata and controls
111 lines (86 loc) · 3.59 KB
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
111
<?php
include('admin/database.php');
include('admin/helpers.php');
$domain = getUrl();
$sql = "SELECT *, images.name as image_name, articles.id as articles_id FROM articles, images, articleimages, users ";
$sql .= "WHERE articles.id = articleimages.articles_id ";
$sql .= "AND images.id = articleimages.images_id ";
$sql .= "AND users.id = articles.users_id ";
$results = $pdo->query($sql);
$rows = $results->fetchAll();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= $appName ?></title>
<!-- Bootstrap core CSS -->
<link href="<?= $domain ?>/admin/css/bootstrap.min.css" rel="stylesheet">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
</head>
<body>
<header>
<div class="navbar navbar-dark bg-dark shadow-sm">
<div class="container">
<a href="<?= $domain ?>/index.php" class="navbar-brand d-flex align-items-center">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" aria-hidden="true" class="me-2" viewBox="0 0 24 24"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>
<strong><?= $appName ?></strong>
</a>
<a class="btn btn-outline-secondary" href="<?= $domain ?>/admin/login.php">Sign in</a>
</div>
</div>
</header>
<main>
<div class="album py-5 bg-light">
<div class="container">
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
<?php foreach($rows as $row): ?>
<div class="col">
<div class="card shadow-sm">
<?php if(isset($row['url'])): ?>
<img class="bd-placeholder-img card-img-top" width="100%" height="225" src="<?= $row['url'] ?>" alt="<?= $row['image_name'] ?>">
<?php else: ?>
<svg class="bd-placeholder-img card-img-top" width="100%" height="225" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: Thumbnail" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#55595c"/><text x="50%" y="50%" fill="#eceeef" dy=".3em">Thumbnail</text></svg>
<?php endif ?>
<div class="card-body">
<h2 class="card-text h4"><?= $row['title'] ?></h2>
<p class="card-text"><?= substr(strip_tags($row['content']), 0, 50) ?></p>
<div class="d-flex justify-content-between align-items-center">
<div class="btn-group">
<a href="<?= getUrl('/post.php?post_id='.$row['articles_id']); ?>" class="btn btn-sm btn-outline-secondary">View</a>
</div>
<small class="text-muted"><?= $row['name'] ?></small>
</div>
</div>
</div>
</div>
<?php endforeach ?>
</div>
</div>
</div>
</main>
<footer class="text-muted py-5">
<div class="container">
<p class="float-end mb-1">
<a href="#">Back to top</a>
</p>
<p class="mb-1"><?= $appName ?> ©</p>
</div>
</footer>
<script src="<?= $domain ?>/admin/js/bootstrap.bundle.min.js"></script>
</body>
</html>