Skip to content
Snippets Groups Projects
Commit 99f64cd0 authored by Tim Steiner's avatar Tim Steiner
Browse files

[gh-382] Merge branch 'issue-382' into develop

parents 04b71e5f 31bc6d8b
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,29 @@ function unl_config($form, &$form_state) {
'#type' => 'submit',
'#value' => 'Update',
);
// Grab a list of available modules (active or not).
// Based on system_modules() from modules/system.admin.inc.
$files = system_rebuild_module_data();
require_once DRUPAL_ROOT . '/modules/system/system.admin.inc';
uasort($files, 'system_sort_modules_by_info_name');
$modules = array();
foreach ($files as $filename => $file) {
if (!empty($file->info['hidden'])) {
continue;
}
$modules[$filename] = $file->info['name'];
}
$form['root']['module_whitelist'] = array(
'#type' => 'select',
'#title' => 'Module White List (Global)',
'#multiple' => TRUE,
'#options' => $modules,
'#size' => 15,
'#default_value' => unl_shared_variable_get('unl_module_whitelist', array()),
);
return $form;
}
......@@ -47,4 +70,5 @@ function unl_config_submit($form, &$form_state) {
if (class_exists('Tidy')) {
variable_set('unl_tidy', $form_state['values']['root']['unl_tidy']);
}
variable_set('unl_module_whitelist', $form_state['values']['root']['module_whitelist']);
}
......@@ -376,3 +376,16 @@ function unl_update_7111() {
db_add_unique_key('unl_sites', 'uri', array('uri'));
db_add_unique_key('unl_sites', 'db_prefix', array('db_prefix'));
}
/**
* Add the hard-coded white list as the default whitelist.
*/
function unl_update_7112() {
$modules = array(
'aggregator', 'blog', 'book', 'comment', 'translation', 'dashboard', 'forum', 'help', 'list', 'locale', 'number', 'taxonomy', 'trigger', // Core on this line, Contrib below
'action_email_role', 'context', 'context_layouts', 'context_ui', 'features', 'unl_news', 'imce', 'imce_mkdir', 'imce_rename', 'menu_block', 'menu_block_export',
'form_builder', 'form_builder_webform_ui', 'webform', 'webform_alt_ui',
'workbench', 'workbench_access', 'workbench_files', 'workbench_media', 'workbench_moderation'
);
unl_shared_variable_set('unl_module_whitelist', $modules);
}
......@@ -620,10 +620,7 @@ function unl_form_field_ui_display_overview_form_alter(&$form, &$form_state, $fo
*/
function unl_form_system_modules_alter(&$form, &$form_state, $form_id) {
// Whitelist of modules that Site Admin are allowed to turn on and off on admin/modules
$modules = array('aggregator', 'blog', 'book', 'comment', 'translation', 'dashboard', 'forum', 'help', 'list', 'locale', 'number', 'taxonomy', 'trigger', // Core on this line, Contrib below
'action_email_role', 'context', 'context_layouts', 'context_ui', 'features', 'unl_news', 'imce', 'imce_mkdir', 'imce_rename', 'menu_block', 'menu_block_export',
'form_builder', 'form_builder_webform_ui', 'webform', 'webform_alt_ui',
'workbench', 'workbench_access', 'workbench_files', 'workbench_media', 'workbench_moderation');
$modules = unl_shared_variable_get('unl_module_whitelist', array());
if (!unl_user_is_administrator() && isset($form['modules'])) {
foreach ($form['modules'] as $category_name => $category) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment