<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 12/14/2010	ELL
// Revised: 2/8/2012	ELL
// Added table prefix handling.
// Modified: 12/2/2016	ELL
// Consolidated all menu items tables into menu_items.
// 
// 
	
	include ("check_session.php");
	
	$menu = $_REQUEST['menu'];
	if (!isset($menu))
		$menu = $_SESSION['last_menu_edited'];
	else
		$_SESSION['last_menu_edited'] = $menu;
	
	$query = "SELECT * FROM " . BWB_TABLE_PREFIX . "menu_items WHERE menu = '" . $menu . "' ORDER BY sort_order";
	$result = $bwb_dbh->query($query);
	
	if ($result->rowCount() < 1)
	{
		echo "-no data-";
		exit;
	}

	$row_delim = "";
	while ($row = $result->fetch(PDO::FETCH_ASSOC))
	{
		$row['item_text'] = stripslashes($row['item_text']);
		$table .= $row_delim . json_encode($row);
		$row_delim = "@@@@@";
	}
	
	print $table;

?>