<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 2/17/2015	ELL
// Modified: 10/2/2015	ELL
// Added layout template selection.
// Added insert default border areas in custom border areas check boxes.
// Added body onload function name as an attribute.
// Revised: 5/1/2018	ELL
// Added on-the-fly minification of all content.

	include ("check_session.php");
	
	$page_name = $_REQUEST['page_name'];
	$template = $_REQUEST["template_name"];
	$use_table_structure = (isset($_REQUEST['use_table_structure']) ? 1 : 0);
	$use_table_structure_mobile = (isset($_REQUEST['use_table_structure_mobile']) ? 1 : 0);
	$disable_site_styles = (isset($_REQUEST['disable_site_styles']) ? 1 : 0);
	$body_onload = (isset($_REQUEST['body_onload']) ? 1 : 0);
	$body_onload_function = $_REQUEST["body_onload_function"];
	$insert_default_head = (isset($_REQUEST['insert_default_head']) ? 1 : 0);
	$insert_default_header = (isset($_REQUEST['insert_default_header']) ? 1 : 0);
	$insert_default_top = (isset($_REQUEST['insert_default_top']) ? 1 : 0);
	$insert_default_left = (isset($_REQUEST['insert_default_left']) ? 1 : 0);
	$insert_default_right = (isset($_REQUEST['insert_default_right']) ? 1 : 0);
	$insert_default_bottom = (isset($_REQUEST['insert_default_bottom']) ? 1 : 0);
	$insert_default_footer = (isset($_REQUEST['insert_default_footer']) ? 1 : 0);
	$minify = (isset($_REQUEST['minify']) ? 1 : 0);
	
	$query = "UPDATE " . BWB_TABLE_PREFIX . "page_data SET template = '$template', use_table_structure = '$use_table_structure', use_table_structure_mobile = '$use_table_structure_mobile', disable_site_styles = '$disable_site_styles', body_onload = '$body_onload', body_onload_function = '$body_onload_function', insert_default_head = '$insert_default_head', insert_default_header = '$insert_default_header', insert_default_top = '$insert_default_top', insert_default_left = '$insert_default_left', insert_default_right = '$insert_default_right', insert_default_bottom = '$insert_default_bottom', insert_default_footer = '$insert_default_footer', minify = '$minify' WHERE page_name = '$page_name'";
	$result = $bwb_dbh->query($query);
	
	$_SESSION['last_page_edited'] = $page_name;
	echo 1;
?>