<?php
	////////////////////////////////////////////////////////////////////////
	// Breeze Website Builder
	// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
	// For licensing, see license.txt.
	// Created: 10/7/2011
	// 
	
	include ("check_session.php");
	
	$activate = $_REQUEST['activate'];
		
	$document_root = getenv('DOCUMENT_ROOT');
	$html_index = $document_root . "/index.html";
	$construction = $document_root . "/construction.html";
	$custom_index = $document_root . "/custom_index.html";
	if ($activate == 1)
	{
		if (file_exists($html_index) && !file_exists($construction))
			rename($html_index, $construction);
		elseif (file_exists($html_index) && file_exists($construction)) // Got custom construction page.
			rename($html_index, $construction);	
	}
	elseif ($activate == 0)
	{
		if (!file_exists($html_index) && file_exists($construction))
			rename($construction, $html_index);
		elseif (!file_exists($html_index) && !file_exists($construction)) // Got custom construction page.
		{
			echo "<p>You are missing the construction template file.  If you want to take your site off line, create an 'under construction' page named 'index.html' and FTP it up to your web root folder.</p>\n";
			echo "<input type=\"button\" name=\"Back\" value=\"Back to Manage Users and Site Options\" onClick=\"window.location.href='admin_function_select.php';\" />\n";
			exit;
		}
	}
	
	header("Location: admin_function_select.php");

?>