<?php
/////////////////////////////////////////////
// Upload Favicon /////
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright EB Dynamics, Inc., Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 11/13/2009	ELL
// Revised: 2/8/2012	ELL
// Added reference to images folder constant.
// 
//
	include ("check_session.php");
?>
<html>
<head>
<title>Breeze Website Builder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="manager.css" type="text/css">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<script language="javascript" type="text/javascript">
function OpenHelpWindow()
{
	window.open("http://breezewebsitebuilder.com/docs/cms/help.html#edit_favicon", "Help", "scrollbars=1,resizable=1,status=0,toolbar=0,menubar=0,location=0,height=700,width=800");
}

function DeleteConfirm()
{
	document.getElementById("delete_confirm").style.display = "block";
	document.getElementById("delete_confirm").style.position = "absolute";
	document.getElementById("delete_confirm").style.top = "100px";
	document.getElementById("delete_confirm").style.left = "300px";
	document.getElementById("delete_confirm").style.width = "450px";
	document.getElementById("delete_confirm").style.backgroundColor = "#FFF";
	document.getElementById("delete_confirm").style.borderStyle = "solid";
	document.getElementById("delete_confirm").style.borderWidth = "2px";
	document.getElementById("delete_confirm").style.borderColor = "#000";
}

function DeleteFavicon()
{
	document.getElementById("delete_confirm").style.display = "none";
	var url = "delete_favicon.php";
	window.location = url;
}

function HideDelete()
{
	document.getElementById("delete_confirm").style.display = "none";
}
</script>
</head>

<body>

<form name="frmUploadFavIcon" enctype="multipart/form-data" method="post" action="upload_favicon.php">
<table border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>Upload Favicon</td>
    <td width="100">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
	<td align="center"><input name="favicon" type="file"></td>
    <td>&nbsp;</td>
   <?php
   		if (BWB_BASE_DIR == '')
   			$path = "/" . BWB_IMAGE_DIR . "/favicon.ico";
		else
			$path = "/" . BWB_BASE_DIR . "/" . BWB_IMAGE_DIR . "/favicon.ico";
		
		$favicon = getenv('DOCUMENT_ROOT') . $path;
		if (file_exists($favicon))
			echo "<td><img src='" . $path . "' alt='favicon.ico' /></td>";
		else
			echo "<td>&nbsp;</td>";
   ?>
  </tr>
  <tr>
    <td align="center"><input name="submit" type="submit" value="Upload"></td>
    <td>&nbsp;</td>
    <?php
		if (file_exists($favicon))
    		echo "<td><img src='images/delete.png' alt='Delete Favicon' border='0' onClick=\"DeleteConfirm();\" /></td>";
		else
			echo "<td>&nbsp;</td>";
   ?>
  </tr>
  <tr>
  	<td colspan="3">&nbsp;</td>
  </tr>
  <tr>
  	<td colspan="3" align="center"><input type="button" name="Back" value="Back to Main Menu" onClick="window.location.href='main.php?mode=head';" /></td>
    <td valign="top" align="right" width="10%">
      <div id="help_button" onClick="OpenHelpWindow();">
        &nbsp;
      </div>
    </td>
  </tr>
</table>
</form>

<div id="delete_confirm">
<table border="0" cellspacing="0" cellpadding="5" align="center">
  <tr>
    <td colspan="2">Are your sure you want to delete the favicon?</td>
  </tr>
  <tr>
	<td align="center"><input type="button" name="delete" id="delete" value="Yes" onClick="DeleteFavicon();" /></td>
	<td align="center"><input type="button" name="hide_delete" value="No" onClick="HideDelete();" />
    </td>
  </tr>
</table>
</div>

</body>
</html>