You are here

function _deploy_encrypt in Deploy - Content Staging 7.3

Centralize method for handling encryption.

Parameters

$value: string which needs to be encrypt

2 calls to _deploy_encrypt()
deploy_ui_endpoint::edit_form_authenticator_submit in modules/deploy_ui/plugins/export_ui/deploy_ui_endpoint.class.php
Authenticator form submit handler.
_deploy_encrypt_endpoints in ./deploy.module
Helper function to encrypt existing endpoints username & password.

File

./deploy.module, line 827
Deploy module functions.

Code

function _deploy_encrypt($value) {
  if (module_exists('encrypt')) {
    if (_deploy_get_php_encryption_state()) {
      $original_value = base64_decode($value);
      return encrypt($original_value);
    }
    return encrypt($value);
  }
  elseif (variable_get('encrypt_module_enabled', FALSE)) {

    // Encrypt module was enabled, but not anymore.
    drupal_set_message('Your endpoints are broken');
    return;
  }

  // Encrypt was never enabled.
  _deploy_set_php_encryption_state();
  return base64_encode($value);
}