<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 2/2/2017	ELL
// 
// 
// 
// 
	include ("check_session.php");
	
	$i = 0;
	$query_tags = "SELECT * FROM `" . BWB_TABLE_PREFIX . "style_sheets` ORDER BY `sort_order`";
	$result_tags = $bwb_dbh->query($query_tags);
	while ($row_tags = $result_tags->fetch(PDO::FETCH_ASSOC))
	{
		$style_sheet_id_string = "style_sheet_" . $i;
		$sort_order_id_string = "sort_order_" . $i;
		
		$style_sheet = $_POST[$style_sheet_id_string];
		if ($_POST[$sort_order_id_string])
			$sort_order = $_POST[$sort_order_id_string];
		else
			$sort_order = 0;
			
		//Insert new data into table.
		$query = "UPDATE `" . BWB_TABLE_PREFIX . "style_sheets` SET `sort_order` = " . $sort_order . " WHERE `name` = '$style_sheet'";
		$cnt = $bwb_dbh->exec($query);
				
		$i++;
	} // end while
	
	echo 1;
?>