<?php


/**
 * file: setup.min.php
 *
 * Copyright Miller Electric Mfg. Co. as an unpublished work.
 * All rights reserved.
 *
 * The information contained herein is confidential property of
 * Miller Electric Mfg. Co.  The use of, copying, transfer or
 * disclosure of such information is prohibited except by express
 * written agreement with Miller Electric.
 */


session_start();


require_once('../lib/user_authentication.php');
require_once('../lib/utility.php');


if(!UserAuthentication::isUserLoggedIn()) {
	navigateToLoginPage();
}


error_reporting(E_ERROR);

function ReadFirmwareInfo($filespec)
{
	// Read network settings
	$errorLvl = get_cfg_var('display_errors');
	error_reporting(E_ERROR);
	$File = fopen($filespec, "r");
	error_reporting($errorLvl);

	if($File == NULL)
	{
		return NULL;
	}
	else
	{
		$FirmwareInfo_json = fread($File, filesize($filespec));
		fclose($File);
		$FirmwareInfo = json_decode($FirmwareInfo_json, true);
		$count = 0;
		//echo "<br>File read FirmwareInfo:<br>";
		//print_r($Settings);
	}

	return $FirmwareInfo;
}


$VersionFilespec = "/Insight/firmware.info";
$VersionInfo = ReadFirmwareInfo($VersionFilespec);


?>
<!DOCTYPE html>
<html lang="en">
  <?php require('head.php'); ?>
  <body>
      <div class="container">
        <div class="panel panel-primary">
          <div class="panel-body">
            <?php require('navbar_header.php'); ?>
				<div class="row page-header">
								<div class="col-lg-12 col-md-offset-1 panel-primary">
								Version Information:
								</div>
								<div class="col-lg-12 col-md-offset-2 panel-primary">
							<?php if(!empty($VersionInfo))
							{ ?>
								<?php
								echo "Firmware: $VersionInfo[Firmware]<br>"; 
								echo "Carrier App: $VersionInfo[CarrierApp]<br>"; 
								echo "Carrier Boot: $VersionInfo[CarrierBoot]<br>"; 
								echo "Kernel Version: $VersionInfo[KernelVersion]<br>"; 
								echo "U-Boot Version: $VersionInfo[UbootVersion]<br>"; 
								echo "SDK Version: $VersionInfo[SDKVersion]<br>"; 
							} 
							else
							{
								echo "Version information is unavailble.<br>";
							}
							?>			
				   </div>
				</div>
            <div class="row">
               <div class="col-lg-4 col-lg-offset-1 panel-primary">
                   <div class="panel-heading">
                       <h3 id="ethernet_header"><span class="glyphicon glyphicon-transfer"></span> Ethernet Settings</h3>
                   </div>
                   <div class="panel-body">
                        <ul class="pager">
                            <li class="edit">
                                <a id="ethernet_edit" href="/setup/ethernet.min.php">Edit 
                                    <span class="glyphicon glyphicon-new-window"></span>
                                    <span class="sr-only">(current)</span>
                                 </a>
                                 <span class="tooltip" id="ethernet-setup" title="Click the Edit button to configure the Continuum's Ethternet settings."></span>
                             </li>
                        </ul>
                   </div>
               </div>
                <div class="col-lg-4 col-lg-offset-1 panel-primary">
                   <div class="panel-heading">
                       <h3 id="wifi_header"><span class="glyphicon glyphicon-signal"></span> WiFi Settings</h3>
                   </div>
                   <div class="panel-body">
                        <ul class="pager">
                            <li class="edit">
                                <a id="wifi_edit" href="/setup/wifi.min.php">Edit 
                                    <span class="glyphicon glyphicon-new-window"></span>
                                    <span class="sr-only">(current)</span>
                                 </a>
                                 <span class="tooltip" id="wifi-settings" title="Click the Edit button to configure the Continuum's WiFi settings."></span>
                             </li>
                        </ul>
                   </div>
               </div>
			   <div class="col-lg-4 col-lg-offset-1 panel-primary">
                   <div class="panel-heading">
                       <h3 id="insight_json_header"><span class="glyphicon glyphicon-cog"></span> Configuration Settings</h3>
                   </div>
                   <div class="panel-body">
                        <ul class="pager">
                            <li class="edit">
                                <a id="insight_json_edit" href="/setup/insight_json_settings.php">Edit 
                                    <span class="glyphicon glyphicon-new-window"></span>
                                    <span class="sr-only">(current)</span>
                                 </a>
                                 <span class="tooltip" id="insight-json-settings" title="Click the Edit button to configure the Insight Json settings."></span>
                             </li>
                        </ul>
                   </div>
               </div>
            </div>  
            </div>
            <?php require('footer.php'); ?>
      </div>
    </div>
    <?php require('js_footer.php'); ?>
  </body>
</html>
