Rip website? #159

Merged
11291680 merged 1 commits from lars into master 2017-01-31 11:51:53 +01:00
6 changed files with 63 additions and 49 deletions

View File

@@ -21,7 +21,7 @@ $friends = json_decode($_POST["friends"]);
foreach($friends as $i => $friend) {
$friendshipStatus = getFriendshipStatus($friend->userID);
?>
<li class='friend-item <?= $extra ?>'>
<li class='friend-item'>
<form action='<?= $action ?>' method='<?= $actionType ?>'>
<button type='submit'
name='username'

View File

@@ -10,6 +10,7 @@
<body>
<?php
session_start();
if(isset($_SESSION["userID"])){
header("location: login.php");
}

View File

@@ -5,7 +5,7 @@
left: 0;
top: 80px;
height: calc(100% - 80px);
height: calc(100% - 120px);
width: 236px;
padding: 20px 10px;

View File

@@ -16,7 +16,6 @@ function selectLimitedFriends($userID, $limit) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
`onlinestatus`,
`role`
FROM
`user`
@@ -56,7 +55,10 @@ function selectAllFriends($userID) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
`onlinestatus`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
`role`
FROM
`user`
@@ -88,7 +90,10 @@ function selectAllFriendRequests() {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
`onlinestatus`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
`role`
FROM
`user`
@@ -235,7 +240,10 @@ function searchSomeFriends($n, $m, $search) {
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
`onlinestatus`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
`role`
FROM
`user`

View File

@@ -45,7 +45,10 @@ function selectUser($me, $other) {
) AS profilepicture,
`bio`,
`user`.`creationdate`,
`onlinestatus`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
`role`,
`fname`,
`lname`,
@@ -104,47 +107,47 @@ function selectAllUserGroups($userID) {
return $stmt;
}
//function selectAllUserPosts($userID) {
// $stmt = prepareQuery("
// SELECT
// `post`.`postID`,
// `post`.`author`,
// `title`,
// CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
// WHEN TRUE THEN
// CONCAT(LEFT(`post`.`content`, 150), '...')
// WHEN FALSE THEN
// `post`.`content`
// END
// AS `content`,
// `post`.`creationdate`,
// COUNT(`commentID`) AS `comments`,
// COUNT(`niet_slecht`.`postID`) AS `niet_slechts`
// FROM
// `post`
// LEFT JOIN
// `niet_slecht`
// ON
// `post`.`postID` = `niet_slecht`.`postID`
// LEFT JOIN
// `comment`
// ON
// `post`.`postID` = `comment`.`postID`
// WHERE
// `post`.`author` = :userID AND
// `groupID` IS NULL
// GROUP BY
// `post`.`postID`
// ORDER BY
// `post`.`creationdate` DESC
// ");
//
// $stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
// if(!$stmt->execute()) {
// return False;
// }
// return $stmt;
//}
function selectAllUserPosts($userID) {
$stmt = prepareQuery("
SELECT
`post`.`postID`,
`post`.`author`,
`title`,
CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
WHEN TRUE THEN
CONCAT(LEFT(`post`.`content`, 150), '...')
WHEN FALSE THEN
`post`.`content`
END
AS `content`,
`post`.`creationdate`,
COUNT(`commentID`) AS `comments`,
COUNT(`niet_slecht`.`postID`) AS `niet_slechts`
FROM
`post`
LEFT JOIN
`niet_slecht`
ON
`post`.`postID` = `niet_slecht`.`postID`
LEFT JOIN
`comment`
ON
`post`.`postID` = `comment`.`postID`
WHERE
`post`.`author` = :userID AND
`groupID` IS NULL
GROUP BY
`post`.`postID`
ORDER BY
`post`.`creationdate` DESC
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
if(!$stmt->execute()) {
return False;
}
return $stmt;
}
function select20UsersFromN($n) {
$q = prepareQuery("

View File

@@ -3,7 +3,9 @@
<img class="profile-picture main-picture" src="<?= $user["profilepicture"] ?>"><br />
<div class="platform">
<div class="status-buttons-container">
<button disabled class="gray"><?= $user["onlinestatus"] ?></button>
<button disabled class="gray">
<?= $user["onlinestatus"] ?>
</button>
<button disabled class="gray"><?= $user["role"] ?></button>
</div>
<div class="friend-button-container">