<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 12/3/2014	ELL
	
	include ("check_session.php");

	$area_old_name = $_REQUEST['area_old_name'];
	$name_prefix = $_REQUEST['name_prefix'];
	$name_suffix = $_REQUEST['name_suffix'];
	if (is_numeric($name_suffix))
		$special_page_name = substr($name_prefix, 0, strlen($name_prefix)-1) . $name_suffix;
	else
		$special_page_name = $name_prefix . $name_suffix;
		
	$query = "SELECT * FROM " . BWB_TABLE_PREFIX . "page_data_special WHERE page_name='" . $area_old_name . "'";
	$result = $bwb_dbh->query($query);
	$row = $result->fetch(PDO::FETCH_ASSOC);
	$page_content = $row['page_content'];
	if (isset($row['plugins']))
		$plugins_str = "plugins='" . $row['plugins'] . "', ";
	else
		$plugins_str = "";
	$disable_site_styles = $row['disable_site_styles'];
	$revised = $row['revised'];
	
	$query = "INSERT INTO " . BWB_TABLE_PREFIX . "page_data_special SET page_name='" . $special_page_name . "' page_content='" . $page_content . "', " . $plugins_str . "disable_site_styles=" . $disable_site_styles . " revised='" . $revised . "'";
	$cnt = $bwb_dbh->exec($query);
?>