<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 5/11/2015	ELL
// Revised: 3/29/2017	ELL
// Added include of write_custom_font_css.php to move creation of font CSS from editing style sheets to adding/deleting custom fonts.
// 
// 
// 
	include ("check_session.php");

	$font = $_POST['font'];
	$src = stripslashes($_POST['src']);
	$src2 = "'" . $src . "'";
	$src2 = addslashes($src2);
	$src = addslashes($src);
	
	// Delete font from database.
	$query = "DELETE FROM `" . BWB_TABLE_PREFIX . "fonts` WHERE (`font` = '$font') AND ((`src` = '$src') OR (`src` = '$src2'))";
	$cnt = $bwb_dbh->exec($query);
	
	$document_root = $_SERVER['DOCUMENT_ROOT'];
	if ((BWB_BASE_DIR == "") && (BWB_WEBPAGE_DIR == ""))
		$src_file = $document_root . "/" . $src;
	elseif ((BWB_BASE_DIR != "") && (BWB_WEBPAGE_DIR == ""))
		$src_file = $document_root . "/" . BWB_BASE_DIR . "/" . BWB_WEBPAGE_DIR . "/" . $src;
	else	{
		$src = str_replace("../", "", $src);
		$src_file = $document_root . "/" . BWB_BASE_DIR . "/" . $src;
	}
		
	if ((isset($src_file)) && ($src_file != "") && (substr($src, 0, 4) != "http"))
		unlink($src_file);
	
	// Create cust font CSS file.
	include("write_custom_font_css.php");
	
	echo 1;
?>
