CanDoOperation('edit_php'))) $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); CUtil::JSPostUnescape(); $obJSPopup = new CJSPopup(); require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/fileman/include.php"); IncludeModuleLangFile(__FILE__); $strWarning = ""; $io = CBXVirtualIo::GetInstance(); $bVarsFromForm = false; if ($filename <> '' && ($mess = CFileMan::CheckFileName($filename)) !== true) { $filename2 = $filename; $filename = ''; $strWarning = $mess; $bVarsFromForm = true; } if (CAutoSave::Allowed()) $AUTOSAVE = new CAutoSave(); $path = $io->CombinePath("/", urldecode($path)); $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); if($new <> '' && $filename <> '') $abs_path = $io->CombinePath($abs_path, $filename); if(($new == '' || $filename == '') && !$io->FileExists($abs_path)) { $p = mb_strrpos($path, "/"); if($p!==false) { $new = "Y"; $filename = mb_substr($path, $p + 1); $path = mb_substr($path, 0, $p); } } if($new <> '' && $filename <> '' && ($io->FileExists($abs_path) || $io->DirectoryExists($abs_path))) // если мы хотим создать новый файл, но уже такой есть - ругаемся { $strWarning = GetMessage("FILEMAN_FILEEDIT_FILE_EXISTS")." "; $bEdit = false; $bVarsFromForm = true; } elseif($new <> '') { if ($filename == '') $strWarning = GetMessage("FILEMAN_FILEEDIT_FILENAME_EMPTY")." "; $bEdit = false; } else { if(!$io->FileExists($abs_path)) $strWarning = GetMessage("FILEMAN_FILEEDIT_FOLDER_EXISTS")." "; else $bEdit = true; } if($strWarning == '') { if($bEdit) { $f = $io->GetFile($abs_path); $filesrc_tmp = $f->GetContents(); } else { $site_template = false; $rsSiteTemplates = CSite::GetTemplateList($site); while($arSiteTemplate = $rsSiteTemplates->Fetch()) { if($arSiteTemplate["CONDITION"] == '') { $site_template = $arSiteTemplate["TEMPLATE"]; break; } } $arTemplates = CFileman::GetFileTemplates(LANGUAGE_ID, array($site_template)); if($template <> '') { for ($i=0; $i '') { if(!check_bitrix_sessid()) { $strWarning = GetMessage("FILEMAN_SESSION_EXPIRED"); $bVarsFromForm = true; } // lpa was denied earlier, so use file src as is $filesrc_for_save = $_POST['filesrc']; if($strWarning == '') { if (!CFileMan::CheckOnAllowedComponents($filesrc_for_save)) { $str_err = $APPLICATION->GetException(); if($str_err && ($err = $str_err ->GetString())) $strWarning .= $err; $bVarsFromForm = true; } } if($strWarning == '') { $f = $io->GetFile($abs_path); $arUndoParams = array( 'module' => 'fileman', 'undoType' => 'edit_file', 'undoHandler' => 'CFileman::UndoEditFile', 'arContent' => array( 'absPath' => $abs_path, 'content' => $f->GetContents() ) ); if(!$APPLICATION->SaveFileContent($abs_path, $filesrc_for_save)) { if (($str_err = $APPLICATION->GetException())) { if (($err = $str_err->GetString())) { $strWarning = $err; } $bVarsFromForm = true; } if (empty($strWarning)) { $strWarning = GetMessage("pub_src_edit_err"); } } else { $bEdit = true; CUndo::ShowUndoMessage(CUndo::Add($arUndoParams)); $module_id = "fileman"; if(COption::GetOptionString($module_id, "log_page", "Y")=="Y") { $res_log['path'] = mb_substr($path, 1); CEventLog::Log( "content", "PAGE_EDIT", "main", "", serialize($res_log), $_REQUEST["site"] ); } if (CAutoSave::Allowed()) $AUTOSAVE->Reset(); } if($strWarning == '') { ?>