. */ namespace Fisharebest\Webtrees; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Module\AbstractModule; use Fisharebest\Webtrees\Module\ModuleBlockInterface; use Fisharebest\Webtrees\Module\ModuleChartInterface; use Fisharebest\Webtrees\Module\ModuleConfigInterface; use Fisharebest\Webtrees\Module\ModuleMenuInterface; use Fisharebest\Webtrees\Module\ModuleReportInterface; use Fisharebest\Webtrees\Module\ModuleSidebarInterface; use Fisharebest\Webtrees\Module\ModuleTabInterface; use Fisharebest\Webtrees\Module\ModuleThemeInterface; define('WT_SCRIPT_NAME', 'admin_modules.php'); require 'includes/session.php'; $controller = new PageController; $controller ->restrictAccess(Auth::isAdmin()) ->setPageTitle(I18N::translate('Module administration')); $modules = Module::getInstalledModules('disabled'); $module_status = Database::prepare("SELECT module_name, status FROM `##module`")->fetchAssoc(); uasort($modules, function (AbstractModule $x, AbstractModule $y) { return I18N::strcasecmp($x->getTitle(), $y->getTitle()); }); if (Filter::post('action') === 'update_mods' && Filter::checkCsrf()) { foreach ($modules as $module) { $new_status = Filter::post('status-' . $module->getName(), '[01]'); if ($new_status !== null) { $new_status = $new_status ? 'enabled' : 'disabled'; $old_status = $module_status[$module->getName()]; if ($new_status !== $old_status) { Database::prepare("UPDATE `##module` SET status=? WHERE module_name=?")->execute(array($new_status, $module->getName())); if ($new_status === 'disabled') { FlashMessages::addMessage(I18N::translate('The module “%s” has been disabled.', $module->getTitle()), 'success'); } else { FlashMessages::addMessage(I18N::translate('The module “%s” has been enabled.', $module->getTitle()), 'success'); } } } } header('Location: ' . WT_BASE_URL . 'admin_modules.php'); return; } if (Filter::post('action') === 'delete' && Filter::checkCsrf()) { $module_name = Filter::post('module_name'); Database::prepare( "DELETE `##block_setting`" . " FROM `##block_setting`" . " JOIN `##block` USING (block_id)" . " JOIN `##module` USING (module_name)" . " WHERE module_name=?" )->execute(array($module_name)); Database::prepare( "DELETE `##block`" . " FROM `##block`" . " JOIN `##module` USING (module_name)" . " WHERE module_name=?" )->execute(array($module_name)); Database::prepare("DELETE FROM `##module_setting` WHERE module_name=?")->execute(array($module_name)); Database::prepare("DELETE FROM `##module_privacy` WHERE module_name=?")->execute(array($module_name)); Database::prepare("DELETE FROM `##module` WHERE module_name=?")->execute(array($module_name)); FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been deleted.', $module_name), 'success'); header('Location: ' . WT_BASE_URL . 'admin_modules.php'); return; } // The module can’t be found on disk? // Don't delete it automatically. It may be temporarily missing, after a re-installation, etc. foreach ($module_status as $module_name => $status) { if (!array_key_exists($module_name, $modules)) { $html = I18N::translate('Preferences exist for the module “%s”, but this module no longer exists.', '' . $module_name . '') . '
' . Filter::getCsrf() . '' . '' . '' . '
'; FlashMessages::addMessage($html, 'warning'); } } $controller ->pageHeader() ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) ->addInlineJavascript(' function reindexMods(id) { jQuery("#" + id + " input").each( function (index, value) { value.value = index+1; }); } jQuery("#installed_table").dataTable( { paging: false, ' . I18N::datatablesI18N() . ', sorting: [[ 1, "asc" ]], columns : [ { sortable: false, class: "center" }, null, null, { class: "center" }, { class: "center" }, { class: "center" }, { class: "center" }, { class: "center" }, { class: "center" }, { class: "center", visible: false } // The Module system does not yet include themes ] }); '); ?>

getPageTitle(); ?>

$module): ?>
getName(), $module_status[$module_name] === 'enabled') ?> getTitle() ?> getTitle() ?> getName(), Module::getCoreModuleNames())): ?>
getDescription() ?> getName(), Module::getCoreModuleNames())): ?>
- -