<?php
/* $Id: _layout.phtml 1852 2008-08-22 19:53:46Z parf $
*
* Layout template
*
* Parameters:
* $body Page body
* $TPL Template params:
* $css
* $js
* $title
* $layout Name of template to wrap everything
* $no_layout Do not use any layouts
* $include PHTML files to include after body
*
*
*/
$title = join(' - ',(array)@$TPL->title);
$title = preg_replace('/<.*>/iU','',$title); // strip all HTML from <title>
$is_ie=is_ie();
$is_local=Debug::is_dvp();
$is_admin=Debug::is_admin();
#if ($is_local || /*is_opera() ||*/ $is_admin) $_GET["NO_GA"]=1;
if (Debug::is_cx_admin()) {
$ABTest_block = '';
if ("radaris.com" == $_SERVER["HTTP_HOST"]) {
$ABTest_block = "AB Test: ";
$dbg_gate = Fin_ABCD::assignVisitor2Gate();
$admin_gate = Fin_ABCD::getAdminGate();
$ABTest_block .= " current gate <b>$dbg_gate</b>".cs(" admin gate: %s [ <a href=\"/dvp/a.switch_ab_gate?gate=\" class=\"ahm\">forget</a> ]", $admin_gate)." Active gates: ";
foreach (Fin_ABCD::i()->getActiveGates() as $possible_gate){
if (@$dbg_gate == $possible_gate) {
$ABTest_block .= "<b>Gate $possible_gate</b> ";
} else {
$ABTest_block .= '<a href="/dvp/a.switch_ab_gate?gate='.$possible_gate.'" class="ahm">Gate '.$possible_gate.'</a> ';
}
}
}
}
$no_layout = @$TPL->no_layout;
?>
<!DOCTYPE html>
<html prefix="fb: http://www.facebook.com/2008/fbml" lang="en">
<head>
<? if (! @$_GET["NO_GA"] && ($ga_tag_id = CC("ga.tag_manager_id"))) { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','<?=$ga_tag_id?>');</script>
<!-- End Google Tag Manager -->
<? } ?>
<?
// force header html (TODO: redo this... for ga experiments)
$head = (array)@$TPL->head;
foreach ($head as $h) {
echo $h;
}
?>
<title><?=qh($title)?></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<?
if ($m=$TPL->meta) echo join( "\n", (array) $m )."\n";
if ($m=$TPL->description) {
echo '<meta name="description" content="'.qh( join( ", ", (array) $m ) )."\">\n";
}
$TPL->css = "main.css";
?>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="apple-touch-icon" href="/img/favicons/apple-touch-icon.png">
<link rel="icon" href="/favicon.ico" >
<link rel="manifest" href="/img/favicons/manifest.json">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<?
$css_files = (array)@$TPL->css;
$css_files_a = [];
foreach($css_files as $css) {
$ie = (false !== strpos($css,'_ie.'));
if( $ie && ! $is_ie) continue;
if ($css[0] != "/") {
$css = "/".WebVersion::url("css/$css");
}
// Disable async css loading
echo "<link href=\"$css\" rel=\"stylesheet\">\n";
$css_files_a[] = "\"$css\"";
}
if ($hl=$TPL->head_links) echo join( "\n", (array) $hl )."\n";
?>
</head>
<body>
<? if (! @$_GET["NO_GA"] && ($ga_tag_id = CC("ga.tag_manager_id"))) { ?>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<?=$ga_tag_id?>"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<? } ?>
<? include T("inc/js_boot_loader"); ?>
<?
if($no_layout) {
echo $body;
} else {
include T('_layout_'. NVL(@$TPL->layout[0], "home_1"));
}
foreach((array)@$TPL->include as $file)
include_once T($file);
if($is_local && @$TPL->layout[0]!='minimal' && $is_admin) {
echo "<style>#dvp_div { border:1px solid #800;background-color:#FFFFC0;width:7px;height:7px;position:absolute;right: 3px; top: 4px; z-index:100}</style>";
echo '<div id="dvp_div" onclick="window.location=\'/dvp/devel_menu\'"></div>';
}
//$REQUEST_TIME=NVL(@$_SERVER["REQUEST_TIME_MS"], $_SERVER["REQUEST_TIME"]);
//$time=round((microtime(TRUE)-$REQUEST_TIME)*1000);
$time=round((microtime(TRUE)-$_SERVER["REQUEST_TIME_FLOAT"])*1000);
?>
<?if (id() && $master_info = CD("GRANT")) {?>
<div class="alert alert-error" style="z-index: 999999; position: absolute; float: none; top:0; left: 50%; margin-left: -200px;">Administrator <b><?=$master_info["name"]?></b> acting as user <b><?=Me()->name?></b>. <a href="/srv/stop_user_grant">Stop grant</a></div>
<?}?>
<?
if ($TPL->is_nlp_page){
Statistic::hit('rd_nlp:view_cnt');
Statistic::hit('rd_nlp:build_time', (int)$time);
}
if ($TPL->is_profile_page) {
Statistic::hit('rd_profile:view_cnt');
Statistic::hit('rd_profile:build_time', (int)$time);
}
if ( Debug::is_cx_admin() ) {
$cook="";
if (Me()) {
$cook='/-'.Profile_Login::cookie(id());
}
$url=((@$_SERVER["HTTP_HTTPS"] == "on")?"https:":"http:")."//".C('host').$cook.NVL(@$_SERVER["HTTP_X_URI"], @$_SERVER['REQUEST_URI']);
$col= $is_local ? "#bfc" : "#ffc";
if ('no' !== @$_COOKIE["want-debug"]) {
$debug_lnk = '[<a href="#" onclick="Debug.set_debug(\'no\'); return false;">Disable debug</a>]';
} else {
$debug_lnk = '[<a href="#" onclick="Debug.set_debug(\'yes\'); return false;">Enable debug</a>]';
}
if (!isset($_COOKIE["no_admin"]))
$no_admin_lnk = '[<a href="#" onclick="Debug.set_no_admin(\'yes\'); return false;">Become regular user</a>]';
else
$no_admin_lnk = '[<a href="#" onclick="Debug.set_no_admin(\'no\'); return false;">Become Admin</a>]';
echo "<br><br><br><br><div class='admins'><div align=center id='debug_div' style='background: $col; clear:both;'>";
echo "$no_admin_lnk $debug_lnk ";
echo "<span title='debug link' id='adm_url' style='word-wrap: break-word; -webkit-user-select: all; -moz-user-select: all; -ms-user-select: all; user-select: all;'>$url</span> ${time}ms";
echo cs(" pid: %s", id());
if (Profiler::$enabled)
echo " mem: ".number_format((memory_get_usage())/1000)."K";
echo ' <span title=\'debug server name\'>'.str_replace('.difive.com','',gethostname()).'</span>';
echo cs("<br/>%s", $ABTest_block);
echo '</div>';
echo '</div>';
?>
<script>
function Debug(){}
Debug.set_debug = function(st){
$.post('/dvp/a_set_debug', {"st":st}, function(d,st){window.location.reload()});
}
Debug.set_no_admin = function(st){
$.post('/dvp/a_set_noadmin', {"st":st}, function(d,st){window.location.reload()});
}
Debug.set_backend_version = function(st){
$.post('/dvp/a_set_backend_version', {"st":st}, function(d,st){window.location.reload()});
}
</script>
<?
} // is_cx_Admin
// $TPL->footer - custom footer elements
foreach ((array)@$TPL->footer as $h)
echo "\n".$h."\n";
?>
<? if ("user:pfl_view" == CD("pingback_stat_key")) { include(T('/inc/page_timing')); }?>
</body>
</html>