<? require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_before.php"); require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_admin_js.php"); /** @global CUser $USER */ global $USER; /** @global CCacheManager $CACHE_MANAGER */ global $CACHE_MANAGER; if(!$USER->CanDoOperation('cache_control') || !check_freetrix_sessid()) die(GetMessage("ACCESS_DENIED")); if($_GET["site_id"] == '') die("Empty site_id."); $sites = CSite::GetByID($_GET["site_id"]); if(!($site = $sites->Fetch())) die("Incorrect site_id."); $aComponents = explode(",", $_GET["component_name"]); foreach($aComponents as $component_name) { CFreetrixComponent::clearComponentCache($component_name, $site["ID"]); } require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_admin_js.php"); ?>
function RemoveFileAccessPermission($path, $arGroups = false) { global $CACHE_MANAGER; CMain::InitPathVars($site, $path); $DOC_ROOT = CSite::GetSiteDocRoot($site); $path = rtrim($path, "/"); if ($path == '') { $path = "/"; } if (($p = bxstrrpos($path, "/")) !== false) { $path_file = substr($path, $p + 1); $path_dir = substr($path, 0, $p); } else { return false; } $PERM = array(); $io = CBXVirtualIo::GetInstance(); if (!$io->FileExists($DOC_ROOT . $path_dir . "/.access.php")) { return true; } include $io->GetPhysicalName($DOC_ROOT . $path_dir . "/.access.php"); $str = "<?\n"; foreach ($PERM as $file => $arPerm) { if ($file != $path_file || $arGroups !== false) { foreach ($arPerm as $group => $perm) { $bExists = false; if ($arGroups !== false) { //compatibility with group id if (in_array($group, $arGroups)) { $bExists = true; } elseif (preg_match('/^G[0-9]+$/', $group) && in_array(substr($group, 1), $arGroups)) { $bExists = true; } elseif (preg_match('/^[0-9]+$/', $group) && in_array('G' . $group, $arGroups)) { $bExists = true; } } if ($file != $path_file || $arGroups !== false && !$bExists) { $str .= "\$PERM[\"" . EscapePHPString($file) . "\"][\"" . EscapePHPString($group) . "\"]=\"" . EscapePHPString($perm) . "\";\n"; } } } } $str .= "?" . ">"; $this->SaveFileContent($DOC_ROOT . $path_dir . "/.access.php", $str); $CACHE_MANAGER->CleanDir("menu"); CFreetrixComponent::clearComponentCache("freetrix:menu"); unset($this->FILE_PERMISSION_CACHE[$site . "|" . $path_dir . "/.access.php"]); foreach (GetModuleEvents("main", "OnChangePermissions", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array(array($site, $path), array())); } return true; }