<?php
/////////////////////////////////////////////
// Install Template /////
////////////////////////////////////////////////////////////////////////
//	Breeze Website Builder
//	Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
//	For licensing, see license.txt.
//	Created: 12/13/2016	ELL
//
//
session_start();

// Repeat Breeze login instructions just incase cleaup and auto-redirect fails.
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Breeze Website Builder Install</title>
<link type="text/css" href="/manage/theme/classic/manager.css" rel="stylesheet" />
<link type="image/x-icon" href="/manage/images/favicon.ico" rel="shortcut icon" />
<style type="text/css">
#login_btn	{
	border-style:solid;
	border-width:medium;
	border-color:#0000FF;
	background-color:#00FFFF;
	text-decoration:none;
	font-size:18px;
	font-weight:bold;
	display:inline;
	padding:5px;
	line-height:18px;
	position:relative;
	top:-8px;
}
#login_btn A:link	{
	text-decoration:none;
}
#login_btn:hover	{
	cursor:pointer;
	color:#FFFFFF;
	background-color:#FFFF00;
}
	
.content_div	{
	padding-left:10px;
	padding-right:10px;
}
</style>
</head>

<body>
	<div align="center" id="login_logo"><img alt="Breeze Website Builder" src="/manage/theme/classic/images/Breeze_header_logo.png" /></div>
    <div id="header_divider_login"> </div>
    <div class="content_div">
    <p><b>Installation complete.</b>  Click here <a href="../manage/main.php"><span id="login_btn">Log into Breeze Website Builder</span></a> to login and start using the Breeze Website Builder&#8482;. You will be logged is as <em>admin</em> automatically the first time.  Bookmark that page and use <em>admin</em> for the username and the password you entered to log in at a later time. You may create other user accounts after logging in. For security purposes, delete the <b>install</b> folder and <b>SQL</b> folder immediately.</p>
    <p>Thanks for using the Breeze Website Builder&#8482;!</p>
    </div>

<?php
function Cleanup()
{
	$document_root = getenv('DOCUMENT_ROOT');
	$install_dir = $document_root . "/install";
	$SQL_folder = $document_root . "/SQL";
	$notes_dir = $install_dir . "/_notes";
	$notes_dir_2 = $SQL_folder . "/_notes";
	if (file_exists($notes_dir))	{
		array_map('unlink', glob($notes_dir . "/*"));
		rmdir($notes_dir);
	}
	array_map('unlink', glob($install_dir . "/*"));
	rmdir($install_dir);
	
	if (file_exists($notes_dir_2))	{
		array_map('unlink', glob($notes_dir_2 . "/*"));
		rmdir($notes_dir_2);
	}
	array_map('unlink', glob($SQL_folder . "/*"));
	rmdir($SQL_folder);
}
?>

<script>
	var code = "window.location='/manage/main.php';";
	setTimeout(code, 1000);
</script>

<?php
	Cleanup();
?>
</body>
</html>