Merge branch 'master' into 'marijn-postdelete'
# Conflicts: # website/public/js/masonry.js
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
|
||||
if(empty($_POST["usr"]) and empty($_POST["grp"])) {
|
||||
header('HTTP/1.1 500 Non enough arguments');
|
||||
if(!isset($_POST["offset"]) or !isset($_POST["limit"])) {
|
||||
header('HTTP/1.1 500 Not enough arguments');
|
||||
}
|
||||
if(!isset($_POST["usr"]) and !isset($_POST["grp"])) {
|
||||
header('HTTP/1.1 500 Not enough arguments');
|
||||
}
|
||||
|
||||
session_start();
|
||||
@@ -12,24 +15,23 @@ require_once("../../queries/user.php");
|
||||
|
||||
if (isset($_SESSION["userID"]) &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
|
||||
if (empty($_POST["usr"])) {
|
||||
$posts = selectAllPosts(0, $_POST["grp"]);
|
||||
if(empty($_POST["usr"])) {
|
||||
$posts = selectSomePosts(0, $_POST["grp"], $_POST["offset"], $_POST["limit"]);
|
||||
} else {
|
||||
$posts = selectAllPosts($_POST["usr"], 0);
|
||||
$posts = selectSomePosts($_POST["usr"], 0, $_POST["offset"], $_POST["limit"]);
|
||||
}
|
||||
|
||||
if (!$posts) {
|
||||
header('HTTP/1.1 500 Query failed');
|
||||
if(!$posts) {
|
||||
echo false;
|
||||
} else {
|
||||
$results = $posts->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
for($i = 0; $i < sizeof($results); $i++) {
|
||||
$results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]);
|
||||
}
|
||||
|
||||
echo json_encode($results);
|
||||
}
|
||||
|
||||
$results = $posts->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
for ($i = 0; $i < sizeof($results); $i++) {
|
||||
$results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]);
|
||||
}
|
||||
|
||||
echo json_encode($results);
|
||||
} else {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user