require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php"); require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/fileman/prolog.php"); if (!($USER->CanDoOperation('fileman_edit_existent_folders') || $USER->CanDoOperation('fileman_admin_folders'))) $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/fileman/include.php"); IncludeModuleLangFile(__FILE__); ClearVars("g_"); $ind=0; $strWarning = ""; $strNotice = ""; $addUrl = 'lang='.LANGUAGE_ID.($logical == "Y"?'&logical=Y':''); $io = CBXVirtualIo::GetInstance(); $site = CFileMan::__CheckSite($site); $DOC_ROOT = CSite::GetSiteDocRoot($site); $path = $io->CombinePath("/", $path); $arParsedPath = CFileMan::ParsePath(Array($site, $path), true, false, "", $logical == "Y"); $abs_path = $DOC_ROOT.$path; $arPath = Array($site, $path); // let's check rights on this folder if(!$USER->CanDoFileOperation('fm_edit_existent_folder',$arPath)) $strWarning = GetMessage("ACCESS_DENIED"); else if(!$io->DirectoryExists($abs_path)) $strWarning = GetMessage("FILEMAN_FOLDER_NOT_FOUND"); else { function GetAccessArrTmp($path) { global $DOC_ROOT; $io = CBXVirtualIo::GetInstance(); if($io->DirectoryExists($DOC_ROOT.$path)) { @include($io->GetPhysicalName($DOC_ROOT.$path."/.access.php")); return $PERM; } return Array(); } // let's get array of access rights for whole folder $CUR_PERM = GetAccessArrTmp($arParsedPath["PREV"]); if($REQUEST_METHOD=="POST" && $save <> '' && $propeditmore == '' && check_bitrix_sessid()) { $bNeedSectionFile = False; $strSectionName = ""; if($sectionname <> '') { $strSectionName = "\$sSectionName = \"".CFileMan::EscapePHPString($sectionname)."\";\n"; $bNeedSectionFile = True; } $strDirProperties = "\$arDirProperties = array(\n"; $numpropsvals = intval($numpropsvals); $bNeedComma = False; for($i = 0; $i<$numpropsvals; $i++) { if(Trim($_POST["CODE_".$i]) <> '' && Trim($_POST["VALUE_".$i]) <> '') { if($bNeedComma) $strDirProperties .= ",\n"; $strDirProperties .= " \"".CFileMan::EscapePHPString(Trim($_POST["CODE_".$i]))."\" => \"".CFileMan::EscapePHPString(Trim($_POST["VALUE_".$i]))."\""; $bNeedComma = True; $bNeedSectionFile = True; } } $strDirProperties .= "\n);\n"; if($bNeedSectionFile) $APPLICATION->SaveFileContent($DOC_ROOT.$path."/.section.php", "<"."?\n".$strSectionName.$strDirProperties."?".">"); else CFileman::DeleteFile(Array($site, $path."/.section.php")); if($USER->CanDoFileOperation('fm_edit_permission',$arPath)) { $arPermissions=Array(); $db_groups = CGroup::GetList("sort", "asc"); while($arGroup = $db_groups->Fetch()) { $gperm = isset($_POST["g_".$arGroup["ID"]]) ? $_POST["g_".$arGroup["ID"]] : ''; if (!isset($gperm)) { if($path=="") $gperm = $CUR_PERM["/"][$arGroup['ID']]; else $gperm = $CUR_PERM[$arParsedPath["LAST"]][$arGroup['ID']]; } else { if ($gperm == 'NOT_REF') $gperm = ''; if (intval($gperm) > 0) { $z = CTask::GetById($gperm); $r = $z->Fetch(); if ($r && $r['LETTER'] && $r['SYS'] == 'Y') $gperm = $r['LETTER']; else $gperm = 'T_'.$gperm; } } $arPermissions[$arGroup["ID"]] = $gperm; } //$gperm = $g_ALL; $gperm = $_POST['g_ALL']; if ($gperm == 'NOT_REF') $gperm = ''; if (intval($gperm) > 0) { $z = CTask::GetById($gperm); $r = $z->Fetch(); if ($r && $r['LETTER'] && $r['SYS'] == 'Y') $gperm = $r['LETTER']; else $gperm = 'T_'.$gperm; } $arPermissions["*"] = $gperm; $APPLICATION->SetFileAccessPermission(Array($site, $path), $arPermissions); } if ($e = $APPLICATION->GetException()) $strNotice = $e->msg; else { if($apply == '') { if($back_url <> '') LocalRedirect("/".ltrim($back_url, "/")); else LocalRedirect("/bitrix/admin/fileman_admin.php?".$addUrl."&site=".$site."&path=".UrlEncode($path)); } else LocalRedirect("/bitrix/admin/fileman_folder.php?".$addUrl."&site=".$site."&path=".UrlEncode($path)); } } } if($propeditmore <> '') $bInitVars = True; foreach ($arParsedPath["AR_PATH"] as $chainLevel) { $adminChain->AddItem( array( "TEXT" => htmlspecialcharsex($chainLevel["TITLE"]), "LINK" => (($chainLevel["LINK"] <> '') ? $chainLevel["LINK"] : ""), ) ); } $APPLICATION->SetTitle(GetMessage("FILEMAN_FOLDER_TITLE")); require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php"); $aMenu = array( array( "TEXT" => GetMessage("FILEMAN_FOLDER_BACK"), "LINK" => "fileman_admin.php?".$addUrl."&site=".$site."&path=".UrlEncode($path), "ICON" => "btn_list" ) ); $context = new CAdminContextMenu($aMenu); $context->Show(); ?> if($strWarning == ''): $sectionname = ""; $arDirProperties = false; $sSectionName = ""; if($io->FileExists($abs_path."/.section.php")) { @include($io->GetPhysicalName($abs_path."/.section.php")); $f_SECTIONNAME = $sSectionName; } if($bInitVars) { $f_SECTIONNAME = $_POST["sectionname"]; } ?>