-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
269 lines (255 loc) · 8.85 KB
/
Copy pathindex.php
File metadata and controls
269 lines (255 loc) · 8.85 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<?php
/*
Copyright 09-Januari-2020
MASCMS V1.0 (MAS Content Management System)
Coded by : Mohamad Abdul Sobur
Based on PHP NATIVE
*/
include("header.php");
?>
<!--Content-->
<!--Find Content-->
<div class="container">
<div class="row">
<?php
if(isset($_GET['keyword']))
{
$keyword = masFilterSearch($_GET['keyword']);
$q = mysqli_real_escape_string($masdb, $keyword);
$key = htmlspecialchars($q);
$search = "SELECT * FROM post WHERE title LIKE '%{$key}%' OR description LIKE '%{$q}%' OR keyword LIKE '%{$q}%'";
$result = $mas_class->mas_query($masdb, $search);
?>
<span class="d-block container text-light bg-dark p-2">
<svg id="i-search" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="17" height="17" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3">
<circle cx="14" cy="14" r="12" />
<path d="M23 23 L30 30" />
</svg>
<b>
<?php
if(empty($_GET['keyword']))
{
echo $all_keyword;
}
else
{
echo $keyword_lang." : ".$q;
}
?>
</b>
</span>
<?php
if(mysqli_num_rows($result) < 1)
{
?>
<div class="container p-2">
<div class="alert alert-info">
<p><?php echo $keyword_nothing_lang; ?> : <?php echo $q; ?></p>
</div>
</div>
<?php
}
while($row = mysqli_fetch_assoc($result))
{
$linkjudul = gantiSpasi($row['title']);
$id = $row['id'];
$title = $row['title'];
$permalink = $row['permalink'];
$description = $row['description'];
$cat = $row['category'];
$date = $row['date'];
$urlthumb = $row['urlthumb'];
$hits = $row['hits'];
if($_SESSION['lang'] == $lang_en)
{
$date_type = $date;
}
else
{
$date_type = masDateFormat($date);
}
?>
<div style="width: 100%; heigh: 300px;" class="mb-3 shadow-sm">
<div class="card w-100">
<a href="post.asp?title=<?php echo $permalink; ?>">
<div class="card-body">
<table>
<tbody>
<tr>
<td>
<img class="img-fluid img-thumbnail" style="min-width: 120px; min-height: 120px; max-width: 130px; max-height: 130px; margin-right: 3px;" src="<?php echo $urlthumb; ?>" alt="<?php echo $title; ?>"/>
</td>
<td>
<h6 style="margin-bottom: 2px;" class="text-primary"><b><?php echo $title; ?></b></h6>
<span class="badge badge-success">
<svg id="i-clock" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="17" height="17" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3">
<circle cx="16" cy="16" r="14" />
<path d="M16 8 L16 16 20 20" />
</svg>
<?php echo $date_type; ?>
</span><br/>
<span class="badge badge-dark">
<svg id="i-tag" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="17" height="17" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<circle cx="24" cy="8" r="2" />
<path d="M2 18 L18 2 30 2 30 14 14 30 Z" />
</svg>
<?php echo $cat; ?>
</span><br/>
<span class="badge badge-primary">
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24">
<path fill="white" d="M15 12c0 1.654-1.346 3-3 3s-3-1.346-3-3 1.346-3 3-3 3 1.346 3 3zm9-.449s-4.252 8.449-11.985 8.449c-7.18 0-12.015-8.449-12.015-8.449s4.446-7.551 12.015-7.551c7.694 0 11.985 7.551 11.985 7.551zm-7 .449c0-2.757-2.243-5-5-5s-5 2.243-5 5 2.243 5 5 5 5-2.243 5-5z"/>
</svg>
<?php echo $hits; ?>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</a>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<!--List update content-->
<span class="d-block container text-light bg-dark p-2">
<svg id="i-lightning" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="17" height="17" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3">
<path d="M18 13 L26 2 8 13 14 19 6 30 24 19 Z" />
</svg>
<b><?php echo $latest_update_lang; ?></b>
</span>
<div class="container">
<div class="row">
<?php
//PAGINATION
$halaman = 10;
$sql_pagination = "SELECT * from post";
$sql_count = "SELECT COUNT(*) AS total FROM post";
$page = isset($_GET['page']) ? (int)$_GET['page'] : 0;
$mulai = ($page > 1) ? ($page * $halaman) - $halaman : 0;
$result = $mas_class->mas_query($masdb, $sql_pagination);
$total = mysqli_num_rows($result);
$pages = ceil($total/$halaman);
$query_count = $mas_class->mas_query($masdb, $sql_count);
$fetch_count = mysqli_fetch_assoc($query_count);
$jumlah_page = ceil($fetch_count['total']/$halaman);
$jumlah_number = 3;
$start_number = ($page > $jumlah_number)? $page - $jumlah_number : 1;
$end_number = ($page < ($jumlah_page - $jumlah_number))? $page + $jumlah_number : $jumlah_page;
$sql_list_post = "SELECT * FROM post ORDER BY id DESC LIMIT $mulai, $halaman";
//LIST POSTINGAN
$hasil = $mas_class->mas_query($masdb, $sql_list_post);
if(mysqli_num_rows($hasil) > 0)
{
while($list = mysqli_fetch_assoc($hasil))
{
$linkjudul = gantiSpasi($list['title']);
$title = $list['title'];
$permalink = $list['permalink'];
$description = $list['description'];
$date = $list['date'];
$cat = $list['category'];
$urlthumb = $list['urlthumb'];
$hits = $list['hits'];
if($_SESSION['lang'] == $lang_en)
{
$date_type = $date;
}
else
{
$date_type = masDateFormat($date);
}
?>
<div style="width: 100%; heigh: 300px;" class="mb-3 shadow-sm">
<div class="card w-100">
<a href="post.asp?title=<?php echo $permalink; ?>">
<div class="card-body">
<table>
<tbody>
<tr>
<td>
<img class="img-fluid img-thumbnail" style="min-width: 120px; min-height: 120px; max-width: 130px; max-height: 130px; margin-left: 0px;" src="<?php echo $urlthumb; ?>" alt="<?php echo $title; ?>"/>
</td>
<td>
<h6 style="margin-bottom: 2px;" class="text-primary"><b><?php echo $title; ?></b></h6>
<span class="badge badge-success">
<svg id="i-clock" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="17" height="17" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="3">
<circle cx="16" cy="16" r="14" />
<path d="M16 8 L16 16 20 20" />
</svg>
<?php echo $date_type; ?>
</span><br/>
<span class="badge badge-dark">
<svg id="i-tag" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="17" height="17" fill="none" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<circle cx="24" cy="8" r="2" />
<path d="M2 18 L18 2 30 2 30 14 14 30 Z" />
</svg>
<?php echo $cat; ?>
</span><br/>
<span class="badge badge-primary">
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24">
<path fill="white" d="M15 12c0 1.654-1.346 3-3 3s-3-1.346-3-3 1.346-3 3-3 3 1.346 3 3zm9-.449s-4.252 8.449-11.985 8.449c-7.18 0-12.015-8.449-12.015-8.449s4.446-7.551 12.015-7.551c7.694 0 11.985 7.551 11.985 7.551zm-7 .449c0-2.757-2.243-5-5-5s-5 2.243-5 5 2.243 5 5 5 5-2.243 5-5z"/>
</svg>
<?php echo $hits; ?>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</a>
</div>
</div>
<?php
}
?>
<div class="container">
<ul class="pagination justify-content-center">
<?php
if($page == 1)
{
?>
<li class="page-item disable"><a class="page-link" href="#">First</a></li>
<?php
}
else
{
$link_prev = ($page > 1) ? $page - 1 : 1;
?>
<li class="page-item"><a class="page-link" href="?page=1">First</a></li>
<?php
}
for($i = $start_number; $i <= $end_number; $i++)
{
?>
<li class="page-item"><a class="page-link" href="?page=<?php echo $i; ?>"><?php echo $i; ?></a></li>
<?php
}
if($page == $jumlah_page)
{
?>
<li class="page-item disable"><a class="page-link" href="#">Last</a></li>
<?
}
else
{
$link_next = ($page < $jumlah_page)? $page + 1 : $jumlah_page;
?>
<li class="page-item"><a class="page-link" href="?page=<?php echo $link_next; ?>">Next</a></li>
<li class="page-item"><a class="page-link" href="?page=<?php echo $jumlah_page; ?>">Last</a></li>
<?php
}
}
?>
</ul>
</div>
</div>
</div>
<!--End Content-->
<?php
include("footer.php");
?>