<?php
require(__DIR__ . "/amn/auth.php");
require(_RD . "amn/fnc.site.php");
if(isset($_GET["nws"]) && !empty($_GET["nws"])){
	$_curidnws=intval($_GET["nws"]);
}else{
	header(_SPT . " 404 Not Found");
	if(_IS404)require(_RD . "404.php");
	exit();
}
$_arNWS=array();
$retTXT=GET_NEWS_BY_RANGE($_curidnws, $_curidnws);
if($retTXT == ""){
	header(_SPT . " 404 Not Found");
	require(_RD . "404.php");
	exit();
}
$_arNWS=explode("=!!!=", $retTXT);
$_arCOLS=array();
$IsFound=0;
foreach($_arNWS as $key=>$val){
	unset($_arCOLS);
	$_arCOLS=explode("~!~", $val);
	if(intval($_arCOLS[0]) == $_curidnws){
		$IsFound=1;
		break;
	}
}
if($IsFound == 0){
	header(_SPT . " 404 Not Found");
	require(_RD . "404.php");
	exit();
}

$_arpu=MY_PARSE_URL($_arCOLS[5]);
if(!isset($_arpu["host"]))$_arpu["host"]=_SH;
if($_arCOLS[7] == 0){
	$_ACODE="<a class=\"" . _CLS_LINK . "\" id=\"" . base64_encode($_arCOLS[5]) . "\" href=\"javascript:void(0)\" rel=\"nofollow\">" . $_arpu["host"] . "</a>";
	//$_ACODE="<a class=\"" . _CLS_LINK . "\" id=\"" . base64_encode($_arCOLS[5]) . "\" href=\"javascript:void(0)\" rel=\"nofollow\">Подробнее...</a>";
}else{
	$_ACODE="<a href=\"" . $_arCOLS[5] . "\" rel=\"noopener\" target=\"_blank\">" . $_arpu["host"] . "</a>";
}
if(mb_substr($_arCOLS[4], 0, 1, _STRENC) == "0"){
	$_arCOLS[4]=_IMG . $_arCOLS[4];
}else{
	$_arCOLS[4]=_FH . _IMGOUT . "/" . base64_encode($_arCOLS[4]);
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<title><?php echo trim(strip_tags($_arCOLS[2])); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="<?php echo mb_substr(str_replace(chr(34), "'", trim(strip_tags($_arCOLS[3]))), 0, 149, _STRENC); ?>...">
<meta name="robots" content="all">
<link rel="shortcut icon" href="<?php echo _FH; ?>favicon.ico" type="image/x-icon">
<meta property="og:title" content="<?php echo trim(strip_tags($_arCOLS[2])); ?>">
<meta property="og:description" content="<?php echo mb_substr(str_replace(chr(34), "'", trim(strip_tags($_arCOLS[3]))), 0, 149, _STRENC); ?>...">
<meta property="og:image" content="<?php echo _SPTP . ":" . $_arCOLS[4]; ?>">
<meta property="og:type" content="website">
<meta property="og:locale" content="ru_RU">
<meta property="og:url" content="<?php echo _SPTP . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>">
<style>
<?php require(_RD . "css.php"); ?>
</style>
<?php require(_RD . "inc.head.php"); ?>
</head>
<body>
<header class="<?php echo $_css_AR["cls"][6]; ?>">
	<div class="<?php echo $_css_AR["cls"][11]; ?>"><h1><?php echo $_arCOLS[2]; ?></h1></div>
</header>
<main>
<div class="<?php echo $_css_AR["cls"][6]; ?>">
	<div class="<?php echo $_css_AR["cls"][12]; ?>">
		<figure><img src="<?php echo $_arCOLS[4]; ?>" alt="<?php echo str_replace(chr(34), "'", trim(strip_tags($_arCOLS[2])));?>"></figure>
		<?php echo "<em>" . date("H:i, d ", $_arCOLS[6]) . MNT_RUS(date("m", $_arCOLS[6])) . ".</em><br>"; ?>
		<?php
		if(strip_tags($_arCOLS[3]) == $_arCOLS[3]){ 
			echo "<p>" . str_replace("\n", "<br>", NWS_SPLIT_P($_arCOLS[3])) . "</p>";
		}else{
			echo str_replace("\n", "<br>", $_arCOLS[3]);
		}
		?>
		<p><strong>Рубрика: </strong> <a href="<?php echo _FH . _P_RBR . _P_SPL . $_arCOLS[1]; ?>.html"><?php echo $_arRUB[$_arCOLS[1]]; ?></a>. <?php echo "<strong>Читать весь текст на </strong> " . $_ACODE; ?>.</p>
		<?php if($_arCOLS[8])echo "<p>" . $_arCOLS[8] . "</p>"; ?>
	</div>
	<span class="<?php echo $_css_AR["cls"][4]; ?>">&nbsp;</span>
	<div id="<?php echo _DIV_ID_1; ?>"><?php require(_RD . "inc.rekl.php"); ?></div>
	<div class="<?php echo $_css_AR["cls"][13]; ?>">
		<?php NWS_GET_MORE($_curidnws, _NWS_IN_PAGE); ?>
	</div>
	<span class="<?php echo $_css_AR["cls"][4]; ?>">&nbsp;</span>
</div>
</main>
<?php 
require(_RD . "aside.inc");
require(_RD . "ftr.inc");
require(_RD . "js1.inc");
require(_RD . "inc.bottom.php");
?>
</body>
</html>