- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/file_dialog.php
- Класс: CAdminFileDialog
- Вызов: CAdminFileDialog::Remove
static function Remove($Params)
{
global $USER, $APPLICATION;
$path = $site = '';
if(CModule::IncludeModule("fileman"))
{
$io = CBXVirtualIo::GetInstance();
$path = Rel2Abs("/", $APPLICATION->UnJSEscape($Params['path']));
$path = CFileMan::SecurePathVar($path);
$site = $Params['site'];
$arPath = Array($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$abs_path = $DOC_ROOT.$path;
$strWarning = '';
$type = false;
if ($io->DirectoryExists($abs_path))
$type = 'folder';
if ($io->FileExists($abs_path))
$type = 'file';
//Check access to folder or file
if (!$type) // Not found
$strWarning = GetMessage("FD_ELEMENT_NOT_FOUND", array('#PATH#' => addslashes(htmlspecialcharsbx($path))));
elseif (!$USER->CanDoFileOperation('fm_delete_'.$type, $arPath)) // Access denied
$strWarning = GetMessage("ACCESS_DENIED");
else // Ok, delete it!
$strWarning = CFileMan::DeleteEx($path);
}
else
{
$strWarning = GetMessage("BX_FD_NO_FILEMAN");
}
self::EchoActionStatus($strWarning);
if ($strWarning == '')
{
// get parent dir path and load content
$parPath = mb_substr($path, 0, mb_strrpos($path, '/'));
self::LoadItems(array('path' => $parPath, 'site' => $site, 'bAddToMenu' => $Params['bAddToMenu'], 'loadRecursively' => false, 'getFiles' => $Params['getFiles']));
}
}