function salesforce_api_encryption_available in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.module \salesforce_api_encryption_available()
Check whether encryption is available.
2 calls to salesforce_api_encryption_available()
- salesforce_api_requirements in salesforce_api/
salesforce_api.install - Implements hook_requirements().
- salesforce_api_settings_form in salesforce_api/
salesforce_api.admin.inc - The settings form at admin/settings/salesforce.
File
- salesforce_api/
salesforce_api.module, line 2329 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_encryption_available($options = array()) {
$defaults = array(
'check_config' => TRUE,
'display_errors' => FALSE,
'display_warnings' => FALSE,
'display_all' => FALSE,
'fail_threshold' => 'warnings',
);
$options = array_merge($defaults, $options);
extract($options);
$errors = array();
$warnings = array();
if (!module_exists('aes')) {
$warnings[] = 'AES Encryption module is not installed.';
}
elseif ($check_config) {
if (!variable_get('aes_key_path', FALSE) || variable_get('aes_key_storage_method', FALSE) != 'File') {
$errors[] = 'AES Encryption is installed but not configured securely.
Please go <a href="/admin/settings/aes">configure AES Encryption to use
file storage</a> to enable encryption for Salesforce credentials.';
}
}
if ($display_errors || $display_all) {
foreach ($errors as $msg) {
drupal_set_message(t($msg), 'error');
}
}
switch ($fail_threshold) {
case 'errors':
if (empty($errors)) {
return TRUE;
}
case 'warnings':
if (empty($errors) && empty($warnings)) {
return TRUE;
}
}
}