<?php

require 'header.php';

$query = "SELECT value FROM " . SETTINGSTABLE . " WHERE parameter='CHRISTMAS'";
$sth = $globaldbh->prepare($query);
$sth->execute();
$row = $sth->fetch();

$data = array();
if ( $row['value'] == 'true' ) {
   $newvalue = 'false';
   $christmas = false;
} else {
   $newvalue = 'true';
   $christmas = true;
}
$data['christmas'] = $christmas;

$query = "UPDATE " . SETTINGSTABLE . " SET value=:value WHERE parameter='christmas'";
$sth = $globaldbh->prepare($query);
$fields = array();
$fields['value'] = $newvalue;
$sth->execute($fields);

header('Content-Type: application/json');
echo json_encode($data);
exit();

?>
