-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
90 lines (69 loc) · 2.99 KB
/
index.php
File metadata and controls
90 lines (69 loc) · 2.99 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
<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<title>InteractED</title>
<?php require "include/head.html"; ?>
<link rel="stylesheet" href="components/navigation/navigation.css">
<style>
.item:hover {
cursor: pointer;
cursor: hand;
}
</style>
</head>
<body class="grey lighten-5">
<?php require "components/navigation/navigation.php"; ?>
<div class="container">
<div class="row">
<?php
include "post/functions.php";
require "recommend/recommend.php";
?>
<?php postsByRatings(); ?>
<?php
include "include/connect.php";
$sql = "SELECT CategoryID, CategoryName FROM Categories
WHERE Implemented = 1 AND (SELECT count(*) FROM Articles WHERE CategoryID = Categories.CategoryID) > 0
ORDER BY CategoryName";
$Categories = $conn->query($sql);
$CurrentRow = 1;
while ($CategoryValues = $Categories->fetch_assoc()) {
$sql = 'SELECT A.PostID, A.Title, U.User FROM Articles A
INNER JOIN Users U ON A.CreatorID = U.UserCode
WHERE A.CategoryID = "' . $CategoryValues["CategoryID"] . '"';
$PostsInCategory = $conn->query($sql);
if ($PostsInCategory->num_rows > 0) {
echo '<h5 class="col s12">' . $CategoryValues["CategoryName"] . '</h5>';
$Cards = 1;
while ($PostValues = $PostsInCategory->fetch_assoc()) {
$Image = glob("images/posts/" . $PostValues["PostID"] . ".*");
if ($Cards == 1)
echo '<div class="row" style="margin-bottom: 0;">';
addVerticalCard($PostValues["PostID"], $Image[0], $PostValues["Title"], $PostValues["User"]);
if ($Cards++ == 4) {
$Cards = 1;
echo '</div>';
}
}
echo '</div>';
if ($CurrentRow++ < $Categories->num_rows) {
echo '<div class="divider col s12"></div>';
}
}
}
?>
<div class="row" style="margin-bottom: 0;">
<?php postsBySimilarTags(); ?>
</div>
</div>
</div>
<?php require "include/scripts.html"; ?>
<script src="components/navigation/navigation.js"></script>
<script>
$( ".item" ).click(function() {
window.location.href = "post?id=" + $(this).attr("id");
});
</script>
</body>
</html>