if (!$ismenu) { $aDDMenuEdit[] = array("TEXT" => GetMessage("FILEMAN_FILEEDIT_AS_TXT"), "ACTION" => "window.location='fileman_file_edit.php?" . $addUrl . "&site=" . Urlencode($site) . "&path=" . UrlEncode($path) . ($new == 'y' ? "&new=Y" : "") . (strlen($back_url) > 0 ? "&back_url=" . urlencode($back_url) : "") . (strlen($template) > 0 ? "&template=" . urlencode($template) : "") . (strlen($template) > 0 ? "&template=" . urlencode($template) : "") . (strlen($templateID) > 0 ? "&templateID=" . urlencode($templateID) : "") . "';"); } if ($USER->CanDoOperation('edit_php')) { $aDDMenuEdit[] = array("TEXT" => GetMessage("FILEMAN_FILEEDIT_AS_PHP"), "ACTION" => "window.location='fileman_file_edit.php?" . $addUrl . "&site=" . Urlencode($site) . "&path=" . UrlEncode($path) . "&full_src=Y" . ($new == 'y' ? "&new=Y" : "") . (strlen($back_url) > 0 ? "&back_url=" . urlencode($back_url) : "") . (strlen($template) > 0 ? "&template=" . urlencode($template) : "") . (strlen($template) > 0 ? "&template=" . urlencode($template) : "") . (strlen($templateID) > 0 ? "&templateID=" . urlencode($templateID) : "") . "';"); } if ($ismenu) { $aDDMenuEdit[] = array("TEXT" => GetMessage("FILEMAN_FILEEDIT_AS_MENU"), "ACTION" => "window.location='fileman_menu_edit.php?" . $addUrl . "&site=" . Urlencode($site) . "&path=" . UrlEncode($arParsedPath["PREV"]) . "&name=" . UrlEncode($regs[1]) . ($new == 'y' ? "&new=Y" : "") . (strlen($back_url) > 0 ? "&back_url=" . urlencode($back_url) : "") . "';"); } $aDDMenuEdit[] = array("TEXT" => GetMessage("FILEMAN_FILEEDIT_AS_HTML"), "ACTION" => "return;", "ICON" => "checked"); $aMenu[] = array("TEXT" => GetMessage("FILEMAN_FILE_EDIT"), "TITLE" => GetMessage("FILEMAN_FILE_EDIT"), "MENU" => $aDDMenuEdit); if ($bEdit) { if ($USER->CanDoFileOperation('fm_rename_file', $arPath)) { $aMenu[] = array("TEXT" => GetMessage("FILEMAN_FILEEDIT_RENAME"), "LINK" => "fileman_rename.php?" . $addUrl . "&site=" . Urlencode($site) . "&path=" . UrlEncode($arParsedPath["PREV"]) . "&files[]=" . UrlEncode($arParsedPath["LAST"])); } if ($USER->CanDoFileOperation('fm_download_file', $arPath) && !(HasScriptExtension($path) || substr(CFileman::GetFileName($path), 0, 1) == ".") || $USER->CanDoOperation('edit_php')) { $aMenu[] = array("TEXT" => GetMessage("FILEMAN_FILEEDIT_DOWNLOAD"), "LINK" => "fileman_file_download.php?" . $addUrl . "&site=" . Urlencode($site) . "&path=" . UrlEncode($path)); } if ($USER->CanDoFileOperation('fm_delete_file', $arPath)) { $folder_path = substr($path, 0, strrpos($path, "/")); $id = GetFileName($path); $aMenu[] = array("TEXT" => GetMessage("FILEMAN_FILE_DELETE"), "LINK" => "javascript:if(confirm('" . GetMessage("FILEMAN_FILE_DELETE_CONFIRM") . "')) window.location='/bitrix/admin/fileman_admin.php?ID=" . urlencode($id) . "&action=delete&" . $addUrl . "&site=" . urlencode($site) . "&path=" . urlencode($folder_path) . "&" . bitrix_sessid_get() . "';", "TITLE" => GetMessage("FILEMAN_FILE_DELETE")); } } $context = new CAdminContextMenu($aMenu); $context->Show(); global $__fd_path; $__fd_path = $bEdit ? $arParsedPath["PREV"] : $path; $arContextTemplates = array(); $arTemplates = CFileman::GetFileTemplates(LANGUAGE_ID, array($site_template)); $cntTempl = count($arTemplates);
IncludeModuleLangFile(__FILE__); $strWarning = ""; $site = CFileMan::__CheckSite($site); $DOC_ROOT = CSite::GetSiteDocRoot($site); $io = CBXVirtualIo::GetInstance(); $path = $GLOBALS["APPLICATION"]->ConvertCharset($path, "UTF-8", LANG_CHARSET); $arFile = CFile::MakeFileArray($io->GetPhysicalName($path)); $arFile["tmp_name"] = CBXVirtualIoFileSystem::ConvertCharset($arFile["tmp_name"], CBXVirtualIoFileSystem::directionDecode); $path = $io->CombinePath("/", $path); $arPath = array($site, $path); if (!$USER->CanDoFileOperation('fm_download_file', $arPath)) { $strWarning = GetMessage("ACCESS_DENIED"); } else { if (!$io->FileExists($arFile["tmp_name"])) { $strWarning = GetMessage("FILEMAN_FILENOT_FOUND") . " "; } elseif (!$USER->CanDoOperation('edit_php') && (HasScriptExtension($path) || substr(CFileman::GetFileName($path), 0, 1) == ".")) { $strWarning .= GetMessage("FILEMAN_FILE_DOWNLOAD_PHPERROR") . "\n"; } } if (strlen($strWarning) <= 0) { $flTmp = $io->GetFile($arFile["tmp_name"]); $fsize = $flTmp->GetFileSize(); $bufSize = 4194304; //4M session_write_close(); set_time_limit(0); header("Content-Type: application/force-download; name=\"" . $arFile["name"] . "\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $fsize); header("Content-Disposition: attachment; filename=\"" . $arFile["name"] . "\""); header("Expires: 0");
public static function Init($Params) { global $USER; $arWarnings = array(); if (!$USER->CanDoOperation('fileman_admin_files') && !$USER->CanDoOperation('fileman_admin_folders')) { $arWarnings[] = GetMessage('FM_UTIL_ACCESS_DENIED'); } $io = CBXVirtualIo::GetInstance(); if (count($arWarnings) == 0) { $pathTo = trim($Params['copyTo'], " /"); $site = CFileMan::__CheckSite($_GET['site']); $siteTo = $Params['siteTo'] ? $Params['siteTo'] : $site; $pathTo = $pathTo == "" ? "/" : "/" . $pathTo . "/"; $absPathTo = CSite::GetSiteDocRoot($siteTo) . $pathTo; $docRootFrom = CSite::GetSiteDocRoot($site); if (!$io->DirectoryExists($absPathTo)) { // Create destination directory $bAccess = $USER->CanDoOperation('fileman_admin_folders') && $USER->CanDoFileOperation('fm_create_new_folder', $pathTo); if ($Params['createCopyTo']) { if ($bAccess) { CFileMan::CreateDir(array($siteTo, $pathTo)); } } else { ?> <script>window.BXFM_NoCopyToDir = "<?php echo $bAccess ? "ask_user" : "access_denied"; ?> ";</script><?php return; } } foreach ($Params['arFiles'] as $file) { $filePath = $file['path']; $caseOption = $Params['caseOption']; if ($Params["userCaseLastPath"]) { if ($Params["userCaseLastPath"] != $filePath) { continue; } $caseOption = $Params['userCaseAnswer']; if ($Params["userCaseToAll"]) { $Params['caseOption'] = $caseOption; } $Params["userCaseLastPath"] = false; } $arPath_i = array($site, $filePath); $absPath_i = $docRootFrom . $filePath; $bDir_i = $io->DirectoryExists($absPath_i); $name_i = CFileman::GetFileName($filePath); $strWarn = ""; // Check if file already exists in destination folder if ($io->FileExists($absPathTo . $name_i) || $bDir_i == $io->DirectoryExists($absPathTo . $name_i) && $bDir_i) { $fTmp = $io->GetFile($absPathTo . $name_i); $fTmp1 = $io->GetFile($absPath_i); $altName = CFilemanCopy::GetAltFileName($absPathTo, $name_i, $bDir_i); if ($caseOption == 'ask') { ?> <script> window.BXFM_fileExist = { fileOld: { name: "<?php echo CUtil::JSEscape($name_i); ?> ", path: "<?php echo CUtil::JSEscape($pathTo . $name_i); ?> ", site: "<?php echo CUtil::JSEscape($siteTo); ?> ", bDir: <?php echo $bDir_i ? "true" : "false"; ?> , size: "<?php echo $bDir_i ? '-' : CFile::FormatSize($fTmp->GetFileSize()); ?> ", date: "<?php echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPathTo . $name_i) + CTimeZone::GetOffset()); ?> " }, fileNew: { alt_name: "<?php echo CUtil::JSEscape($altName); ?> ", name: "<?php echo CUtil::JSEscape($name_i); ?> ", path: "<?php echo CUtil::JSEscape($filePath); ?> ", site: "<?php echo CUtil::JSEscape($site); ?> ", bDir: <?php echo $bDir_i ? "true" : "false"; ?> , size: "<?php echo $bDir_i ? '-' : CFile::FormatSize($fTmp1->GetFileSize()); ?> ", date: "<?php echo date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL")), CFilemanUtils::GetModifyTime($absPath_i) + CTimeZone::GetOffset()); ?> " } }; </script><?php return; } elseif ($caseOption == 'replace') { // We don't need to replace, couse it's one file if (CFileMan::NormalizePath($pathTo . "/" . $name_i) == $filePath) { continue; } $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy'], true); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } elseif ($caseOption == 'auto_rename') { $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $altName)), !$Params['bCopy']); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } elseif ($caseOption == 'skip') { continue; } } else { $strWarn = CFileMan::CopyEx($arPath_i, array($siteTo, CFileMan::NormalizePath($pathTo . "/" . $name_i)), !$Params['bCopy']); if ($strWarn != "") { $arWarnings[] = $strWarn; $log = false; } elseif ($Params['bSearch'] && $Params['ssess'] && !$Params['bCopy']) { CFilemanSearch::DelFromSearchResult($Params['ssess'], $filePath); } } $module_id = "fileman"; if (COption::GetOptionString($module_id, "log_page", "Y") == "Y" && $log) { $res_log['copy_to'] = substr($pathTo, 1); $res_log['path'] = substr($filePath, 1); if ($Params['bCopy'] == "copy") { if (!$bDir_i) { CEventLog::Log("content", "FILE_COPY", "fileman", "", serialize($res_log)); } else { CEventLog::Log("content", "SECTION_COPY", "fileman", "", serialize($res_log)); } } else { if (!$bDir_i) { CEventLog::Log("content", "FILE_MOVE", "fileman", "", serialize($res_log)); } else { CEventLog::Log("content", "SECTION_MOVE", "fileman", "", serialize($res_log)); } } } } } $arWarnings; ?> <script> window.BXFM_result = { status: "<?php echo count($arWarnings) > 0 ? 'errors' : 'ok'; ?> ", errors: <?php echo count($arWarnings) > 0 ? CUtil::PhpToJSObject($arWarnings) : '{}'; ?> }; </script><?php }
) || ( strlen($new) < 0 && !( $USER->CanDoOperation('fileman_edit_existent_files') && $USER->CanDoFileOperation('fm_edit_existent_file',$arPath) ) ) ) { $strWarning = GetMessage("ACCESS_DENIED"); } elseif(strlen($strWarning) <= 0) { if(!$USER->IsAdmin() && substr(CFileman::GetFileName($abs_path), 0, 1)==".") { $strWarning = GetMessage("FILEMAN_FILEEDIT_BAD_FNAME")." "; $bEdit = false; $bVarsFromForm = true; $path = $io->CombinePath("/", $arParsedPath["PREV"]); $arParsedPath = CFileMan::ParsePath($path, true, false, "", $logical == "Y"); $abs_path = $DOC_ROOT.$path; } elseif($new == 'Y') { $bEdit = false; } else { if(!$io->FileExists($abs_path))
if (!$io->FileExists($abs_path) && !$io->DirectoryExists($abs_path)) { $strWarning .= GetMessage("FILEMAN_FILEORFOLDER_NOT_FOUND"); } else { if ($REQUEST_METHOD == "POST" && strlen($save) > 0 && check_bitrix_sessid()) { $pathTmp = $path; foreach ($arFiles as $ind => $file) { $newfilename = $filename[$ind]; if (strlen($newfilename) <= 0) { $strWarning .= GetMessage("FILEMAN_RENAME_NEW_NAME") . " \"" . $file . "\"!\n"; } elseif (($mess = CFileMan::CheckFileName($newfilename)) !== true) { $strWarning = $mess; } else { $pathto = Rel2Abs($path, $newfilename); if (!$USER->CanDoFileOperation('fm_create_new_file', array($site, $pathto))) { $strWarning .= GetMessage("FILEMAN_RENAME_ACCESS_ERROR") . "\n"; } elseif (!$USER->CanDoOperation('edit_php') && (substr(CFileman::GetFileName($file), 0, 1) == "." || substr(CFileman::GetFileName($pathto), 0, 1) == "." || !HasScriptExtension($file) && HasScriptExtension($pathto))) { // if not admin and renaming from non PHP to PHP $strWarning .= GetMessage("FILEMAN_RENAME_TOPHPFILE_ERROR") . "\n"; } elseif (!$USER->CanDoOperation('edit_php') && HasScriptExtension($file) && !HasScriptExtension($pathto)) { // if not admin and renaming from PHP to non PHP $strWarning .= GetMessage("FILEMAN_RENAME_FROMPHPFILE_ERROR") . "\n"; } else { $pathparsedtmp = CFileMan::ParsePath(array($site, $pathto), false, false, "", $logical == "Y"); $strWarningTmp = CFileMan::CreateDir($pathparsedtmp["PREV"]); if (strlen($strWarningTmp) > 0) { $strWarning .= $strWarningTmp; } else { if (!$io->FileExists($DOC_ROOT . $path . "/" . $file)) { $strWarning .= GetMessage("FILEMAN_RENAME_FILE") . " \"" . $path . "/" . $file . "\" " . GetMessage("FILEMAN_RENAME_NOT_FOUND") . "!\n"; } elseif (!$io->Rename($DOC_ROOT . $path . "/" . $file, $DOC_ROOT . $pathto)) { $strWarning .= GetMessage("FILEMAN_RENAME_ERROR") . " \"" . $path . "/" . $file . "\" " . GetMessage("FILEMAN_RENAME_IN") . " \"" . $pathto . "\"!\n";
$arActions[] = array("ICON" => "btn_fileman_prop", "TEXT" => GetMessage("FILEMAN_ADMIN_FOLDER_PROP"), "ACTION" => $lAdmin->ActionRedirect("fileman_folder.php?" . $addUrl . "&site=" . urlencode($site) . "&path=" . $fpathUrl . "")); } } $type = $Elem["TYPE"] == "F" ? 'file' : 'folder'; if ($logical != "Y") { if ($Elem["TYPE"] == "F" && $USER->CanDoFileOperation('fm_view_file', $arPath) && ($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($f_NAME) || substr($Elem["NAME"], 0, 1) == ".")) || $Elem["TYPE"] == "D" && $USER->CanDoFileOperation('fm_view_listing', $arPath)) { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "pack", "TEXT" => GetMessage("FILEMAN_ADMIN_ARC_PACK"), "ACTION" => "window.PackUnpackRun([{'path' : '" . CUtil::JSEscape($fpath) . "', 'isDir' : '" . $arrIsDir[$fpath] . "'}], true); return false;"); $is_archive = CBXArchive::IsArchive($fpath); if ($is_archive) { $arActions[] = array("ICON" => "unpack", "TEXT" => GetMessage("FILEMAN_ADMIN_ARC_UNPACK"), "ACTION" => "window.PackUnpackRun(['" . CUtil::JSEscape($fpath) . "'], false); return false;"); } } if ($USER->CanDoFileOperation('fm_rename_' . $type, $arPath)) { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "rename", "TEXT" => GetMessage("FILEMAN_RENAME_SAVE"), "ACTION" => 'setCheckbox(\'' . addslashes($f_NAME) . '\'); if(' . $lAdmin->table_id . '.IsActionEnabled(\'edit\')){document.forms[\'form_' . $lAdmin->table_id . '\'].elements[\'action_button\'].value=\'edit\'; ' . $lAdmin->ActionPost() . '}else{document.location.href=\'fileman_rename.php?' . $addUrl . '&path=' . urlencode($path) . '&site=' . $site . '&files[]=' . CFileman::GetFileName($arPath[1]) . '\'}'); } // Copy if ($USER->CanDoFileOperation('fm_view_file', $arPath) && ($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($f_NAME) || substr($Elem["NAME"], 0, 1) == ".")) && $Elem["TYPE"] == "F" || $Elem["TYPE"] == "D" && $USER->CanDoFileOperation('fm_view_listing', $arPath)) { $arActions[] = array("ICON" => "copy", "TEXT" => GetMessage("FILEMAN_ADM_COPY"), "ACTION" => "window.CopyMoveRun([{'path' : '" . CUtil::JSEscape($fpath) . "', 'isDir' : '" . $arrIsDir[$fpath] . "'}], true); return false;"); } // Move if ($USER->CanDoOperation('fileman_admin_folders') && $USER->CanDoFileOperation('fm_delete_' . $type, $arPath)) { if ($USER->CanDoFileOperation('fm_view_file', $arPath) && ($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($f_NAME) || substr($Elem["NAME"], 0, 1) == ".")) && $Elem["TYPE"] == "F" || $Elem["TYPE"] == "D" && $USER->CanDoFileOperation('fm_view_listing', $arPath)) { $arActions[] = array("ICON" => "move", "TEXT" => GetMessage("FILEMAN_ADM_MOVE"), "ACTION" => "window.CopyMoveRun([{'path' : '" . CUtil::JSEscape($fpath) . "', 'isDir' : '" . $arrIsDir[$fpath] . "'}], false); return false;"); } $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("FILEMAN_ADMIN_DELETE"), "ACTION" => "if(confirm('" . GetMessage('FILEMAN_ALERT_DELETE') . "')) " . $lAdmin->ActionDoGroup(urlencode($f_NAME), "delete", $addUrl . "&site=" . urlencode($site) . "&path=" . urlencode($path) . "&show_perms_for=" . IntVal($show_perms_for))); } if ($USER->CanDoFileOperation('fm_edit_permission', $arPath)) { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "access", "TEXT" => GetMessage("FILEMAN_ADMIN_ACCESS_PERMS_B"), "ACTION" => "setCheckbox('" . Cutil::JSEscape($f_NAME) . "'); setAccess('" . Cutil::JSEscape($site) . "', '" . Cutil::JSEscape(urlencode($path)) . "');");
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_popup_admin.php"; $io = CBXVirtualIo::GetInstance(); $site = CFileMan::__CheckSite($site); $DOC_ROOT = CSite::GetSiteDocRoot($site); $path = $io->CombinePath("/", $path); $arParsedPath = CFileMan::ParsePath(array($site, $path), true); $abs_path = $DOC_ROOT . $path; $arPath = array($site, $path); $bUploaded = false; $file_name = ""; $strWarning = ""; if ($REQUEST_METHOD == "POST" && strlen($saveimg) > 0 && check_bitrix_sessid()) { if (!$USER->CanDoOperation('fileman_edit_existent_files') || !$USER->CanDoFileOperation('fm_edit_existent_file', $arPath)) { $strWarning = GetMessage('FILEMAN_CAN_NOT_WRITE') . "<br>"; } else { $file_name = CFileman::GetFileName($newfilename); if (strlen($file_name) <= 0 || $file_name == "none") { continue; } if (!$USER->IsAdmin() && (in_array(CFileman::GetFileExtension($file_name), CFileMan::GetScriptFileExt()) || $file_name[0] == ".")) { $strWarning .= GetMessage("FILEMAN_UPLOAD_BAD_TYPE") . "\n"; } elseif ($io->FileExists($abs_path . "/" . $file_name)) { $strWarning = GetMessage("FILEMAN_FILE_EXIST") . "<br>"; } else { if ($io->Copy($_FILES["imagefile"]["tmp_name"], $abs_path . "/" . $file_name)) { $bUploaded = true; $f = $io->GetFile($abs_path . "/" . $file_name); $f->MarkWritable(); } } }
$showFieldText = GetMessage("FILEMAN_ADMIN_MENU_TYPE") . "«" . htmlspecialcharsbx($regs[1]) . "»"; } else { $showFieldIcon = "<IMG SRC=\"/bitrix/images/fileman/types/" . $curFileType . ".gif\" WIDTH=\"16\" HEIGHT=\"16\" BORDER=0 ALT=\"\">"; $showFieldText = $f_NAME; } } $showField = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td align=\"left\">" . $showFieldIcon . "</td><td align=\"left\"> " . $showFieldText . "</td></tr></table>"; $row =& $lAdmin->AddRow($f_NAME, $Elem); if ($row->VarsFromForm() && $_REQUEST["FIELDS"]) { $val = $_REQUEST["FIELDS"][$f_NAME]["NAME"]; } else { $val = $f_NAME; } // In the search result mode - we will give to modify only name of files or folders if ($bSearch) { $val = CFileman::GetFileName($val); } //$editField = "<input type=\"text\" name=\"FIELDS[".$f_NAME."][NAME]\" value=\"".htmlspecialcharsbx($val)."\" size=\"40\"> "; if ($logical == 'Y') { $row->AddField("NAME", $showField); } else { //$row->AddField("NAME", $showField, $editField); $row->AddViewField("NAME", $showField); $row->AddInputField("NAME", array('size' => '40', name => 'FIELDS[' . $f_NAME . '][NAME]', 'value' => htmlspecialcharsbx($val))); } if ($logical == 'Y') { $showFieldIcon = ""; $showFieldText = ""; if (strlen($f_LOGIC_NAME) <= 0) { $f_LOGIC_NAME = htmlspecialcharsbx(GetMessage("FILEMAN_ADM_UNTITLED")); }
{ $newfilename = $filename[$ind]; if(strlen($newfilename)<=0) { $strWarning .= GetMessage("FILEMAN_RENAME_NEW_NAME")." \"".$file."\"!\n"; } elseif (($mess = CFileMan::CheckFileName($newfilename)) !== true) { $strWarning = $mess; } else { $pathto = Rel2Abs($path, $newfilename); if(!$USER->CanDoFileOperation('fm_create_new_file',Array($site, $pathto))) $strWarning .= GetMessage("FILEMAN_RENAME_ACCESS_ERROR")."\n"; elseif(!$USER->CanDoOperation('edit_php') && (substr(CFileman::GetFileName($file), 0, 1) == "." || substr(CFileman::GetFileName($pathto), 0, 1)=="." || (!HasScriptExtension($file) && HasScriptExtension($pathto)))) // if not admin and renaming from non PHP to PHP $strWarning .= GetMessage("FILEMAN_RENAME_TOPHPFILE_ERROR")."\n"; elseif(!$USER->CanDoOperation('edit_php') && HasScriptExtension($file) && !HasScriptExtension($pathto)) // if not admin and renaming from PHP to non PHP $strWarning .= GetMessage("FILEMAN_RENAME_FROMPHPFILE_ERROR")."\n"; else { $pathparsedtmp = CFileMan::ParsePath(Array($site, $pathto), false, false, "", $logical == "Y"); $strWarningTmp = CFileMan::CreateDir($pathparsedtmp["PREV"]); if(strlen($strWarningTmp)>0) $strWarning .= $strWarningTmp; else { if(!$io->FileExists($DOC_ROOT.$path."/".$file)) $strWarning .= GetMessage("FILEMAN_RENAME_FILE")." \"".$path."/".$file."\" ".GetMessage("FILEMAN_RENAME_NOT_FOUND")."!\n"; elseif(!$io->Rename($DOC_ROOT.$path."/".$file, $DOC_ROOT.$pathto))
$arFile["name"] = CFileman::GetFileName($arFile["name"]); $filename = ${"filename_" . $i}; if (strlen($filename) <= 0) { $filename = $arFile["name"]; } $pathto = Rel2Abs($path, $filename); if (!$USER->CanDoFileOperation('fm_upload_file', array($site, $pathto))) { $strWarning .= GetMessage("FILEMAN_FILEUPLOAD_ACCESS_DENIED") . " \"" . $pathto . "\"\n"; } elseif ($arFile["error"] == 1 || $arFile["error"] == 2) { $strWarning .= GetMessage("FILEMAN_FILEUPLOAD_SIZE_ERROR", array('#FILE_NAME#' => $pathto)) . "\n"; } elseif (($mess = CFileMan::CheckFileName(str_replace('/', '', $pathto))) !== true) { $strWarning .= $mess . ".\n"; } else { if ($io->FileExists($DOC_ROOT . $pathto)) { $strWarning .= GetMessage("FILEMAN_FILEUPLOAD_FILE_EXISTS1") . " \"" . $pathto . "\" " . GetMessage("FILEMAN_FILEUPLOAD_FILE_EXISTS2") . ".\n"; } elseif (!$USER->IsAdmin() && (HasScriptExtension($pathto) || substr(CFileman::GetFileName($pathto), 0, 1) == ".")) { $strWarning .= GetMessage("FILEMAN_FILEUPLOAD_PHPERROR") . " \"" . $pathto . "\".\n"; } else { $bQuota = true; if (COption::GetOptionInt("main", "disk_space") > 0) { $f = $io->GetFile($arFile["tmp_name"]); $bQuota = false; $size = $f->GetFileSize(); $quota = new CDiskQuota(); if ($quota->checkDiskQuota(array("FILE_SIZE" => $size))) { $bQuota = true; } } if ($bQuota) { if (!$io->Copy($arFile["tmp_name"], $DOC_ROOT . $pathto)) { $strWarning .= GetMessage("FILEMAN_FILEUPLOAD_FILE_CREATE_ERROR") . " \"" . $pathto . "\"\n";