Example #1
0
/*
##############################################
# Freetrix: SiteManager                        #
# Copyright (c) 2002 - 2011 Freetrix           #
# http://www.freetrixsoft.com                  #
# mailto:admin@freetrixsoft.com                #
##############################################
*/
require_once($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_before.php");

if (!CModule::IncludeModule("form"))
	die();

if (strlen($_REQUEST["hash"]) > 0)
{
	$arFile = CFormResult::GetFileByHash($_REQUEST["rid"], $_REQUEST["hash"]);
	if ($arFile)
	{
		set_time_limit(0);
		// if we need "download"
		if ($_REQUEST["action"]=="download")
		{
			// download
			CFile::ViewByUser($arFile, array("force_download" => true));
		}
		else // otherwise just view
		{
			if (CFile::CheckImageFile(CFile::MakeFileArray($arFile['FILE_ID'])) === null)
			{
				// display as image
				CFile::ViewByUser($arFile, array("content_type" => $arFile["CONTENT_TYPE"]));