Beispiel #1
0
	public function viewFile($hash)
	{
		$file = false;
		$copy = "";
		if (strpos($hash, "_") > 0)
		{
			$copy = explode("_", $hash);
			$hash = $copy[0]; $copy = $copy[1];
		}
		$copy = (!!$copy ? $copy : "default");
		if (FileInputUtility::instance()->checkFile($this->CID, $hash))
		{
			$file = $this->getFromCache($hash);
			$file = $file["files"][$copy];
		}
		if ($file)
			CFile::ViewByUser($file, array("content_type" => $file["type"]));
	}
Beispiel #2
0
	return false;
}

if (!$arParams['INPUT_NAME_UNSAVED'])
{
	$arParams['INPUT_NAME_UNSAVED'] = $arParams['INPUT_NAME'].'_'.RandString(8);
}

$arResult['CONTROL_UID'] = FileInputUtility::instance()->registerControl($arParams['CONTROL_ID']);

$arResult['FILES'] = array();

if (is_array($arParams['INPUT_VALUE']) && strlen(implode(",", $arParams["INPUT_VALUE"])) > 0)
{
	$dbRes = CFile::GetList(array(), array("@ID" => implode(",", $arParams["INPUT_VALUE"])));
	while ($arFile = $dbRes->GetNext())
	{
		$arFile['URL'] = CHTTP::URN2URI($APPLICATION->GetCurPageParam("mfi_mode=down&fileID=".$arFile['ID']."&cid=".$arResult['CONTROL_UID']."&".freetrix_sessid_get(), array("mfi_mode", "fileID", "cid")));
		$arFile['FILE_SIZE_FORMATTED'] = CFile::FormatSize($arFile['FILE_SIZE']);
		$arResult['FILES'][$arFile['ID']] = $arFile;

		FileInputUtility::instance()->registerFile($arResult['CONTROL_UID'], $arFile['ID']);
	}
}

CJSCore::Init(array('ajax'));

$this->IncludeComponentTemplate();

return $arParams['CONTROL_ID'];