Gazelle/sections/comments/take_post.php

26 lines
742 B
PHP
Raw Normal View History

2013-08-28 23:08:41 +00:00
<?
authorize();
if (!isset($_REQUEST['page']) || !in_array($_REQUEST['page'], array('artist', 'collages', 'requests', 'torrents')) || !isset($_POST['pageid']) || !is_number($_POST['pageid']) || !isset($_POST['body']) || trim($_POST['body']) === '') {
error(0);
}
if ($LoggedUser['DisablePosting']) {
error('Your posting privileges have been removed.');
}
$Page = $_REQUEST['page'];
$PageID = (int)$_POST['pageid'];
if (!$PageID) {
error(404);
}
if (isset($_POST['subscribe']) && Subscriptions::has_subscribed_comments($Page, $PageID) === false) {
Subscriptions::subscribe_comments($Page, $PageID);
}
$PostID = Comments::post($Page, $PageID, $_POST['body']);
header("Location: " . Comments::get_url($Page, $PageID, $PostID));
die();