function ShowImage($strImage, $iMaxW = 0, $iMaxH = 0, $sParams = null, $strImageUrl = "", $bPopup = false, $sPopupTitle = false, $iSizeWHTTP = 0, $iSizeHHTTP = 0, $strImageUrlTemplate = "") { if (is_array($strImage)) { $arImgParams = $strImage; $iImageID = isset($arImgParams['ID']) ? intval($arImgParams['ID']) : 0; } else { $arImgParams = CFile::_GetImgParams($strImage, $iSizeWHTTP, $iSizeHHTTP); $iImageID = intval($strImage); } if (!$arImgParams) { return ""; } $iMaxW = intval($iMaxW); $iMaxH = intval($iMaxH); $intWidth = $arImgParams['WIDTH']; $intHeight = $arImgParams['HEIGHT']; if ($iMaxW > 0 && $iMaxH > 0 && ($intWidth > $iMaxW || $intHeight > $iMaxH)) { $coeff = $intWidth / $iMaxW > $intHeight / $iMaxH ? $intWidth / $iMaxW : $intHeight / $iMaxH; $iHeight = intval(roundEx($intHeight / $coeff)); $iWidth = intval(roundEx($intWidth / $coeff)); } else { $coeff = 1; $iHeight = $intHeight; $iWidth = $intWidth; } $strImageUrlTemplate = strval($strImageUrlTemplate); if ($strImageUrlTemplate === '' || $iImageID <= 0) { $strImage = $arImgParams['SRC']; } else { $strImage = CComponentEngine::MakePathFromTemplate($strImageUrlTemplate, array('file_id' => $iImageID)); } $strImage = htmlspecialcharsbx($strImage); if (GetFileType($strImage) == "FLASH") { $strReturn = ' <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="banner" WIDTH="' . $iWidth . '" HEIGHT="' . $iHeight . '" ALIGN=""> <PARAM NAME="movie" VALUE="' . $strImage . '" /> <PARAM NAME="quality" VALUE="high" /> <PARAM NAME="bgcolor" VALUE="#FFFFFF" /> <embed src="' . $strImage . '" quality="high" bgcolor="#FFFFFF" WIDTH="' . $iWidth . '" HEIGHT="' . $iHeight . '" NAME="banner" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> </embed> </object> '; } else { $strAlt = $arImgParams['ALT'] ? $arImgParams['ALT'] : $arImgParams['DESCRIPTION']; if ($sParams === null || $sParams === false) { $sParams = 'border="0" alt="' . htmlspecialcharsEx($strAlt) . '"'; } elseif (!preg_match('/(^|\\s)alt\\s*=\\s*(["\']?)(.*?)(\\2)/is', $sParams)) { $sParams .= ' alt="' . htmlspecialcharsEx($strAlt) . '"'; } if ($coeff === 1 || !$bPopup) { $strReturn = '<img src="' . $strImage . '" ' . $sParams . ' width="' . $iWidth . '" height="' . $iHeight . '" />'; } else { if ($sPopupTitle === false) { $sPopupTitle = GetMessage('FILE_ENLARGE'); } if (strlen($strImageUrl) > 0) { $strReturn = '<a href="' . $strImageUrl . '" title="' . $sPopupTitle . '" target="_blank">' . '<img src="' . $strImage . '" ' . $sParams . ' width="' . $iWidth . '" height="' . $iHeight . ' title="' . htmlspecialcharsEx($sPopupTitle) . '" />' . '</a>'; } else { CFile::OutputJSImgShw(); $strReturn = '<a title="' . $sPopupTitle . '" onclick="ImgShw(\'' . CUtil::addslashes($strImage) . '\', ' . $intWidth . ', ' . $intHeight . ', \'' . CUtil::addslashes(htmlspecialcharsEx(htmlspecialcharsEx($strAlt))) . '\'); return false;" href="' . $strImage . '" target="_blank">' . '<img src="' . $strImage . '" ' . $sParams . ' width="' . $iWidth . '" height="' . $iHeight . '" />' . '</a>'; } } } return $bPopup ? $strReturn : print_url($strImageUrl, $strReturn); }
function GetHTML($arBanner, $bNoIndex = false) { $strReturn = ""; // обрабатываем изображение if (intval($arBanner["IMAGE_ID"]) > 0 && $arBanner["AD_TYPE"] != "html") { $arImage = CFile::GetFileArray($arBanner["IMAGE_ID"]); if ($arImage) { $file_type = GetFileType($arImage["FILE_NAME"]); $path = $arImage["SRC"]; switch ($file_type) { case "FLASH": $arParams = array(); $url = $param = ""; $alt = $a_title = $a_target = ""; if (strlen(trim($arBanner["URL"])) > 0) { $param = CAdvBanner::PrepareHTML($arBanner["URL"], $arBanner); $param = CAdvBanner::GetRedirectURL($param, $arBanner); $url = $param; $arParams[] = "flash_link=" . urlencode($param); if (strlen(trim($arBanner["URL_TARGET"])) > 0) { $arParams[] = "flash_target=" . urlencode($arBanner["URL_TARGET"]); $a_target = ' target="' . htmlspecialcharsbx($arBanner["URL_TARGET"]) . '" '; } } if (strlen(trim($arBanner["IMAGE_ALT"])) > 0) { $alt = CAdvBanner::PrepareHTML($arBanner["IMAGE_ALT"], $arBanner); $arParams[] = "flash_alt=" . urlencode($alt); $a_title = " title=\"" . htmlspecialcharsbx($alt) . "\" "; } if (count($arParams) > 0) { $param = "?" . implode("&", $arParams); } if ($arBanner["FLASH_TRANSPARENT"] == '') { $arBanner["FLASH_TRANSPARENT"] = 'transparent'; } if ($arBanner["FLASH_JS"] != 'Y') { $strReturn = '<div style="width: ' . $arImage["WIDTH"] . 'px; height: ' . $arImage["HEIGHT"] . 'px; padding:0; margin:0">'; if (strlen(trim($arBanner["URL"])) > 0 && $arBanner["NO_URL_IN_FLASH"] == "Y") { $strReturn .= ($bNoIndex ? '<noindex>' : '') . '<div style="position:absolute; z-index:100;"><a href="' . $url . '"' . $a_target . $a_title . ($bNoIndex ? ' rel="nofollow"' : '') . '><img src="/bitrix/images/1.gif" width="' . $arImage["WIDTH"] . '" height="' . $arImage["HEIGHT"] . '" style="border:0;" alt="' . htmlspecialcharsEx($alt) . '" /></a></div>' . ($bNoIndex ? '</noindex>' : ''); } $strReturn .= '<OBJECT classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="banner_' . $arBanner["ID"] . '" WIDTH="' . $arImage["WIDTH"] . '" HEIGHT="' . $arImage["HEIGHT"] . '"> <PARAM NAME="movie" VALUE="' . $path . $param . '" /> <PARAM NAME="quality" VALUE="high" /> <PARAM NAME="bgcolor" VALUE="#FFFFFF" /> <PARAM NAME="wmode" VALUE="' . $arBanner["FLASH_TRANSPARENT"] . '" /> <EMBED src="' . $path . $param . '" quality="high" bgcolor="#FFFFFF" wmode="' . $arBanner["FLASH_TRANSPARENT"] . '" WIDTH="' . $arImage["WIDTH"] . '" HEIGHT="' . $arImage["HEIGHT"] . '" NAME="banner" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> </EMBED> </OBJECT></div>'; } else { $strReturn = ""; static $bScript = null; if ($bScript === null) { $bScript = true; $strReturn .= '<script type="text/javascript" src="' . CUtil::GetAdditionalFileURL('/bitrix/js/advertising/flash.js') . '"></script>'; } $altImgPath = ''; $arAltImage = CFile::GetFileArray($arBanner["FLASH_IMAGE"]); if ($arAltImage) { $altImgPath = $arAltImage["SRC"]; } $test_id = 'id' . RandString(10); $strReturn .= '<div id="' . $test_id . '" style="width: ' . $arImage["WIDTH"] . 'px; height: ' . $arImage["HEIGHT"] . 'px; padding:0; margin:0;">'; $altHref = ''; if (trim($arBanner["URL"]) != '') { if ($arBanner["NO_URL_IN_FLASH"] == "Y") { $strReturn .= ($bNoIndex ? '<noindex>' : '') . '<div style="position:absolute; z-index:100;"><a href="' . $url . '"' . $a_target . $a_title . ($bNoIndex ? ' rel="nofollow"' : '') . '><img src="/bitrix/images/1.gif" width="' . $arImage["WIDTH"] . '" height="' . $arImage["HEIGHT"] . '" style="border:0;" alt="' . htmlspecialcharsEx($alt) . '" /></a></div>' . ($bNoIndex ? '</noindex>' : ''); } else { $altHref = $url; } } $strReturn .= '</div>'; $strReturn .= '<script type="text/javascript">bx_adv_includeFlash("' . $test_id . '", "' . CUtil::JSEscape($path . $param) . '", "' . $arImage["WIDTH"] . '", "' . $arImage["HEIGHT"] . '", "' . $arBanner["FLASH_TRANSPARENT"] . '", "' . CUtil::JSEscape($altImgPath) . '", ' . (intval($arBanner["FLASH_VER"]) <= 0 ? 'null' : intval($arBanner["FLASH_VER"])) . ', "' . CUtil::JSEscape($altHref) . '", "' . CUtil::JSEscape(htmlspecialcharsbx($arBanner["URL_TARGET"])) . '", "' . CUtil::JSEscape(htmlspecialcharsbx($alt)) . '");</script>'; } break; default: $alt = CAdvBanner::PrepareHTML(trim($arBanner["IMAGE_ALT"]), $arBanner); $strImage = "<img alt=\"" . htmlspecialcharsEx($alt) . "\" title=\"" . htmlspecialcharsEx($alt) . "\" src=\"" . $path . "\" width=\"" . $arImage["WIDTH"] . "\" height=\"" . $arImage["HEIGHT"] . "\" style=\"border:0;\" />"; if (strlen(trim($arBanner["URL"])) > 0) { $url = $arBanner["URL"]; $url = CAdvBanner::PrepareHTML($url, $arBanner); $url = CAdvBanner::GetRedirectURL($url, $arBanner); $target = strlen(trim($arBanner["URL_TARGET"])) > 0 ? " target=\"" . $arBanner["URL_TARGET"] . "\" " : ""; $strReturn = ($bNoIndex ? '<noindex>' : '') . "<a href=\"" . $url . "\"" . $target . ($bNoIndex ? ' rel="nofollow"' : '') . ">" . $strImage . "</a>" . ($bNoIndex ? '</noindex>' : ''); } else { $strReturn .= $strImage; } break; } } } if ($arBanner["CODE"] != '') { $code = $arBanner["CODE"]; if ($arBanner["CODE_TYPE"] == "text") { $code = TxtToHTML($code); } $code = CAdvBanner::PrepareHTML($code, $arBanner); $strReturn .= CAdvBanner::ReplaceURL($code, $arBanner); } return $strReturn; }
public function GetType() { return GetFileType($this->path); }
function CheckFields() { global $DB, $strError, $FILENAME, $APPLICATION, $ID, $BODY, $USER, $SITE_ID, $STATUS_ID, $DOC_ROOT; $str = ""; $arMsg = array(); $SCRIPT_FILE_TYPE = GetFileType($FILENAME); $FILENAME = trim($FILENAME); $FILENAME = "/" . ltrim(_normalizePath($FILENAME), "/"); $io = CBXVirtualIo::GetInstance(); if (strlen($FILENAME) <= 0) { $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_FORGOT_FILENAME")); } elseif (!$io->ValidatePathString($FILENAME)) { $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_FILE_NAME_NOT_VALID")); } elseif ($SCRIPT_FILE_TYPE != "SOURCE") { $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_INCORRECT_FILETYPE")); } else { $SITE_ID = CWorkflow::__CheckSite($SITE_ID); if (!$SITE_ID) { $SITE_ID = CSite::GetSiteByFullPath($_SERVER['DOCUMENT_ROOT'] . $FILENAME); } if (!$USER->CanDoFileOperation('fm_edit_in_workflow', array($SITE_ID, $FILENAME))) { $s = str_replace("#FILENAME#", "{$FILENAME}", GetMessage("FLOW_ACCESS_DENIED")); $arMsg[] = array("id" => "FILENAME", "text" => $s . ": " . GetMessage("FLOW_MIN_RIGHTS")); } elseif ($STATUS_ID == 1 && !($USER->CanDoFileOperation('fm_edit_existent_file', array($SITE_ID, $FILENAME)) && $USER->CanDoFileOperation('fm_create_new_file', array($SITE_ID, $FILENAME)))) { $arMsg[] = array("id" => "FILENAME", "text" => GetMessage("FLOW_ACCESS_DENIED_FOR_FILE_WRITE", array("#FILENAME#" => $FILENAME))); } else { $z = CWorkflow::GetByFilename($FILENAME, $SITE_ID); if ($zr = $z->Fetch()) { if ($zr["ID"] != $ID && $zr["STATUS_ID"] != 1) { $arMsg[] = array("id" => "FILENAME", "text" => str_replace("#FILENAME#", $FILENAME, GetMessage("FLOW_FILENAME_EXIST"))); } } } } if (!CWorkflow::IsAdmin()) { $arGroups = $USER->GetUserGroupArray(); if (!is_array($arGroups)) { $arGroups = array(2); } $arFilter = array("GROUP_ID" => $arGroups, "PERMISSION_TYPE_1" => 1, "ID_EXACT_MATCH" => "Y", "ID" => $STATUS_ID); $rsStatuses = CWorkflowStatus::GetList($by = "s_c_sort", $strOrder, $arFilter, $is_filtered, array("ID")); if (!$rsStatuses->Fetch()) { $arMsg[] = array("id" => "STATUS_ID", "text" => GetMessage("FLOW_ERROR_WRONG_STATUS")); } } $bIsPhp = IsPHP($BODY); if ($bIsPhp) { if ($USER->CanDoFileOperation('fm_lpa', array($SITE_ID, $FILENAME)) && !$USER->CanDoOperation('edit_php')) { if (CModule::IncludeModule("fileman")) { $old_res = CFileman::ParseFileContent($APPLICATION->GetFileContent($DOC_ROOT . $FILENAME), true); $old_BODY = $old_res["CONTENT"]; $BODY = CMain::ProcessLPA($BODY, $old_BODY); } else { $arMsg[] = array("id" => "BODY", "text" => "Error! Fileman is not included!"); } } else { if (!$USER->CanDoOperation('edit_php')) { $arMsg[] = array("id" => "BODY", "text" => GetMessage("FLOW_PHP_IS_NOT_AVAILABLE")); } } } if (!empty($arMsg)) { $e = new CAdminException($arMsg); $GLOBALS["APPLICATION"]->ThrowException($e); return false; } return true; }
$strWarning = $mess; $bVarsFromForm = true; } $originalPath = $path; $new = isset($new) && strtolower($new) == 'y' ? 'y' : ''; if ($new == 'y' && strlen($filename) > 0) { $path = $path . "/" . $filename; } $site = CFileMan::__CheckSite($site); if (!$site) { $site = CSite::GetSiteByFullPath($_SERVER["DOCUMENT_ROOT"] . $path); } $DOC_ROOT = CSite::GetSiteDocRoot($site); $abs_path = $io->CombinePath($DOC_ROOT, $path); $arPath = array($site, $path); if (GetFileType($abs_path) == "IMAGE") { $strWarning = GetMessage("FILEMAN_FILEEDIT_FILE_IMAGE_ERROR"); } if (($new == '' || strlen($filename) <= 0 && strlen($oldname) <= 0) && !$io->FileExists($abs_path)) { $p = strrpos($path, "/"); if ($p !== false) { $new = "y"; $filename = substr($path, $p + 1); $path = substr($path, 0, $p); } } $bFullPHP = $full_src == "Y" && $USER->CanDoOperation('edit_php'); $NEW_ROW_CNT = 1; $arParsedPath = CFileMan::ParsePath(array($site, $path), true, false, "", $logical == "Y"); $isScriptExt = HasScriptExtension($path); //Check access to file
public static function GetFileType($path) { return GetFileType($path); }
function GetFileType($path) { return GetFileType($path); }
<td class="tablehead" align="center"><font class="tableheadtext"><?php echo GetMessage("FILEMAN_SIZE"); ?> </font></td> <td class="tablehead" align="center"><font class="tableheadtext"><?php echo GetMessage("FILEMAN_FILE_LOADED"); ?> </font></td> <td class="tablehead" align="center" width="50%"><font class="tableheadtext"><?php echo GetMessage("FILEMAN_UPLOADED_BY"); ?> </font></td> </tr> <?php while ($zr = $doc_files->GetNext()) { $ftype = GetFileType($zr["FILENAME"]); if ($ftype == "IMAGE") { ?> <tr> <td class="tablebody"><font class="tablebodytext"><?php echo $zr["ID"]; ?> </font></td> <td class="tablebody"><font class="tablebodytext"><a onclick="WF_OnFileSelect('<?php echo AddSlashes(htmlspecialcharsex($zr["FILENAME"])); ?> '); return false;" href="javascript:void(0)" ><?php echo htmlspecialcharsex($zr["FILENAME"]); ?> </a></font></td> <td class="tablebody" align="right"><font class="tablebodytext"><?php
</tr> <?if($bEdit):?> <? $tabControl->BeginNextTab(); ?> <tr> <td colspan="2"> <table cellspacing="0" class="internal"> <? $dbFiles = CSiteTemplate::GetContent($ID); while($arFiles = $dbFiles->GetNext()): if($arFiles["NAME"]=="header.php" || $arFiles["NAME"]=="footer.php" || $arFiles["NAME"]=="styles.css" || $arFiles["NAME"]=="template_styles.css" || $arFiles["NAME"]=="description.php") continue; if($arFiles["TYPE"]<>"F") continue; $fType = GetFileType($arFiles["NAME"]); ?> <tr> <td><?php echo htmlspecialcharsbx($arFiles["NAME"]); ?> </td> <td><?php echo htmlspecialcharsbx($arFiles["DESCRIPTION"]); ?> </td> <td> <?if($fType == 'SOURCE'):?> <a title ="<?php echo GetMessage("MAIN_MOD_FILE") . htmlspecialcharsbx($arFiles["NAME"]); ?>
function GetDirList($path, &$arDirs, &$arFiles, $arFilter = array(), $sort = array(), $type = "DF", $bLogical = false, $task_mode = false) { global $USER, $APPLICATION; CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); $arDirs = array(); $arFiles = array(); $exts = strtolower($arFilter["EXTENSIONS"]); $arexts = explode(",", $exts); if (isset($arFilter["TYPE"])) { $type = strtoupper($arFilter["TYPE"]); } $io = CBXVirtualIo::GetInstance(); $path = $io->CombinePath("/", $path); $abs_path = $io->CombinePath($DOC_ROOT, $path); if (!$io->DirectoryExists($abs_path)) { return false; } $date_format = CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")); $tzOffset = CTimeZone::GetOffset(); $dir = $io->GetDirectory($abs_path); $arChildren = $dir->GetChildren(); foreach ($arChildren as $child) { $arFile = array(); if (($type == "F" || $type == "") && $child->IsDirectory()) { continue; } if (($type == "D" || $type == "") && !$child->IsDirectory()) { continue; } $file = $child->GetName(); if ($bLogical) { if ($child->IsDirectory()) { $sSectionName = ""; $fsn = $io->CombinePath($abs_path, $file, ".section.php"); if (!$io->FileExists($fsn)) { continue; } include $io->GetPhysicalName($fsn); $arFile["LOGIC_NAME"] = $sSectionName; } else { if (CFileMan::GetFileTypeEx($file) != "php") { continue; } if ($file == '.section.php') { continue; } if (!preg_match('/^\\.(.*)?\\.menu\\.(php|html|php3|php4|php5|php6|phtml)$/', $file, $regs)) { $f = $io->GetFile($abs_path . "/" . $file); $filesrc = $f->GetContents(); $title = PHPParser::getPageTitle($filesrc); if ($title === false) { continue; } $arFile["LOGIC_NAME"] = $title; } } } $arFile["PATH"] = $abs_path . "/" . $file; $arFile["ABS_PATH"] = $path . "/" . $file; $arFile["NAME"] = $file; $arPerm = $APPLICATION->GetFileAccessPermission(array($site, $path . "/" . $file), $USER->GetUserGroupArray(), $task_mode); if ($task_mode) { $arFile["PERMISSION"] = $arPerm[0]; if (count($arPerm[1]) > 0) { $arFile["PERMISSION_EX"] = $arPerm[1]; } } else { $arFile["PERMISSION"] = $arPerm; } $arFile["TIMESTAMP"] = $child->GetModificationTime() + $tzOffset; $arFile["DATE"] = date($date_format, $arFile["TIMESTAMP"]); if (isset($arFilter["TIMESTAMP_1"]) && strtotime($arFile["DATE"]) < strtotime($arFilter["TIMESTAMP_1"])) { continue; } if (isset($arFilter["TIMESTAMP_2"]) && strtotime($arFile["DATE"]) > strtotime($arFilter["TIMESTAMP_2"])) { continue; } if (is_set($arFilter, "MIN_PERMISSION") && $arFile["PERMISSION"] < $arFilter["MIN_PERMISSION"] && !$task_mode) { continue; } if (!$child->IsDirectory() && $arFile["PERMISSION"] <= "R" && !$task_mode) { continue; } if ($bLogical) { if (strlen($arFilter["NAME"]) > 0 && strpos($arFile["LOGIC_NAME"], $arFilter["NAME"]) === false) { continue; } } else { if (strlen($arFilter["NAME"]) > 0 && strpos($arFile["NAME"], $arFilter["NAME"]) === false) { continue; } } //if(strlen($arFilter["NAME"])>0 && strpos($arFile["NAME"], $arFilter["NAME"])===false) // continue; if (substr($arFile["ABS_PATH"], 0, strlen(BX_ROOT . "/modules")) == BX_ROOT . "/modules" && !$USER->CanDoOperation('edit_php') && !$task_mode) { continue; } if ($arFile["PERMISSION"] == "U" && !$task_mode) { $ftype = GetFileType($arFile["NAME"]); if ($ftype != "SOURCE" && $ftype != "IMAGE" && $ftype != "UNKNOWN") { continue; } if (substr($arFile["NAME"], 0, 1) == ".") { continue; } } if ($child->IsDirectory()) { $arFile["SIZE"] = 0; $arFile["TYPE"] = "D"; $arDirs[] = $arFile; } else { if ($exts != "") { if (!in_array(strtolower(substr($file, bxstrrpos($file, ".") + 1)), $arexts)) { continue; } } $arFile["TYPE"] = "F"; $arFile["SIZE"] = $child->GetFileSize(); $arFiles[] = $arFile; } } if (is_array($sort) && count($sort) > 0) { $by = key($sort); $order = strtolower($sort[$by]); $by = strtolower($by); if ($order != "desc") { $order = "asc"; } if ($by != "size" && $by != "timestamp") { $by = "name"; } usort($arDirs, array("_FilesCmp", "cmp_" . $by . "_" . $order)); usort($arFiles, array("_FilesCmp", "cmp_" . $by . "_" . $order)); } return null; }
/** * Метод проверяет текущий файл на соответствие требованиям */ function CheckFile($filename = false) { if (!$filename) { $arFile = $_FILES[$this->sField]; } else { $arFile = GenFileArray($this->sRootDir . $filename); } if ($arFile['size'] > $this->iMaxSize) { throw new CError('SYSTEM_IMAGE_FILESIZE_TO_BIG', 1, $this->iMaxSize); } $sFileType = GetFileType($arFile['tmp_name']); if ($sFileType == 'image/gif' || $sFileType == 'image/jpeg' || $sFileType == 'image/png') { if ($arParams = @getimagesize($arFile['tmp_name'])) { $width = $arParams[0]; $height = $arParams[1]; if ($width > $this->iMaxWidth) { throw new CError('SYSTEM_IMAGE_TOO_WIDE', 2, $this->iMaxWidth); } if ($height > $this->iMaxHeight) { throw new CError('SYSTEM_IMAGE_TOO_HIGH', 3, $this->iMaxHeight); } } else { throw new CError('SYSTEM_IMAGE_NOT_IMAGE_OR_UNSUPPORTED', 10, $sFileType); } } else { throw new CError('SYSTEM_IMAGE_NOT_IMAGE_OR_UNSUPPORTED', 10, $sFileType); } return true; }
/** * Функция генерирует описание файла */ function GenFileArray($sFile) { $arFile = array('name' => basename($sFile), 'type' => GetFileType($sFile), 'size' => filesize($sFile), 'tmp_name' => $sFile, 'error' => UPLOAD_ERR_OK); return $arFile; }