. */ namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Module\ModuleConfigInterface; define('WT_SCRIPT_NAME', 'admin_module_blocks.php'); require 'includes/session.php'; $controller = new PageController; $controller ->restrictAccess(Auth::isAdmin()) ->setPageTitle(I18N::translate('Blocks')); $action = Filter::post('action'); $modules = Module::getAllModulesByComponent('block'); if ($action === 'update_mods' && Filter::checkCsrf()) { foreach ($modules as $module) { foreach (Tree::getAll() as $tree) { $access_level = Filter::post('access-' . $module->getName() . '-' . $tree->getTreeId(), WT_REGEX_INTEGER, $module->defaultAccessLevel()); Database::prepare( "REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'block', ?)" )->execute(array($module->getName(), $tree->getTreeId(), $access_level)); } } header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); return; } $controller ->pageHeader(); ?>