Merge branch 'master' into hendrik-post
This commit is contained in:
@@ -7,24 +7,31 @@ if(!isset($_POST["usr"]) and !isset($_POST["grp"])) {
|
||||
header('HTTP/1.1 500 Not enough arguments');
|
||||
}
|
||||
|
||||
session_start();
|
||||
|
||||
require_once ("../../queries/post.php");
|
||||
require_once ("../../queries/nicetime.php");
|
||||
require_once("../../queries/user.php");
|
||||
|
||||
if(empty($_POST["usr"])) {
|
||||
$posts = selectSomePosts(0, $_POST["grp"], $_POST["offset"], $_POST["limit"]);
|
||||
} else {
|
||||
$posts = selectSomePosts($_POST["usr"], 0, $_POST["offset"], $_POST["limit"]);
|
||||
}
|
||||
|
||||
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"]);
|
||||
if (isset($_SESSION["userID"]) &&
|
||||
getRoleByID($_SESSION["userID"]) != 'banned') {
|
||||
if(empty($_POST["usr"])) {
|
||||
$posts = selectSomePosts(0, $_POST["grp"], $_POST["offset"], $_POST["limit"]);
|
||||
} else {
|
||||
$posts = selectSomePosts($_POST["usr"], 0, $_POST["offset"], $_POST["limit"]);
|
||||
}
|
||||
|
||||
echo json_encode($results);
|
||||
}
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user