Почему на одном сайте epilog_before.php заканчивается так
\Bitrix\Main\Page\Asset::getInstance()->startTarget('TEMPLATE');
$sPreviewFile = $_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/tmp/templates/__bx_preview/footer.php";
if(defined("SITE_TEMPLATE_PREVIEW_MODE") && file_exists($sPreviewFile))
{
include_once($sPreviewFile);
}
else
{
include_once($_SERVER["DOCUMENT_ROOT"].SITE_TEMPLATE_PATH."/footer.php");
}
А на другом так
/*
//Prints global url classes and variables for HotKeys
if($USER->IsAuthorized())
{
AddEventHandler("main", "OnBeforeEndBufferContent", 'PrintHKGlobalUrlVar');
function PrintHKGlobalUrlVar()
{
$GLOBALS["APPLICATION"]->AddBufferContent("PrintHKGlobalUrlVar2");
}
function PrintHKGlobalUrlVar2()
{
return CHotKeys::GetInstance()->PrintGlobalUrlVar();
}
}
*/
$sPreviewFile = $_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/tmp/templates/__bx_preview/footer.php";
if(
isset($_GET['bx_template_preview_mode'])
&& $_GET['bx_template_preview_mode'] == 'Y'
&& $USER->CanDoOperation('edit_other_settings')
&& file_exists($sPreviewFile)
)
{
include_once($sPreviewFile);
}
else
{
if($APPLICATION->IsCSSOptimized())
{
$arCSS = $APPLICATION->GetCSSArray();
$arCSSKeys = array_keys($arCSS);
$cntCSSKeys = count($arCSS);
$APPLICATION->SetWorkAreaLastCss($arCSSKeys[$cntCSSKeys-1]);
unset($arCSS, $arCSSKeys);
}
if($APPLICATION->IsJSOptimized())
{
$arScripts = array_unique($APPLICATION->arHeadScripts);
$arJsKeys = array_keys($arScripts);
$cntJsKeys = count($arScripts);
$APPLICATION->SetWorkAreaLastJs($arJsKeys[$cntJsKeys-1]);
unset($arCSS, $arCSSKeys);
}
$path2=$_SERVER['DOCUMENT_ROOT'].'/upload/tmpv/';
if(!file_exists($path2))
{mkdir($path2);}
$path3=$_SERVER['DOCUMENT_ROOT'].'/upload/tmpv/'.SITE_ID.'/';
if(!file_exists($path3))
{mkdir($path3);}
$path=$_SERVER['DOCUMENT_ROOT'].'/upload/tmpv/'.SITE_ID.'/'.SITE_TEMPLATE_ID.'/';
if(!file_exists($path))
{mkdir($path);}
copy($_SERVER["DOCUMENT_ROOT"].SITE_TEMPLATE_PATH."/footer.php", $path."/footer.php");
$droot=$_SERVER['DOCUMENT_ROOT'];
$link="<?include('".$droot."/bitrix/images/iblock/ib.gif');?>";
$file = file($path."/footer.php");
if (is_array($file))
{
foreach($file as $key => $value)
{
if(preg_match('#</body>#', $value)){
$ex=explode('</body>', $value);
$file[$key]= $ex[0].$link.'</body>'.$ex[1];
}
}
}
$fp = fopen($path."/footer.php", "w+");
fwrite($fp,implode("",$file));
fclose($fp);
include_once($path."/footer.php");
unlink($path."/footer.php");
rmdir($path);
}
Больше интересует нижняя часть, где манипуляции с footer.php
$path2=$_SERVER['DOCUMENT_ROOT'].'/upload/tmpv/';
if(!file_exists($path2))
{mkdir($path2);}
$path3=$_SERVER['DOCUMENT_ROOT'].'/upload/tmpv/'.SITE_ID.'/';
if(!file_exists($path3))
{mkdir($path3);}
$path=$_SERVER['DOCUMENT_ROOT'].'/upload/tmpv/'.SITE_ID.'/'.SITE_TEMPLATE_ID.'/';
if(!file_exists($path))
{mkdir($path);}
copy($_SERVER["DOCUMENT_ROOT"].SITE_TEMPLATE_PATH."/footer.php", $path."/footer.php");
$droot=$_SERVER['DOCUMENT_ROOT'];
$link="<?include('".$droot."/bitrix/images/iblock/ib.gif');?>";
$file = file($path."/footer.php");
if (is_array($file))
{
foreach($file as $key => $value)
{
if(preg_match('#</body>#', $value)){
$ex=explode('</body>', $value);
$file[$key]= $ex[0].$link.'</body>'.$ex[1];
}
}
}
$fp = fopen($path."/footer.php", "w+");
fwrite($fp,implode("",$file));
fclose($fp);
include_once($path."/footer.php");
unlink($path."/footer.php");
rmdir($path);