<?php
/**
 * Ajax called script to lock a page version from auto deletion
 * @author Rihards Siliņš
 * @version 1 25/11/2015
 */
$cms_root_path = "../../../";
require_once($cms_root_path."includes/compatibility_includer.php");

$page = new Page();
$page->get($_POST['page_id']);
if (empty($page->id)) {
    exit("page not found");
}

$result = $page->toggleVersionLock();

if ($result === false) {
    echo "false";
} else {
    echo $result;
}