Exemple #1
0
 function findCorrectFile($path, &$strWarn, $warning = false)
 {
     $arUrl = CHTTP::ParseURL($path);
     if ($arUrl && is_array($arUrl)) {
         if (isset($arUrl['host'], $arUrl['scheme'])) {
             if (strpos($arUrl['host'], 'xn--') !== false) {
                 // Do nothing
             } else {
                 $originalPath = $path;
                 $path = $arUrl['scheme'] . '://' . $arUrl['host'];
                 $arErrors = array();
                 if (defined("BX_UTF")) {
                     $punicodedPath = CBXPunycode::ToUnicode($path, $arErrors);
                 } else {
                     $punicodedPath = CBXPunycode::ToASCII($path, $arErrors);
                 }
                 if ($pathPunicoded == $path) {
                     return $originalPath;
                 } else {
                     $path = $punicodedPath;
                 }
                 if ($arUrl['port'] && ($arUrl['scheme'] != 'http' || $arUrl['port'] != 80) && ($arUrl['scheme'] != 'https' || $arUrl['port'] != 443)) {
                     $path .= ':' . $arUrl['port'];
                 }
                 $path .= $arUrl['path_query'];
             }
         } else {
             $DOC_ROOT = $_SERVER["DOCUMENT_ROOT"];
             $path = Rel2Abs("/", $path);
             $path_ = $path;
             $io = CBXVirtualIo::GetInstance();
             if (!$io->FileExists($DOC_ROOT . $path)) {
                 if (CModule::IncludeModule('clouds')) {
                     $path = CCloudStorage::FindFileURIByURN($path, "component:player");
                     if ($path == "") {
                         if ($warning) {
                             $strWarn .= $warning . "<br />";
                         }
                         $path = $path_;
                     }
                 } else {
                     if ($warning) {
                         $strWarn .= $warning . "<br />";
                     }
                     $path = $path_;
                 }
             } elseif (strpos($_SERVER['HTTP_HOST'], 'xn--') !== false) {
                 $path = CHTTP::URN2URI($path);
             }
         }
     }
     return $path;
 }
Exemple #2
0
		{
			$FileSize = filesize($_SERVER["DOCUMENT_ROOT"]."/".$PathToFile);
			if($FileSize)
				$FileSize = round(sprintf("%u", $FileSize)/1024/1024, 2);
			if($FileSize <= 0)
				$FileSize = "";

			$ext = strtolower(substr($PathToFile, -4));
			if($ext == ".wmv" || $ext == "wma")
				$FileType = "wmv";
			else
				$FileType = "flv";
		}
		elseif(
			CModule::IncludeModule("clouds")
			&& ($uri = CCloudStorage::FindFileURIByURN($PathToFile, "component:iblock.tv, iblock:".$arParams["IBLOCK_ID"].", element: ".$arItem["ID"])) !== ""
		)
		{
			$PathToFile = $uri;

			$FileSize = "";

			$ext = strtolower(substr($PathToFile, -4));
			if($ext == ".wmv" || $ext == "wma")
				$FileType = "wmv";
			else
				$FileType = "flv";
		}
		else
		{
			$FileSize = "";
Exemple #3
0
 }
 if ($PathToFile && file_exists($_SERVER["DOCUMENT_ROOT"] . "/" . $PathToFile) && is_file($_SERVER["DOCUMENT_ROOT"] . "/" . $PathToFile)) {
     $FileSize = filesize($_SERVER["DOCUMENT_ROOT"] . "/" . $PathToFile);
     if ($FileSize) {
         $FileSize = round(sprintf("%u", $FileSize) / 1024 / 1024, 2);
     }
     if ($FileSize <= 0) {
         $FileSize = "";
     }
     $ext = strtolower(substr($PathToFile, -4));
     if ($ext == ".wmv" || $ext == "wma") {
         $FileType = "wmv";
     } else {
         $FileType = "flv";
     }
 } elseif (CModule::IncludeModule("clouds") && ($uri = CCloudStorage::FindFileURIByURN($PathToFile, "component:iblock.tv, iblock:" . $arParams["IBLOCK_ID"] . ", element: " . $arItem["ID"])) !== "") {
     $PathToFile = $uri;
     $FileSize = "";
     $ext = strtolower(substr($PathToFile, -4));
     if ($ext == ".wmv" || $ext == "wma") {
         $FileType = "wmv";
     } else {
         $FileType = "flv";
     }
 } else {
     $FileSize = "";
     $FileType = "flv";
 }
 if (!$arResult['FIRST_FLV_ITEM'] && $FileType == 'flv') {
     $arResult['FIRST_FLV_ITEM'] = $PathToFile;
 }