'radios', '#title' => t('Default Method'), '#description' => t('Define the default encryption method for the site. Since encryption methods are stored with strings, this can be changed even after you have stored encrypted data.'), '#options' => $methods, '#default_value' => variable_get('encrypt_default_method', ENCRYPT_DEFAULT_METHOD), ); // Give some help if keys are not found if ($requirements['encrypt_keys']['severity'] == REQUIREMENT_ERROR) { // Create a default key $key = md5(uniqid(mt_rand(0, mt_rand()), TRUE)) . md5(uniqid(mt_rand(0, mt_rand()), TRUE)); // Create output $add_security = "/**\n"; $add_security .= " * The following is an array of keys for the Encrypt module.\n"; $add_security .= " * These are used to encrypt data. If these are changed after\n"; $add_security .= " * they have been used to encode data, that data will not be\n"; $add_security .= " * retrievable. You can always add new keys, and set a\n"; $add_security .= " * different default key if needed.\n"; $add_security .= " */\n"; $add_security .= '$GLOBALS' . "['encrypt_keys'] = array(\n"; $add_security .= " 'default' => '" . $key . "',\n"; $add_security .= ");"; // Create textarea for help $form['encrypt_security_help'] = array( '#type' => 'textarea', '#title' => t('Secure Keys'), '#description' => t('Though, by default the Encrypt module will work, your data will be much more secure if you put the code above into your %settings file. Once you have done this, you can add new keys and change which key is used by default. This will not change any existing encoded data.', array('%settings' => 'settings.php') ), '#default_value' => $add_security, '#rows' => 10, '#cols' => 100, '#resizable' => FALSE, ); // Make it a little more obvious drupal_set_message(t('Make your site more secure by putting your keys in %settings. See The Secure Keys field below.', array('%settings' => 'settings.php') ), 'warning'); } else { // Get available keys $encrypt_keys = $GLOBALS['encrypt_keys']; $key_names = array(); foreach ($encrypt_keys as $name => $key) { $key_names[$name] = $name; } // Allow user to set default key $form['encrypt_default_key'] = array( '#type' => 'select', '#title' => t('Default Key'), '#description' => t('This will change what key Encrypt will use as the default key. This will not affect any existing encoded values. You can add more keys in your %settings file.', array('%settings' => 'settings.php') ), '#options' => $key_names, '#default_value' => variable_get('encrypt_default_key', ENCRYPT_DEFAULT_KEY), ); // Message user drupal_set_message(t('Keys found in %settings file', array('%settings' => 'settings.php'))); } // Make a system setting form and return return system_settings_form($form); }