<?php
/////////////////////////////////////////////
// Upload Favicon /////
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, 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.
// Revised: 7/1/2013	ELL
// Implemented popup message class.
// 
//
	include ("check_session.php");
	
	$favicon_uploaded = $_REQUEST['favicon_uploaded'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Editing Favicon | Breeze Website Builder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="theme/<?php echo $theme; ?>/manager.css" type="text/css">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">

<style type="text/css">
#help_button	{	
	position:relative;
	display:block;
	top:-15px;
	left:215px;
	height:31px;
	width:31px;
	z-index:100;
}
#upload_favicon_btn	{	width:80px;	}
</style>

<script type="text/javascript" src="js/mouse_position.js"></script>
<script type="text/javascript" src="js/popup_msg.js"></script>
<script type="text/javascript" src="js/edit_favicon.js"></script>

<script>
<?php
	echo "	var EDIT_FAVICON_DELETE_FAVICON_CONFIRM = \"" . EDIT_FAVICON_DELETE_FAVICON_CONFIRM . "\";\n";
	echo "	var YES_WORD = \"" . YES_WORD . "\";\n";
	echo "	var NO_WORD = \"" . NO_WORD . "\";\n";
?>
</script>
</head>

<body>
<div class="button_heading_sub_level_1" id="edit_favicon_heading"><div class="button_heading_text_sub_level_1"><?php echo EDIT_FAVICON_HEADING; ?></div><div class="help_button" id="help_button" onClick="OpenHelpWindow();">&nbsp;</div></div>

<form name="frmUploadFavIcon" id="frmUploadFavIcon" enctype="multipart/form-data" method="post" action="upload_favicon.php">
<table border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td><?php echo EDIT_FAVICON_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">
    <div class="button_console_upload" style="width:110px;" id="upload_favicon_btn" onClick="document.getElementById('frmUploadFavIcon').submit();"><span class='button_console_text_w_icon'><?php echo EDIT_FAVICON_UPLOAD_BTN; ?></span></div>
    </td>
    <td>&nbsp;</td>
    <?php
		if (file_exists($favicon))
    		echo "<td><img src='theme/" . $theme . "/images/delete.png' alt='Delete Favicon' border='0' onClick=\"DeleteConfirm();\" style='cursor:pointer;' /></td>";
		else
			echo "<td>&nbsp;</td>";
   ?>
  </tr>
  <tr>
  	<td colspan="3">&nbsp;</td>
  </tr>
</table>
</form>

<?php include("lib/popup_msg.html"); ?>

<script language="javascript" type="text/javascript">
	popup_msg.HidePopupMsg();
<?php	if ($favicon_uploaded == 1)	{	?>
	popup_msg.top_offset = 100;
	popup_msg.left_offset = 320;
	popup_msg.popup_msg_type = 1;
	popup_msg.popup_timeout = 3000;
	popup_msg.status_msg = "<?php echo EDIT_FAVICON_UPLOAD_SUCCESS_MSG; ?>";
	popup_msg.ShowPopupMsg();
<?php	}	?>
</script>
</body>
</html>