added alert box when emptpy posting

This commit is contained in:
Hendrik
2017-02-02 13:42:59 +01:00
parent 12d5e00731
commit d4d16661df
5 changed files with 56 additions and 31 deletions

View File

@@ -12,13 +12,15 @@ if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if (empty($_POST["title"]) or
empty($_POST["content"]) or
empty($_SESSION["userID"])
) {
if (empty($_SESSION["userID"])) {
header('HTTP/1.1 500 Non enough arguments');
}
if (empty(test_input($_POST["title"])) or
empty(test_input($_POST["content"]))
) {
echo "empty";
} else {
if (empty($_POST["group"])) {
// User Post
makePost(
@@ -43,6 +45,7 @@ if (isset($_SESSION["userID"]) &&
test_input($_POST["content"])
);
}
}
} else {
echo "frozen";
}

View File

@@ -31,14 +31,28 @@ function postPost() {
$.post("API/postPost.php", { title: title,
content : content,
group : groupID })
.done(function() {
.done(function(data) {
if (data == "empty") {
$('#alertbox').show();
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
window.scrollTo(0,0);
} else {
$('#alertbox').hide();
masonry(masonryMode);
}
});
} else {
$.post("API/postPost.php", { title: title,
content : content })
.done(function() {
.done(function(data) {
if (data == "empty") {
$('#alertbox').show();
$('#alerttext').html("Geen titel of inhoud; vul a.u.b. in.");
window.scrollTo(0,0);
} else {
$('#alertbox').hide();
masonry(masonryMode);
}
});
}
@@ -153,9 +167,6 @@ function loadMorePosts(uID, gID, offset, limit) {
return;
}
console.log(uID, gID, offset, limit);
$.post("API/getPosts.php", { usr : uID,
grp : gID,
offset : offset,

View File

@@ -32,6 +32,8 @@ function deletePost(postID) {
alert("Je account is bevroren, dus je kan geen posts verwijderen. Contacteer een admin als je denkt dat dit onjuist is.");
}
});
noposts = false;
postAmount = 0;
closeModal();
masonry(masonryMode);

View File

@@ -1,5 +1,10 @@
/* New */
.alertbox {
display: none;
background-color: firebrick;
}
.user-box {
text-align: center;
}

View File

@@ -1,4 +1,8 @@
<div class="content">
<div class='platform alertbox' id="alertbox">
<span id="alerttext"></span>
</div>
<div class="user-box">
<img class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br />
<div class="platform">