You are here

function drd_server_aes in Drupal Remote Dashboard Server 7.2

Same name and namespace in other branches
  1. 6.2 drd_server.module \drd_server_aes()

Get the AES encryption values for the remote DRD dashboard, identified by their IP address.

Return value

array An array of the AES encryption values for the given referer.

2 calls to drd_server_aes()
drd_server_output in ./drd_server.module
Prepare the output to be sent back to the DRD dashboard. This preparation json encodes the output and then encrypts the resulting string if encryption is available.
_drd_server_validate_request in ./drd_server.module
Callback to validate a request that's coming from DRD.

File

./drd_server.module, line 935
Provides XMLRPC implementation to respond to requests from DRD.

Code

function drd_server_aes() {
  $cluster_mode = !empty($_SERVER['HTTP_X_DRD_AUTH_TOKEN']);
  $referer = $cluster_mode ? $_SERVER['HTTP_X_DRD_AUTH_TOKEN'] : ip_address();
  $aes_keys = variable_get('drd_aes_keys', array());
  if (empty($aes_keys[$referer])) {
    return FALSE;
  }
  if (!empty($aes_keys[$referer]['cluster_mode']) && (empty($aes_keys[$referer]['cluster_ips']) || strpos($aes_keys[$referer]['cluster_ips'], ip_address()) === FALSE)) {
    return FALSE;
  }
  return $aes_keys[$referer];
}