<?php

function getUpgradeOption()
{
	$upg = "<a target=\"_blank\" id=\"upgrade_button\" href=\"\" class=\"btn btn-primary btn-sm\">Upgrade to Pro</a>";
	return $upg;
}

$userinfo = getUserInfoFromSession();
$lastaccess = "";
if(isset($_SESSION['timeout']))
	$lastaccess = date('Y-m-d H:i:s', $_SESSION['timeout']);

$cfgcode = "OK";
global $stdConfigFile, $proConfigFile;
if(isset($stdConfigFile) && isset($proConfigFile))
{
	if(!file_exists($proConfigFile))
	{
		$ivs = $stdConfigFile;
		$ivs = str_replace(".php", "", $ivs);
		$pos = strpos($ivs, "loadconfig.");
		if($pos !== false)
			$ivs = substr($ivs, $pos+11);
		if(strlen($ivs) == 4)
			$cfgcode = substr($ivs, 0, 1) . "." . substr($ivs, 1, 1) . ", " . substr($ivs, 2, 1) . "." . substr($ivs, 3, 1);
	}
}

?>

<div class="container-fluid" style="padding:1px;">
	<div class="row">
		<div class="col-sm-8">
			<h4>Watch My Domains SED</h4>
		</div>
		<div class="col-sm-4 aboutrtext">
			<p><a href="https://domainpunch.com/sed/changelog.php" target="_blank" class="btn btn-primary btn-sm">Check for updates</a></p>
		</div>
	</div>
		
	<hr class="panelruler">
	<div class="row">
		<div class="col-sm-6">
			<p><b><span id="idlicensetype"></span></b>. <b><span id="idversion"></span></b>, Build: <b><span id="idbuild"></span></b></p>
			<p>Configuration: <b><?php echo $cfgcode; ?></b></p>
			<p>Licensed to: <b><span id="idlicensee"></span></b></p>
			<p id="idevalexpiry">Evaluation Expiry in : <b><span id="idexpiry"></span> days</b></p>
		</div>
		<div class="col-sm-6 aboutrtext">
			<p>Purchase Ref: <b><span id="idorderid"></span></b></p>
			<p>Purchase Date: <b><span id="idorderdate"></span></b></p>
			<p>
			<a target="_blank" id="remlicense_button" class="btn btn-primary btn-sm">Reset License</a>&nbsp;&nbsp;
			<?php echo getUpgradeOption(); ?>
			</p>
			<div class="row">
				<div class="col-sm-7"></div>
				<div class="col-sm-5">
					
				</div>
			</div>
		</div>
	</div>
	<hr class="panelruler">
	<div class="row">
		<div class="col-sm-6">
			<p>User: <b><?php echo $userinfo['name']; ?></b>
			<?php
				if(isAdminUser())
					echo "&nbsp;(<b>Admin</b>)";
			?>
			<p>Display Name: <b><?php echo $userinfo['displayname']; ?></b></p>
			<p>Access Rights: <b><?php echo getAccessRightsString(getUserAccessRights()); ?></b></p>
		</div>
		<div class="col-sm-6 aboutrtext">
			<p>Last Login: <b><?php echo $userinfo['lastsignin']; ?></b></p>
			<p>Last Access: <b><?php echo $lastaccess; ?></b></p>
		</div>
	</div>
	<?php if(!isAdminUser()) { ?>
	<hr class="panelruler">
	<div class="row">
		<div class="col-sm-6">
			<h4 style="margin-bottom:18px;">Domain Category Permissions</h4>
			<?php
			$perms = getPermissionsFromSession();
			if($perms !== false)
			{
				if(count($perms))
					echo "<ul class=\"bullets\">";
				foreach($perms as $p)
					echo "<li>" . $p['name'] . "</li>";
				if(count($perms))
					echo "</ul>";
			}
			?>
		</div>
		<div class="col-sm-6 aboutrtext">
		</div>
	</div>
	<?php } ?>
	<hr class="panelruler">
</div>
