Merge branch 'hendrik-post' into 'master'
Hendrik post See merge request !130
This commit was merged in pull request #134.
This commit is contained in:
18
website/public/API/postComment.php
Normal file
18
website/public/API/postComment.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require("../../queries/post.php");
|
||||||
|
require("../../queries/connect.php");
|
||||||
|
require("../../queries/checkInput.php");
|
||||||
|
if (empty($_POST['newcomment-content'])) {
|
||||||
|
echo 0;
|
||||||
|
} else {
|
||||||
|
if(makeComment($_POST['postID'],
|
||||||
|
$_SESSION['userID'],
|
||||||
|
test_input($_POST['newcomment-content']))) {
|
||||||
|
echo 1;
|
||||||
|
} else {
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
17
website/public/API/postPost.php
Normal file
17
website/public/API/postPost.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require("../../queries/post.php");
|
||||||
|
require("../../queries/connect.php");
|
||||||
|
require("../../queries/checkInput.php");
|
||||||
|
|
||||||
|
if (empty($_POST['newpost-title'])) {
|
||||||
|
} else {
|
||||||
|
makePost($_SESSION['userID'],
|
||||||
|
null,
|
||||||
|
test_input($_POST['newpost-title']),
|
||||||
|
test_input($_POST['newpost-content']));
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: ../profile.php");
|
||||||
@@ -62,10 +62,11 @@ function masonry(mode) {
|
|||||||
|
|
||||||
if(mode == 1) {
|
if(mode == 1) {
|
||||||
$postInput = $("<div class=\"post platform\">");
|
$postInput = $("<div class=\"post platform\">");
|
||||||
$form = $postInput.append($("<form>"));
|
$form = $("<form action=\"API/postPost.php\" method=\"post\">");
|
||||||
|
$postInput.append($form);
|
||||||
|
|
||||||
$form.append($("<input class=\"newpost\" placeholder=\"Titel\" type=\"text\">"));
|
$form.append($("<input class=\"newpost\" name=\"newpost-title\" placeholder=\"Titel\" type=\"text\">"));
|
||||||
$form.append($("<textarea class=\"newpost\" placeholder=\"Schrijf een berichtje...\">"));
|
$form.append($("<textarea class=\"newpost\" name=\"newpost-content\" placeholder=\"Schrijf een berichtje...\">"));
|
||||||
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
|
||||||
columns[0][1].append($postInput);
|
columns[0][1].append($postInput);
|
||||||
|
|
||||||
|
|||||||
18
website/public/js/post.js
Normal file
18
website/public/js/post.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
function postComment() {
|
||||||
|
$.post(
|
||||||
|
"API/postComment.php",
|
||||||
|
$("#newcommentform").serialize()
|
||||||
|
);
|
||||||
|
|
||||||
|
$("#newcomment").val("");
|
||||||
|
|
||||||
|
//reload post
|
||||||
|
$.get(
|
||||||
|
"API/loadPost.php",
|
||||||
|
$("#newcommentform").serialize()
|
||||||
|
).done(function (data) {
|
||||||
|
$('#modal-response').html(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
function loadPost(postID) {
|
|
||||||
$.get(
|
|
||||||
"API/loadPost.php",
|
|
||||||
$(postID).serialize()
|
|
||||||
).done(function (data) {
|
|
||||||
$('#modal-response').innerHTML= JSON.parse(data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<?php include("../views/head.php"); ?>
|
<?php include("../views/head.php"); ?>
|
||||||
|
|
||||||
<script src="js/masonry.js"></script>
|
<script src="js/masonry.js"></script>
|
||||||
<!-- <script src="js/profile.js"></script>-->
|
<script src="js/post.js"></script>
|
||||||
<style>
|
<style>
|
||||||
@import url("styles/profile.css");
|
@import url("styles/profile.css");
|
||||||
@import url("styles/post-popup.css");
|
@import url("styles/post-popup.css");
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function makePost($userID, $groupID, $title, $content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeComment($postID, $userID, $content) {
|
function makeComment($postID, $userID, $content) {
|
||||||
$stmt = $_GLOBAL["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`comment` (
|
`comment` (
|
||||||
`postID`,
|
`postID`,
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ echo("
|
|||||||
|
|
||||||
<div class='post-comments'>
|
<div class='post-comments'>
|
||||||
<div class="commentfield">
|
<div class="commentfield">
|
||||||
<form name="newcomment" method="post">
|
<form id="newcommentform" action="javascript:postComment();">
|
||||||
<textarea placeholder="Laat een reactie achter..."></textarea> <br>
|
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
||||||
|
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..."></textarea> <br>
|
||||||
<input type="submit" value="Reageer!">
|
<input type="submit" value="Reageer!">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -44,61 +44,6 @@
|
|||||||
|
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
|
|
||||||
<!-- --><?php
|
|
||||||
// if ($_SESSION["userID"] === $userID) {
|
|
||||||
// ?>
|
|
||||||
<!-- <div class="post platform">-->
|
|
||||||
<!-- <form>-->
|
|
||||||
<!-- <input type="text" class="newpost" placeholder="Titel">-->
|
|
||||||
<!-- <textarea class="newpost" placeholder="Schrijf een berichtje..."></textarea>-->
|
|
||||||
<!-- <input type="submit" value="Plaats!">-->
|
|
||||||
<!-- </form>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- --><?php
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// while($post = $posts->fetch()) {
|
|
||||||
// $nicetime = nicetime($post["creationdate"]);
|
|
||||||
// echo "
|
|
||||||
// <div class='post platform'>
|
|
||||||
// <h2>${post["title"]}</h2>
|
|
||||||
// <p>${post["content"]}</p>
|
|
||||||
// <p class=\"subscript\">${nicetime} geplaatst.</p>
|
|
||||||
// </div>
|
|
||||||
// ";
|
|
||||||
// }
|
|
||||||
// ?>
|
|
||||||
<!-- --><?php
|
|
||||||
// if ($_SESSION["userID"] === $userID) {
|
|
||||||
// ?>
|
|
||||||
<!-- <div class="post platform">-->
|
|
||||||
<!-- <form>-->
|
|
||||||
<!-- <input type="text" class="newpost" placeholder="Titel">-->
|
|
||||||
<!-- <textarea class="newpost" placeholder="Schrijf een berichtje..."></textarea>-->
|
|
||||||
<!-- <input type="submit" value="Plaats!">-->
|
|
||||||
<!-- </form>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- --><?php
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// while($post = $posts->fetch()) {
|
|
||||||
// $nicetime = nicetime($post["creationdate"]);
|
|
||||||
// $postID = $post["postID"];
|
|
||||||
// echo "
|
|
||||||
// <div class='post platform' onclick='requestPost(this)'>
|
|
||||||
// <h2>${post["title"]}</h2>
|
|
||||||
// <p>${post["content"]}</p>
|
|
||||||
// <p class=\"subscript\" title='" . $post["creationdate"] ."'>${nicetime} geplaatst.</p>
|
|
||||||
// <form>
|
|
||||||
// <input type='hidden'
|
|
||||||
// name='postID'
|
|
||||||
// value='$postID'
|
|
||||||
// />
|
|
||||||
// </form>
|
|
||||||
// </div>
|
|
||||||
// ";
|
|
||||||
// }
|
|
||||||
// ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
|
|||||||
Reference in New Issue
Block a user