- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/file_dialog.php
- Класс: CAdminFileDialog
- Вызов: CAdminFileDialog::MakeNewDir
static function MakeNewDir($Params)
{
global $USER, $APPLICATION;
$io = CBXVirtualIo::GetInstance();
$path = $io->CombinePath("/", $APPLICATION->UnJSEscape($Params['path']));
$site = $Params['site'];
if(CModule::IncludeModule("fileman"))
{
$arPath = Array($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$abs_path = $DOC_ROOT.$path;
$dirname = str_replace("/", "_", $APPLICATION->UnJSEscape($Params['name']));
$strWarning = '';
//Check access to folder
if (!$USER->CanDoFileOperation('fm_create_new_folder', $arPath))
{
$strWarning = GetMessage("ACCESS_DENIED");
}
elseif(!$io->DirectoryExists($abs_path))
{
$strWarning = GetMessage("FD_FOLDER_NOT_FOUND", array('#PATH#' => addslashes(htmlspecialcharsbx($path))));
}
else
{
if ($dirname <> '' && ($mess = self::CheckFileName($dirname)) !== true)
{
$strWarning = $mess;
}
elseif($dirname == '')
{
$strWarning = GetMessage("FD_NEWFOLDER_ENTER_NAME");
}
else
{
$pathto = Rel2Abs($path, $dirname);
if($io->DirectoryExists($DOC_ROOT.$pathto))
$strWarning = GetMessage("FD_NEWFOLDER_EXISTS");
else
$strWarning = CFileMan::CreateDir(Array($site, $pathto));
}
}
}
else
{
$strWarning = GetMessage("BX_FD_NO_FILEMAN");
}
self::EchoActionStatus($strWarning);
if ($strWarning == '')
self::LoadItems(array('path' => $path, 'site' => $site, 'bAddToMenu' => $Params['bAddToMenu'], 'loadRecursively' => false, 'getFiles' => $Params['getFiles']));
}