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

	$old_name = $_REQUEST['old_name'];
	$new_name = $_REQUEST['new_name'];
	$new_desc = $_REQUEST['new_desc'];
	if (isset($_REQUEST['new_exclude']) && ($_REQUEST['new_exclude'] != 0))
		$new_exclude = 1;
	else
		$new_exclude = 0;
	if (isset($_REQUEST['new_show_custom_styles']) && ($_REQUEST['new_show_custom_styles'] != 0))
		$new_show_custom_styles = 1;
	else
		$new_show_custom_styles = 0;

	$query = "UPDATE `" . BWB_TABLE_PREFIX . "style_sheets` SET `name` = '$new_name', `description` = '$new_desc', `exclude` = '$new_exclude', `show_custom_styles` = '$new_show_custom_styles' WHERE `name` = '$old_name'";
	$cnt = $bwb_dbh->exec($query);
		
	$query = "RENAME TABLE `" . BWB_TABLE_PREFIX . $old_name . "_classes` TO `" . BWB_TABLE_PREFIX . $new_name . "_classes`";
	$cnt = $cnt + $bwb_dbh->exec($query);
	
	$query = "RENAME TABLE `" . BWB_TABLE_PREFIX . $old_name . "_css` TO `" . BWB_TABLE_PREFIX . $new_name . "_css`";
	$cnt = $cnt + $bwb_dbh->exec($query);
	
	echo $cnt;
?>
