<?php
/**
 * Toggle admin page settings
 * allowed only AJAX calls
 * @copyright MTC media Ltd
 * @author: Jared Denysov <jared.denysov@mtcmedia.co.uk>
 * @version: 1.0
 */

// Check ajax headers
if(empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {
	die('Not allowed.');
}

$cms_root_path = "../../../";
require_once($cms_root_path."includes/compatibility_includer.php");

// Prepare Values
$key = $_REQUEST['options']['key'];
if ($_REQUEST['options']['value'] === "true") {
    $value = 1;
} else {
    $value = 0;
}

// Prepare page options
$page_options = new PageOptions();
$page_options->updateAdminByKey($key, $value);

// Return result
echo json_encode(array('success' => true), true);
