<?php
/**
 * Ajax called script to unmark a page 'ready for review'
 * @author Rihards Siliņš
 * @version 1 25/11/2015
 */
$cms_root_path = "../../../";
require_once($cms_root_path."includes/compatibility_includer.php");

if (empty($_POST['page_id']) || !is_numeric($_POST['page_id'])) {
    header("HTTP/1.0 400 Bad Request");
    $error_message = "page_id missing from unmark for review request.";
    ContentManagerPanel::addMessage($error_message);
    die($error_message);
}

$page = ContentManagerPanel::loadPage($_POST['page_id'], false);
if (empty($page->id)) {
    header("HTTP/1.0 409 Conflict");
    $error_message = "The page you attempted to unmark for review was not found.";
    ContentManagerPanel::addMessage($error_message);
    die($error_message);
}

if ($page->setReviewStatus(0)) {
    die("true");
} else {
    die("false");
}
