<?php
	////////////////////////////////////////////////////////////////////////
	// Breeze Website Builder
	// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
	// For licensing, see license.txt.
	// Created: 11/13/2013
	// 
	
	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="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="manager.css" type="text/css">

<style type="text/css">
#help_button	{	
	position:relative;
	display:block;
	top:-15px;
	left:215px;
	height:31px;
	width:31px;
	z-index:100;
}
body	{
	background-image:url(images/Breeze_logo_large_lt-gray.png);
	background-repeat:no-repeat;
	background-position:center;
	background-attachment:fixed;
}
.install_files_warning	{
	color:#Ff0000;
	font-size:18px
}
.download_button	{
	display:inline;
	background-color:#585858;
	color:#FFFFFF;
	padding-top:5px;
	padding-bottom:5px;
	padding-left:15px;
	padding-right:15px;
}
.download_button:hover	{	
	cursor:pointer;
	background-color:#A6A6A6;
	color:#2C2C2C;
}
</style>

</head>
<body>

<div class="button_heading_sub_level_1" id="dashboard_heading"><div class="button_heading_text_sub_level_1">Dashboard</div><div class="help_button" id="help_button" onClick="OpenHelpWindow();">&nbsp;</div></div>

<p>Welcome <?php echo $userid;	?> to the Breeze Website Builder&#8482;.  Click on any of the menu headings on the left to access the system tools for building your website.</p>

<?php
	$document_root = $_SERVER['DOCUMENT_ROOT'];
	$install_file = $document_root . "/install/do_install.php";
	$run_sql_file = $document_root . "/install/run_sql_install.php";
	if (file_exists($install_file) || file_exists($run_sql_file))
	{
?>
	<p class="install_files_warning"><b>WARNING!!!</b> Your installation folder is still present on the server.  Your site could easily be compromised.  Please click <a href="delete_install.php"><b>here</b></a> to delete the <b><em>install</em></b> and <b><em>SQL</em></b> folders from your server.</p>
<?php
	}
	
	$latest_version = file_get_contents('http://breezewebsitebuilder.com/breeze_version.php');
	
	$query = "SELECT * FROM `" . BWB_TABLE_PREFIX . "version`";
	$result = $bwb_dbh->query($query);
	$row = $result->fetch(PDO::FETCH_ASSOC);
	$version = $row["version"];
	
	if ($version == $latest_version)
		echo "The latest version of the Breeze Website Builder&#8482; is installed: Version: $version<br />\n";
	else
	{
		echo "Version $version of the Breeze Website Builder&#8482; is installed.  The latest version is $latest_version.  Click <span class='download_button' onClick=\"window.open('http://breezewebsitebuilder.com/download_page.php?last_id=dashboard');\"> Download </span>&nbsp;to download the latest version.<br />\n";
		echo "<div style='padding-top:5px;'>\n";
		if ($access_level == "admin")
			echo "After downloading update, click <span class='download_button' onClick=\"parent.workspace.location='upload_update.php';\"> here </span> to install the update.<br />\n";
		else
			echo "You will need to be logged in as an administrator to install the update.  Contact your system administrator to update your system.<br />\n";
		echo "</div>\n";
	}
?>


<p>Page count: 
<?php 
	$query = "SELECT page_name FROM " . BWB_TABLE_PREFIX . "page_data ORDER BY page_name";
	$result = $bwb_dbh->query($query);
	$num_results = $result->rowCount();
	echo $num_results;
?>
</p>
<p>Blog count: 
<?php 
	$query = "SELECT page_name FROM " . BWB_TABLE_PREFIX . "blogs ORDER BY revised";
	$result = $bwb_dbh->query($query);
	$num_results = $result->rowCount();
	echo $num_results;
?>
</p>

</body>
</html>