<?php require "../includes/config.php"; if (!(isset($_POST["sticky_post_id"]) && isset($_POST["soc_name"]))) { apologize("Something went wrong."); } session_start(); switch ($_POST["action"]) { case 'STICKY': if (sticky_post($_POST["sticky_post_id"], $_POST["soc_id"]) === false) { apologize("Failed to sticky post."); } break; case 'UNSTICKY': if (unsticky_post($_POST["sticky_post_id"], $_POST["soc_id"]) === false) { apologize("Failed to sticky post."); } break; } redirect("post.php?soc=" . $_POST["soc_name"]);
function del_post($pid, $sname, $comment = null) { if (!($p = get_post($pid))) { apologize("Post does not exist."); } if ($p["status"] == 'DELETED') { apologize("Post already deleted."); } if (!am_mod(get_society($sname))) { apologize("Access Denied."); } if ($p["status"] == 'STICKIED') { unsticky_post($p, "Prepare for deletion."); } return tquery("\tUPDATE posts\n\t\t\t\t\t\t SET status = ?\n\t\t\t\t\t\t WHERE post_id = ?;\n\n\t\t\t\t\t\tINSERT INTO post_control_log(post_id, mod_id, action, comment)\n\t\t\t\t\t\tVALUES(?, ?, ?, ?);", ["DELETED", $p["post_id"]], [$p["post_id"], $_SESSION["user"]["user_id"], "DELETE", $comment]); }