<?php
	require_once "database.php";
	require_once "constants.php";
	require_once "fields.php";

	$recovery = false;
	if ( !databaseIsReadable() ) {
		if ( basename($_SERVER['PHP_SELF']) != 'settings.php' ) {
			header('Location: /settings.php');
			$recovery = true;
		}
	}
	
	date_default_timezone_set('UTC');

	$VERSION_NUMBER = "2.18.4";
	$VERSION_DATE = "Thurs, 2 July 2026";
?>

<!DOCTYPE HTML>
<html>
	<head>
		<title>A+T Processor</title>
		<meta charset="UTF-8">
		<meta name="description" content="ATP1 Webserver">
		<meta name="author" content="Sam Meredith">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<link rel="stylesheet" href="/css/normalize.css<?php echo '?v=' . $VERSION_NUMBER;?>">
		<link rel="stylesheet" href="/css/jquery-ui.min.css<?php echo '?v=' . $VERSION_NUMBER;?>">
		<link rel="stylesheet" href="/css/jquery-ui.structure.min.css<?php echo '?v=' . $VERSION_NUMBER;?>">
		<link rel="stylesheet" href="/css/jquery-ui.theme.min.css<?php echo '?v=' . $VERSION_NUMBER;?>">
		<link rel="stylesheet" href="/css/atp-webserver.css<?php echo '?v=' . $VERSION_NUMBER;?>">
		<link rel="stylesheet" href="/css/all.min.css<?php echo '?v=' . $VERSION_NUMBER;?>">

		<script type="text/javascript" src="/js/jquery.min.js<?php echo '?v=' . $VERSION_NUMBER;?>"></script>
		<script type="text/javascript" src="/js/jquery-ui.min.js<?php echo '?v=' . $VERSION_NUMBER;?>"></script>
		<script type="text/javascript" src="/js/database.js<?php echo '?v=' . $VERSION_NUMBER;?>"></script>
		<script type="text/javascript" src="/js/fields.js<?php echo '?v=' . $VERSION_NUMBER;?>"></script>
		<script type="text/javascript" src="/js/page-handler.js<?php echo '?v=' . $VERSION_NUMBER;?>"></script>
		<script type="text/javascript" src="/js/navigation.js<?php echo '?v=' . $VERSION_NUMBER;?>"></script>
		<script type="text/javascript" src="/js/helpers.js<?php echo '?v=' . $VERSION_NUMBER;?>"></script>
		<script type="text/javascript" src="/js/validation.js<?php echo '?v=' . $VERSION_NUMBER;?>"></script>
	</head>
	
	<body id="atp-webserver">
		<header id="atp-header">
			<div class="site-title">
				<a class="icon-logo" href="home.php">
					A+T Instruments
				</a>
			</div>
			<div class="nav-container">
				<nav class="nav">
					<button class="hidden"><div class="hamburger"></div></button>
					<ul class="visible-links">
						<li>
							<a href="/speedLog.php?src=0" id="Speed">
								Speed/Current
							</a>
						</li>
						<li>
							<a href="/position.php" id="Position">
								Position/Attitude
							</a>
						</li>
						<li>
							<a href="/depth.php?src=0" id="Depth">
								Depth
							</a>
						</li>
						<li>
							<a href="/windMeasured.php?src=0" id="Wind">
								Wind
							</a>
						</li>
						<li>
							<a href="/analogue.php" id="OtherData">
								Other Data
							</a>
						</li>
						<li>
							<a href="/dataPages.php" id="Display">
								Display
							</a>
						</li>
						<li>
							<a href="/networkAddress.php" id="Settings">
								Settings/Diagnostics
							</a>
						</li>
					</ul>
					<ul class="hidden-links hidden"></ul>
				</nav>
			</div>
		</header>
		<div class="sub-bar"></div>

		<?php
			if (!isset($holdButtonDisabled)) {
				echo '<a class="button gray medium hold-button" id="hold-button">Hold</a>';
			}
		?>
		
		<div class="main-wrapper" id="atp-main">
		
			<div id="dialog" title="">
				<div id="dialog-text"></div>
				<div class="progress-bar" id="progressBar"></div>
			</div>
