function commerce_ups_decrypt_vars in Commerce UPS 7.2
Same name and namespace in other branches
- 7 commerce_ups.module \commerce_ups_decrypt_vars()
Decrypt all api variables in one function call.
3 calls to commerce_ups_decrypt_vars()
- commerce_ups_build_access_request in includes/
commerce_ups.xml.inc - Builds the XML access request.
- commerce_ups_build_rate_request in includes/
commerce_ups.xml.inc - This builds the XML to submit to UPS for rates.
- commerce_ups_settings_form in includes/
commerce_ups.admin.inc - Implements hook_settings_form().
File
- ./
commerce_ups.module, line 268 - Handles main functionality for Commerce UPS module.
Code
function commerce_ups_decrypt_vars($include_password) {
$user_vars = array();
if (variable_get('commerce_ups_encrypt', FALSE) && commerce_ups_encryption_available()) {
if (module_exists('aes')) {
$user_vars['ups_accountid'] = aes_decrypt(variable_get('commerce_ups_account_id', ''));
$user_vars['ups_userid'] = aes_decrypt(variable_get('commerce_ups_user_id', ''));
$user_vars['ups_accesskey'] = aes_decrypt(variable_get('commerce_ups_access_key', ''));
if ($include_password) {
$user_vars['ups_password'] = variable_get('commerce_ups_password', '');
}
}
else {
$user_vars['ups_accountid'] = decrypt(variable_get('commerce_ups_account_id', ''));
$user_vars['ups_userid'] = decrypt(variable_get('commerce_ups_user_id', ''));
$user_vars['ups_accesskey'] = decrypt(variable_get('commerce_ups_access_key', ''));
if ($include_password) {
$user_vars['ups_password'] = decrypt(variable_get('commerce_ups_password', ''));
}
}
}
else {
$user_vars['ups_accountid'] = variable_get('commerce_ups_account_id', '');
$user_vars['ups_userid'] = variable_get('commerce_ups_user_id', '');
$user_vars['ups_accesskey'] = variable_get('commerce_ups_access_key', '');
if ($include_password) {
$user_vars['ups_password'] = variable_get('commerce_ups_password', '');
}
}
return $user_vars;
}