function encrypt_admin_settings in Encrypt 7
Same name and namespace in other branches
- 6 includes/encrypt.admin.inc \encrypt_admin_settings()
- 7.3 includes/encrypt.admin.inc \encrypt_admin_settings()
- 7.2 includes/encrypt.admin.inc \encrypt_admin_settings()
Menu callback; displays the encrypt module settings page.
See also
1 string reference to 'encrypt_admin_settings'
- encrypt_menu in ./
encrypt.module - Implementation of hook_menu().
File
- includes/
encrypt.admin.inc, line 15 - This file holds the functions for the encrypt Admin settings.
Code
function encrypt_admin_settings() {
// Initialize to just see if any funny business is going on
encrypt_initialize();
// Run requirements (include install file first)
module_load_install('encrypt');
$requirements = encrypt_requirements('runtime');
// Get formatted methods
$methods = theme('encrypt_admin_list', encrypt_get_methods('full', TRUE));
$text = 'Jake sucks';
// Define Form
$form['encrypt_default_method'] = array(
'#type' => 'radios',
'#title' => t('Default Encrypt Method'),
'#description' => t('Define the default encryption method for the site. Since encryption methods are stored with the data, this can be changed even after you have stored encrypted data.'),
'#options' => $methods,
'#default_value' => variable_get('encrypt_default_method', ENCRYPT_DEFAULT_METHOD),
'#attached' => array(
'css' => array(
drupal_get_path('module', 'encrypt') . '/encrypt.css',
),
),
);
// Check if key exists and put a checkbox to ensure the user does want to update the box.
if ($requirements['encrypt_keys']['severity'] == REQUIREMENT_OK) {
$form['encrypt_update_key'] = array(
'#type' => 'checkbox',
'#title' => t('Change Key Path'),
'#description' => t('Check this if you are sure you want to change the location of the key file. If you change the key after the data has been encrypted with it, you will not be able to retrieve that data. You can copy your key to a new directory and then set the new directory.'),
'#default_value' => FALSE,
);
}
// Path for keys
$form['encrypt_secure_key_path'] = array(
'#type' => 'textfield',
'#title' => t('Secure Key Path'),
'#description' => t('Use a full absolute path to a directory where the webserver can create a secure key file for encryption.'),
'#maxlength' => 512,
'#default_value' => variable_get('encrypt_secure_key_path', ''),
);
// Give some help if keys are not found
if ($requirements['encrypt_keys']['severity'] == REQUIREMENT_ERROR) {
// Let user know that key is not secure
drupal_set_message(t('A problem was found with your secure key.') . ' ' . $requirements['encrypt_keys']['value'], 'warning');
}
else {
// Key secure
drupal_set_message(t('Key found and in secure place.'));
}
// Add submit handler
$form['#submit'][] = 'encrypt_admin_settings_submit_handler';
// Make a system setting form and return
return system_settings_form($form);
}