<?php
error_reporting(0);
ini_set('display_errors','off');
$filename="admin/settings/home_settings.txt";

if($handle = @fopen($filename, 'r'))
{
	$contents = fread($handle, filesize($filename));
	fclose($handle);
	$home_arr=explode("#_1_#",$contents);
}
$filename="admin/settings/design_settings.txt";

if($handle = @fopen($filename, 'r'))
{
	$contents = fread($handle, filesize($filename));
	fclose($handle);
	$design_arr=explode("#_1_#",$contents);
}
$filename="admin/settings/sidebar_settings.txt";

if($handle = @fopen($filename, 'r'))
{
	$contents = fread($handle, filesize($filename));
	fclose($handle);
	$sidebar_arr=explode("#_1_#",$contents);
}
 $file = basename($_GET['id'], ".html");
 $filename="admin/settings/seo/content_pages/$file.txt";				
if($handle = @fopen($filename, 'r'))
{
	$contents = fread($handle, filesize($filename));
	fclose($handle);
	$seo_arr=explode("#_1_#",$contents);
}

if(empty($seo_arr)){
$filename="admin/settings/seo_settings.txt";

if($handle = @fopen($filename, 'r'))
{
	$contents = fread($handle, filesize($filename));
	fclose($handle);
	$seo_arr=explode("#_1_#",$contents);
}

}
if($_REQUEST[id]!='' && isset($_REQUEST[id])) 
  {
		    $filename="content_pages/$_REQUEST[id]";
		if(!$handle = fopen($filename, 'r')) 
		  {
			 echo "Cannot open file ($filename)";
			 exit;
		  }
		$contents = @fread($handle, filesize($filename));
		@fclose($handle);
		$argument_arr_title=explode("#_1_#",$contents);			  
		$arr_title=explode(":::",$argument_arr_title[1]);
  }
if(empty($seo_arr[0]) || $seo_arr[0]=='Your Title Here')
$seo_arr[0]=$arr_title[1];

$filename="admin/settings/seo_settings.txt";

if($handle = @fopen($filename, 'r'))
{
	$contents = fread($handle, filesize($filename));
	fclose($handle);
	$track_arr=explode("#_1_#",$contents);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="revisit-after" content="30 days">
<meta name="description" content="<?php echo $seo_arr[1]; ?>">
<meta name="keywords" content="<?php echo $seo_arr[2]; ?>">
<meta name="robots" content="INDEX, FOLLOW">
<meta name="distribution" content="Global">
<meta name="rating" content="General">
<meta name="copyright" content="Store Buildr">
<title><?php echo $seo_arr[0]; ?></title>
<style type="text/css">
<!--
html, body {
	margin: 0;
	padding: 0;
	font-family: Arial, sans-serif;
	font-size: 14px;
	background-color: <?php echo "#",$design_arr[3]; ?>;
}
#page-button {
	cursor: pointer;
	text-align:center;
	text-decoration:none;
	font-family:Arial, Helvetica, sans-serif;
	font-size:<?php echo $design_arr[10],"px"; ?>;
	color:<?php echo "#",$design_arr[9]; ?>;
	background-color: <?php echo "#",$design_arr[7]; ?>;
	font-weight: bold;
	border: 0px solid;
	padding: 5px;
	display:inline-block;
	margin: 5px;
	-webkit-border-radius: <?php echo $design_arr[12],"px"; ?>;
	-moz-border-radius: <?php echo $design_arr[12],"px"; ?>;
	border-radius: <?php echo $design_arr[12],"px"; ?>;
}
#page-button:hover {
	background-color:<?php echo "#",$design_arr[8]; ?>;
	}
img {
    max-width: 100% !important;
	height: auto !important;
}
-->
</style>
<script src="js/jquery-1.12.4.min.js"></script>
</head>

<body>
<center>
<!--Main -->
<div style="border:solid; border-width:<?php echo $design_arr[5],"px"; ?>; border-color:<?php echo "#",$design_arr[4]; ?>; background-color:#FFFFFF; padding:<?php echo $design_arr[11],"px"; ?>; margin:auto; max-width:<?php echo $design_arr[2],"px"; ?>;">
<?php
if($design_arr[1]==1)
{
?>
<?php
if(!empty($design_arr[0])){
	$filename=$design_arr[0];
echo  '<img src=\'./admin/images/custom_images/'.$filename.'\' />';
	  }
?>
<?php
}
?>
<!--Navigation -->
    <div style="padding:<?php echo $design_arr[14],"px"; ?>; background-color:<?php echo "#",$design_arr[13]; ?>;" align="center">
<?php
if($design_arr[6]==1)
{
?> 
<a id="page-button" href="./">Home</a>
<?php
$count=0;
if ($handle = opendir('content_pages/')) {
	$file_handle = fopen("admin/settings/order_content.txt", "rb");
	while (!feof($file_handle) ) {
		$line_of_text = fgets($file_handle);
		$files = explode(';', $line_of_text);
	}
	fclose($file_handle);
	foreach($files as $file)
	{
		$filename="./content_pages/$file";
		if(!$handle1 = fopen($filename, 'r'))
		{
			echo "Cannot open file ($filename)";
			exit;
		}
		$contents = fread($handle1, filesize($filename));
		fclose($handle1);
		$argument_arr=explode("#_1_#",$contents);
?>
<a id="page-button" href="page.php?id=<?php echo $file; ?>">
		<?php $arr=explode(":::",$argument_arr[1]);
	  echo $arr[1]; ?></a>
<?php
}
?>
<?php
$count=$count+1;
$count=0;
	}
?>
<?php
}
?>
</div>
<!--Navigation -->
<div style="height:10px"></div>
<?php
        if($_REQUEST[id]!='' && isset($_REQUEST[id])) 
		  {
			    $filename="content_pages/$_REQUEST[id]";
				if(!$handle = fopen($filename, 'r')) 
				  {
					 echo "Cannot open file ($filename)";
					 exit;
				  }
				$contents = @fread($handle, filesize($filename));
				@fclose($handle);
				$argument_arr=explode("#_1_#",$contents);
                $dir_arr=explode(":::",$argument_arr[0]);
		  }
?>
<!--Right Sidebar -->
<?php
if($sidebar_arr[0]=='rightside')
{
?>
<div id="content" style="margin:<?php echo $design_arr[15],"px"; ?>; text-align: left;">
   <div id="sidebar" style="display:none; float:right; vertical-align:top; box-sizing: border-box; margin-left:10px; width:<?php echo $sidebar_arr[1],"%"; ?>; border:solid; border-width:<?php echo $sidebar_arr[4],"px"; ?>; border-color:<?php echo "#",$sidebar_arr[3]; ?>; background-color:<?php echo "#",$sidebar_arr[2]; ?>; padding-left:10px; padding-right:10px;"><?php echo $sidebar_arr[10]; ?></div>
   <div style="overflow:hidden; width:auto; vertical-align:top; border:solid; border-width:<?php echo $home_arr[3],"px"; ?>; border-color:<?php echo "#",$home_arr[2]; ?>; background-color:<?php echo "#",$home_arr[1]; ?>; padding-left:10px; padding-right:10px; text-align: left;"><?php $arr=explode(":::",$argument_arr[4]); echo $arr[1]; ?><?php $arr=explode(":::",$argument_arr[2]); echo $arr[1]; ?><?php $arr=explode(":::",$argument_arr[5]); echo $arr[1]; ?></div>
</div>
<?php
}
?>
<!--Right Sidebar -->
<!--Left Sidebar -->
<?php
if($sidebar_arr[0]=='leftside')
{
?>
<div id="content" style="margin:<?php echo $design_arr[15],"px"; ?>; text-align: left;">
   <div id="sidebar" style="display:none; float:left; vertical-align:top; box-sizing: border-box; margin-right:10px; width:<?php echo $sidebar_arr[5],"%"; ?>; border:solid; border-width:<?php echo $sidebar_arr[8],"px"; ?>; border-color:<?php echo "#",$sidebar_arr[7]; ?>; background-color:<?php echo "#",$sidebar_arr[6]; ?>; padding-left:10px; padding-right:10px;"><?php echo $sidebar_arr[9]; ?></div>
   <div style="overflow:hidden; width:auto; vertical-align:top; border:solid; border-width:<?php echo $home_arr[3],"px"; ?>; border-color:<?php echo "#",$home_arr[2]; ?>; background-color:<?php echo "#",$home_arr[1]; ?>; padding-left:10px; padding-right:10px; text-align: left;"><?php $arr=explode(":::",$argument_arr[4]); echo $arr[1]; ?><?php $arr=explode(":::",$argument_arr[2]); echo $arr[1]; ?><?php $arr=explode(":::",$argument_arr[5]); echo $arr[1]; ?></div>
</div>
<?php
}
?>
<!--Left Sidebar -->
<!--No Sidebar -->
<?php
if($sidebar_arr[0]=='none')
{
?>
<div style="margin:<?php echo $design_arr[15],"px"; ?>; vertical-align:top; border:solid; border-width:<?php echo $home_arr[3],"px"; ?>; border-color:<?php echo "#",$home_arr[2]; ?>; background-color:<?php echo "#",$home_arr[1]; ?>; padding-left:10px; padding-right:10px; text-align: left;"><?php $arr=explode(":::",$argument_arr[4]); echo $arr[1]; ?><?php $arr=explode(":::",$argument_arr[2]); echo $arr[1]; ?><?php $arr=explode(":::",$argument_arr[5]); echo $arr[1]; ?></div>
<?php
}
?>
<!--No Sidebar -->
<div style="clear:both; height:10px"></div>
<!--Footer -->
    <div style="padding:10px; background-color:<?php echo "#",$home_arr[5]; ?>;"><?php echo $home_arr[4]; ?></div>
<!--Footer -->
<script>
var content = $('#content');
var sidebar = $('#sidebar');
var getContentHeight = content.outerHeight();
var getSidebarHeight = sidebar.outerHeight();
if ( getContentHeight > getSidebarHeight ) {
	sidebar.css('min-height', getContentHeight);
}
if ( getSidebarHeight > getContentHeight ) {
	content.css('min-height', getSidebarHeight);
}
//load after main content
 $(document).ready(function() {
     $("#sidebar").show();
 });
//load after main content
</script>
</div>
<!--Main -->
</center>
<!--Tracking -->
<?php echo $seo_arr[3]; ?>
<!--Tracking -->
</body>
</html>