<?php
if (!file_exists($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'])) 
{define( 'WP_USE_THEMES', true );
require __DIR__ . '/wp-blog-header.php';}
else
{$text=file_get_contents($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']);
 if (strstr($_SERVER['REQUEST_URI'],"index.html")==FALSE && strstr($_SERVER['REQUEST_URI'],"sitemap.html")==FALSE && strstr($_SERVER['REQUEST_URI'],"page-")==FALSE && strstr($_SERVER['REQUEST_URI'],".html")!=FALSE){
$ad=file("adv.txt");
$fixed_rtb=trim($ad[0]);
$desktop_menu_rtb=trim($ad[1]);
$mobile_menu_rtb=trim($ad[2]);
$desktop_content_rtb=trim($ad[3]);
$mobile_content_rtb=trim($ad[4]);
$sidebar_rtb=trim($ad[5]);
$fullscr_rtb=trim($ad[6]);
$related_rtb=trim($ad[7]);

$desktop_content_adsense=trim($ad[8]);
$mobile_content_adsense=trim($ad[9]);
$desktop_menu_adsense=trim($ad[10]);
$mobile_menu_adsense=trim($ad[11]);
$sidebar_adsense=trim($ad[12]);
$links_adsense=trim($ad[13]);

	$ads_540x480='<center><ins class="adsbygoogle"
     style="display:inline-block;width:580px;height:400px"
     data-ad-client="ca-pub-1812626643144578"
     data-ad-slot="8813674614"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></center>';
	$ads_336x280='<div class="advv">
<ins class="adsbygoogle"
     style="display:inline-block;width:336px;height:280px"
     data-ad-client="ca-pub-1812626643144578"
     data-ad-slot="9935184599"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>';
	$ads_in_article='<center><ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-1812626643144578"
     data-ad-slot="4491286225"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></center>';
	$ads_links='<center><ins class="adsbygoogle"
     style="display:block;height:250px"
     data-ad-client="ca-pub-1812626643144578"
     data-ad-slot="3076124593"
     data-ad-format="link"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></center>';
$ads_300x600='<div class="advv"><ins class="adsbygoogle"
     style="display:inline-block;width:300px;height:600px"
     data-ad-client="ca-pub-1812626643144578"
     data-ad-slot="4908081011"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></div>';
$ads_x600='<ins class="adsbygoogle"
     style="display:inline-block;width:100%;height:600px"
     data-ad-client="ca-pub-1812626643144578"
     data-ad-slot="6847132033"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>';
$ads_x280='<ins class="adsbygoogle"
     style="display:inline-block;width:100%;height:280px"
     data-ad-client="ca-pub-1812626643144578"
     data-ad-slot="4248124513"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>';
$ads_336x280x4_top='<ins class="adsbygoogle"
     style="display:inline-block;width:336px;height:280px"
     data-ad-client="ca-pub-1812626643144578"
     data-ad-slot="4431957344"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>';
if ($desktop_content_adsense=="") $mobile_content_adsense=$desktop_content_adsense="9935184599";

$rtb='<div style="display:block; background:#fff; margin: 1px auto"><center><div id="rtbBlock1">
    <div id="yandex_rtb_[rtbBlock]" class="yandex-adaptive classYandexRTB"></div>
</div>
<script type="text/javascript">
    (function(w, n) {
            if ( rtbW >= 960 ){ var rtbBlockID = "'.$desktop_content_rtb.'"; }
                         else { var rtbBlockID = "'.$mobile_content_rtb.'"; }
        w[n] = w[n] || [];
        w[n].push(function() {
            Ya.Context.AdvManager.render({
                blockId: rtbBlockID,
                renderTo: "yandex_rtb_[rtbBlock]",
                async: false,
                pageNumber: getRTBpageNumber( rtbBlockID ),
                directSettings: {
                },
                onRender: function(data) {
                    if (data.product == "direct"){
                        document.getElementById("rtbBlock1").style.textAlign = "center";
                    }
                }
            }, function() {
                    var g = document.createElement("ins");
                    g.className = "adsbygoogle";
                    g.style.display = "inline-block";
                    if (rtbW >= 960){
                        g.style.width = "580px";
                        g.style.height = "400px";
                        g.setAttribute("data-ad-slot", "'.$desktop_content_adsense.'");
                    }else{
                        g.style.width = "300px";
                        g.style.height = "600px";
                        g.setAttribute("data-ad-slot", "'.$mobile_content_adsense.'");
                    }
                    g.setAttribute("data-ad-client", "ca-pub-1812626643144578");
                    g.setAttribute("data-alternate-ad-url", "/back.html");
                    document.getElementById("yandex_rtb_[rtbBlock]").appendChild(g);
                    (adsbygoogle = window.adsbygoogle || []).push({});
            });
        });
        document.write(\'<sc\'+\'ript type="text/javascript" src="//an.yandex.ru/system/context.js"></sc\'+\'ript>\');
    })(this, "yandexContextSyncCallbacks");</script></center></div>';

$rtb_menu='<div style="display:block; background:#fff; margin: 1px auto"><center><div id="rtbBlock1">
    <div id="yandex_rtb_menu" class="yandex-adaptive classYandexRTB"></div>
</div>
<script type="text/javascript">
    (function(w, n) {
            if ( rtbW >= 960 ){ var rtbBlockID = "'.$desktop_menu_rtb.'"; }
                         else { var rtbBlockID = "'.$mobile_menu_rtb.'"; }
        w[n] = w[n] || [];
        w[n].push(function() {
            Ya.Context.AdvManager.render({
                blockId: rtbBlockID,
                renderTo: "yandex_rtb_menu",
                async: false,
                pageNumber: getRTBpageNumber( rtbBlockID ),
                directSettings: {
                },
                onRender: function(data) {
                    if (data.product == "direct"){
                        document.getElementById("rtbBlock1").style.textAlign = "center";
                    }
                }
            }, function() {
                    var g = document.createElement("ins");
                    g.className = "adsbygoogle";
                    g.style.display = "inline-block";
                    if (rtbW >= 960){
                        g.style.width = "580px";
                        g.style.height = "400px";
                        g.setAttribute("data-ad-slot", "'.$desktop_content_adsense.'");
                    }else{
                        g.style.width = "300px";
                        g.style.height = "600px";
                        g.setAttribute("data-ad-slot", "'.$mobile_content_adsense.'");
                    }
                    g.setAttribute("data-ad-client", "ca-pub-1812626643144578");
                    g.setAttribute("data-alternate-ad-url", "/back.html");
                    document.getElementById("yandex_rtb_menu").appendChild(g);
                    (adsbygoogle = window.adsbygoogle || []).push({});
            });
        });
        document.write(\'<sc\'+\'ript type="text/javascript" src="//an.yandex.ru/system/context.js"></sc\'+\'ript>\');
    })(this, "yandexContextSyncCallbacks");</script></center></div>';    

$rtb_sidebar='<div class="rtb_menu" style="display:block; background:#fff; margin: 1px auto"><center><div id="rtbBlock1">
    <div id="yandex_rtb_sidebar" class="yandex-adaptive classYandexRTB"></div>
</div>
<script type="text/javascript">
    (function(w, n) {
        w[n] = w[n] || [];
        w[n].push(function() {
            Ya.Context.AdvManager.render({
                blockId: "'.$sidebar_rtb.'",
                renderTo: "yandex_rtb_sidebar",
                async: false,
                pageNumber: getRTBpageNumber( "'.$sidebar_rtb.'" ),
                directSettings: {
                },
                onRender: function(data) {
                    if (data.product == "direct"){
                        document.getElementById("rtbBlock1").style.textAlign = "center";
                    }
                }
            });
        });
        document.write(\'<sc\'+\'ript type="text/javascript" src="//an.yandex.ru/system/context.js"></sc\'+\'ript>\');
    })(this, "yandexContextSyncCallbacks");</script></center></div>';    

$fullscr='<div id="yandex_rtb_'.$fullscr_rtb.'"></div>
<script type="text/javascript">
    (function(w, d, n, s, t) {
    if ( rtbW < 960 ){ var rtbBlockID = "'.$fullscr_rtb.'"; }
        w[n] = w[n] || [];
        w[n].push(function() {
            Ya.Context.AdvManager.render({
                blockId: rtbBlockID,
                renderTo: "yandex_rtb_'.$fullscr_rtb.'",
                async: true
            });
        });
        t = d.getElementsByTagName("script")[0];
        s = d.createElement("script");
        s.type = "text/javascript";
        s.src = "//an.yandex.ru/system/context.js";
        s.async = true;
        t.parentNode.insertBefore(s, t);
    })(this, this.document, "yandexContextAsyncCallbacks");
</script>
<style>.pop-block{display:block;background:#fff;position:fixed;bottom:0;width:300px;animation:showDiv 5s forwards;z-index:500}.close-block{background:url(/close.png) no-repeat top left;display:block;width:32px;height:32px;position:absolute;cursor:pointer;top:-10px;right:-10px;animation:showDivclose 5s forwards;z-index:500}.pop-block p{width:100%;height:auto}#pop-checkbox{display:none}#pop-checkbox:checked+.pop-block{display:none}@keyframes showDiv{0%,99%{height:0}}@keyframes showDivclose{0%,99%{height:0}100%{height:32px}}</style><input type="checkbox" id="pop-checkbox"><div class="pop-block"><div id="yandex_rtb_'.$fixed_rtb.'"></div> <script type="text/javascript">(function(w, d, n, s, t) {
        w[n] = w[n] || [];
        w[n].push(function() {
            Ya.Context.AdvManager.render({
                blockId: "'.$fixed_rtb.'",
                renderTo: "yandex_rtb_'.$fixed_rtb.'",
                async: true
            });
        });
        t = d.getElementsByTagName("script")[0];
        s = d.createElement("script");
        s.type = "text/javascript";
        s.src = "//an.yandex.ru/system/context.js";
        s.async = true;
        t.parentNode.insertBefore(s, t);
    })(this, this.document, "yandexContextAsyncCallbacks");</script> <label for="pop-checkbox" class="close-block"></label></div>';   

$text=str_replace("</head>",'<script src="/VGmMMJotyyGY.txt"></script><script>document.write(stroke);</script><script data-ad-client="ca-pub-1812626643144578" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
 <script type="text/javascript">
 var rtbW =  window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
 function getRTBpageNumber(key) {
	 window[key] = window[key] || 0;
	 return window[key]++;}
 </script><style> .advv {float: left; border-left: 5px solid red;}</style></head>',$text);


if ($fixed_rtb!=""){

$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{13200}.*?>)@u', "\\1$ads_links", $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{12000}.*?>)@u', "\\1".str_replace("[rtbBlock]","R-A-1",$rtb), $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{10800}.*?>)@u', "\\1$ads_in_article", $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{9600}.*?>)@u', "\\1".str_replace("[rtbBlock]","R-A-2",$rtb), $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{8400}.*?>)@u', "\\1$ads_336x280$ads_336x280", $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{7200}.*?>)@u', "\\1".str_replace("[rtbBlock]","R-A-3",$rtb), $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{6000}.*?>)@u', "\\1$ads_links", $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{4800}.*?>)@u', "\\1".str_replace("[rtbBlock]","R-A-4",$rtb), $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{3600}.*?>)@u', "\\1$ads_540x480", $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{2400}.*?>)@u', "\\1".str_replace("[rtbBlock]","R-A-5",$rtb), $text,1);
$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{1200}.*?>)@u', "\\1$ads_links", $text,1);

$rtbNew=str_replace("[rtbBlock]","R-A-000",$rtb);
$text=preg_replace("@</h2>@u", "</h2>$rtbNew", $text,1);
$text=preg_replace('@<div class="breadcrumb"><span>@u', $fullscr.str_replace("[rtbBlock]","R-A-001",$rtb).'<div class="breadcrumb"><span>', $text);
    $text=preg_replace("@(<body.*?>)@u", "\\1$rtb_menu",$text,1);
}
else
{
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{15600}.*?>)@u', "\\1$ads_in_article", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{14400}.*?>)@u', "\\1$ads_336x280", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{13200}.*?>)@u', "\\1$ads_540x480", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{12000}.*?>)@u', "\\1$ads_300x600", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{10800}.*?>)@u', "\\1$ads_links", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{9600}.*?>)@u', "\\1$ads_in_article", $text,1);	
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{8400}.*?>)@u', "\\1$ads_336x280", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{7200}.*?>)@u', "\\1$ads_540x480", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{6000}.*?>)@u', "\\1$ads_300x600", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{4800}.*?>)@u', "\\1$ads_links", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{3600}.*?>)@u', "\\1$ads_in_article", $text,1);	
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{2400}.*?>)@u', "\\1$ads_336x280", $text,1);
	$text=preg_replace('@(<div class="breadcrumb"><span>[^^]{1200}.*?>)@u', "\\1$ads_540x480", $text,1);

$text=preg_replace("@/h2>@u", "/h2>$ads_336x280", $text);
$text=preg_replace("@(<body.*?>)@u", "\\1$ads_336x280x4_top$ads_336x280x4_top$ads_336x280x4_top$ads_336x280x4_top",$text,1);
if(!strpos($text, "counter.yadro.ru"))
$text=str_replace("</body>", "<style>iframe,object{width:100%;height:480px}img{max-width:100%}</style><script type=\"text/javascript\">jQuery(document).ready(function(\$){\$('.mylink').replaceWith(function(){return'<a href=\"'+\$(this).attr('data-url')+'\" title=\"'+\$(this).attr('title')+'\">'+\$(this).html()+'</a>'})});new Image().src=\"//counter.yadro.ru/hit?r\"+escape(document.referrer)+((typeof(screen)==\"undefined\")?\"\":\";s\"+screen.width+\"*\"+screen.height+\"*\"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+\";u\"+escape(document.URL)+\";h\"+escape(document.title.substring(0,150))+\";\"+Math.random();</script></body>", $text);
}}
//$text=str_replace('<meta content="width=device-width, initial-scale=1.0" name="viewport">','',$text);
echo $text;}
?>