5 * Definition of Drupal\cryptolog\CryptologManager.
8 namespace Drupal\cryptolog
;
13 class CryptologManager
{
16 * The memory-based data store.
21 * Construct the Cryptolog Manager.
23 public
function __construct() {
24 foreach (array('dmemcache_set' => 'dmemcache_get', 'apc_store' => 'apc_fetch', 'xcache_set' => 'xcache_get') as
$set => $get) {
25 if (function_exists($set)) {
26 $this->cache
= $get('cryptolog');
28 if (!$this->cache
|| $this->cache
['day'] !== $day) {
29 $this->cache
= array('day' => $day, 'salt' => drupal_random_bytes(32));
30 $set('cryptolog', $this->cache
, 86400);
38 * Sets the client IP address.
40 public
function setClientIP() {
43 // Generate a keyed hash in IPv6 address notation.
44 $_SERVER['REMOTE_ADDR'] = inet_ntop(hash_hmac('md5', ip_address(), $this->cache
['salt'], TRUE
));
45 drupal_static_reset('ip_address');
46 $request->server
->set('REMOTE_ADDR', $_SERVER['REMOTE_ADDR']);