CanDoOperation('fileman_admin_files') || $USER->CanDoOperation('fileman_edit_existent_files'))) $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); Loader::includeModule('fileman'); IncludeModuleLangFile(__FILE__); $request = Context::getCurrent()->getRequest(); $strWarning = ""; $addUrl = 'lang='.LANGUAGE_ID.($logical == "Y"?'&logical=Y':''); $io = CBXVirtualIo::GetInstance(); $path = (string)($request->get('path') ?? ''); $path = $io->CombinePath("/", $path); $bVarsFromForm = false; //flag, witch points were get content from: file or post form if ($filename <> '' && ($mess = CFileMan::CheckFileName($filename)) !== true) { $filename2 = $filename; $filename = ''; $strWarning = $mess; $bVarsFromForm = true; } //if new file & sets new name if($new <> '' && $filename <> '') $path = $path."/".$filename; // let's set this new name to us path $site = CFileMan::__CheckSite($site); if(!$site) $site = CSite::GetSiteByFullPath($_SERVER["DOCUMENT_ROOT"].$path); $DOC_ROOT = CSite::GetSiteDocRoot($site); $abs_path = $DOC_ROOT.$path; $arPath = Array($site, $path); if (!($USER->CanDoOperation('fileman_admin_files') || $USER->CanDoOperation('fileman_edit_existent_files') || $USER->CanDoFileOperation('fm_view_file', $arPath))) $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); $site_template = false; $rsSiteTemplates = CSite::GetTemplateList($site); while($arSiteTemplate = $rsSiteTemplates->Fetch()) { if($arSiteTemplate["CONDITION"] == '') { $site_template = $arSiteTemplate["TEMPLATE"]; break; } } if(($new == '' || $filename == '') && !$io->FileExists($abs_path)) { $p = mb_strrpos($path, "/"); if($p!==false) { $new = "Y"; $filename = mb_substr($path, $p + 1); //$path = substr($path, 0, $p); //$abs_path = $DOC_ROOT.$path; } } $originalPath = $path; $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); $only_read = false; $arPath = Array($site, $path); if(($new <> '' && !($USER->CanDoOperation('fileman_admin_files') && $USER->CanDoFileOperation('fm_create_new_file',$arPath))) || ($new == '' && (!$USER->CanDoOperation('fileman_edit_existent_files') || !$USER->CanDoFileOperation('fm_edit_existent_file',$arPath) || !$USER->CanDoFileOperation('fm_view_file',$arPath)))) { $strWarning = GetMessage("ACCESS_DENIED"); } else { if ($new == "" && $USER->CanDoFileOperation('fm_view_file',$arPath) && !$USER->CanDoFileOperation('fm_edit_existent_file',$arPath)) $only_read = true; if($new <> '' && $filename <> '' && $io->FileExists($abs_path)) // if we want to make new file , but the file with the same name alredy exist, let's abuse { $strWarning = GetMessage("FILEMAN_FILEEDIT_FILE_EXISTS")." "; $bEdit = false; ?>