diff --git a/docs/www/blog/generatearticle.php b/docs/www/blog/generatearticle.php index 7b17000..b18a126 100644 --- a/docs/www/blog/generatearticle.php +++ b/docs/www/blog/generatearticle.php @@ -5,45 +5,6 @@ include_once($COMMONS."/header.php"); include_once("blogpost.php"); include_once("blogpostcomment.php"); -/** - * Send a comment to the database. - * If the poster is not signed in, send "NULL" (as a string) as the $posterID - * The same goes for $parentId (that is the parent comment, - * if this one is a response) - * Returns: GUID PK of the newly added comment. - */ -function send_comment($conn, $blogId, $posterId, $content, $parentId) { - // If content is empty, do not post - if(empty($content)) { - return ""; - } - - // Get a uuid for the comment - $stmt = $conn->prepare("SELECT UUID()"); - $stmt->execute(); - $result = $stmt->fetch(PDO::FETCH_ASSOC); - $uuid = $result["UUID()"]; - - // Prepare the statemtnt - $stmt = $conn->prepare("INSERT INTO blogpost_comments - ( comment_id, parent_id, blogpost_id, poster_id, content) VALUES - (:comment_id, :parent_id, :blogpost_id, :poster_id, :content);"); - - // Bind all the parameters - $stmt->bindValue(":comment_id", $uuid, PDO::PARAM_STR); - $stmt->bindValue(":parent_id", $parentId == "NULL" - ? NULL : $parentId, PDO::PARAM_STR); - $stmt->bindValue(":blogpost_id", $blogId, PDO::PARAM_STR); - $stmt->bindValue(":poster_id", $posterId == "NULL" - ? NULL : $posterId, PDO::PARAM_STR); - $stmt->bindValue(":content", $content, PDO::PARAM_STR); - - // Execute the statement - $stmt->execute(); - - return $uuid; -} - /** * Load comments under a given blog. * Returns array of BlogpostComment objects.