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
Showing only changes of commit d5d9d5857a - Show all commits

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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