$filename = urldecode($_SERVER["DOCUMENT_ROOT"] . $DIR . "/files/" . $file); $bRealyImage = False; $arFilePathInfo = pathinfo($filename); if (in_array($arFilePathInfo["extension"], $arImageExts)) { $bRealyImage = True; } if (file_exists($filename)) { include_once dirname(__FILE__) . "/init_vars.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php"; if (CModule::IncludeModule("sale")) { $bCanAccess = False; if ($USER->IsAuthorized()) { $FILE_PERM = $APPLICATION->GetFileAccessPermission($DIR . "/files/" . $file, $USER->GetUserGroupArray()); $FILE_PERM = strlen($FILE_PERM) > 0 ? $FILE_PERM : "D"; if ($FILE_PERM >= "R") { if (CSaleAuxiliary::CheckAccess($USER->GetID(), $mp3AuxiliaryPrefix . $file, $mp3AccessTimeLength, $mp3AccessTimeType)) { $bCanAccess = True; } } } if (!$bCanAccess) { LocalRedirect($mp3Url2Folder . "auth.php?fname=" . urlencode($file) . "&DIR=" . urlencode($DIR)); } else { $filesize = filesize($filename); $f = fopen($filename, "rb"); $cur_pos = 0; $size = $filesize - 1; if ($bRealyImage) { $imageParams = CFile::GetImageSize($filename); } if ($_SERVER["REQUEST_METHOD"] == "HEAD") {