Loading rtub.module +3 −3 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ function _rtub_save_event($eventName, $message) { } catch (exception $e) { \Drupal::logger('rtub')->warning(print_r('Something went wrong', TRUE)); \Drupal::logger('rtub')->error('Message: ' .$e->getMessage()); } } } Loading @@ -101,7 +101,7 @@ function rtub_preprocess_node(&$variables) { $variables['#attached']['drupalSettings']['rtub']['nodeview']['eventData'] = $node->getTitle(); $variables['#attached']['drupalSettings']['rtub']['nodeview']['eventType'] = "nodeview"; $eStr = Crypt::hmacBase64(_get_cript_data($node->getTitle(), 'nodeview'), Settings::getHashSalt()); $eStr = Crypt::hmacBase64(rtub_get_cript_data($node->getTitle(), 'nodeview'), Settings::getHashSalt()); $variables['#attached']['drupalSettings']['rtub']['nodeview']['eventToken'] = $eStr; } Loading @@ -118,6 +118,6 @@ function rtub_preprocess_node(&$variables) { * @return string * return string. */ function _get_cript_data($title, $type) { function rtub_get_cript_data($title, $type) { return "User on {$title} | {$type}"; } src/Controller/PostNodeDataController.php +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class PostNodeDataController extends ControllerBase { $newStr = "User on {$title} | {$type}"; $eStr = Crypt::hmacBase64($newStr, Settings::getHashSalt()); if ($event['eToken'] == $eStr) { if (hash_equals($eStr, $event['eToken'])) { // Valid post request. $connection = $this->connection; $connection->insert('rtub') Loading Loading
rtub.module +3 −3 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ function _rtub_save_event($eventName, $message) { } catch (exception $e) { \Drupal::logger('rtub')->warning(print_r('Something went wrong', TRUE)); \Drupal::logger('rtub')->error('Message: ' .$e->getMessage()); } } } Loading @@ -101,7 +101,7 @@ function rtub_preprocess_node(&$variables) { $variables['#attached']['drupalSettings']['rtub']['nodeview']['eventData'] = $node->getTitle(); $variables['#attached']['drupalSettings']['rtub']['nodeview']['eventType'] = "nodeview"; $eStr = Crypt::hmacBase64(_get_cript_data($node->getTitle(), 'nodeview'), Settings::getHashSalt()); $eStr = Crypt::hmacBase64(rtub_get_cript_data($node->getTitle(), 'nodeview'), Settings::getHashSalt()); $variables['#attached']['drupalSettings']['rtub']['nodeview']['eventToken'] = $eStr; } Loading @@ -118,6 +118,6 @@ function rtub_preprocess_node(&$variables) { * @return string * return string. */ function _get_cript_data($title, $type) { function rtub_get_cript_data($title, $type) { return "User on {$title} | {$type}"; }
src/Controller/PostNodeDataController.php +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class PostNodeDataController extends ControllerBase { $newStr = "User on {$title} | {$type}"; $eStr = Crypt::hmacBase64($newStr, Settings::getHashSalt()); if ($event['eToken'] == $eStr) { if (hash_equals($eStr, $event['eToken'])) { // Valid post request. $connection = $this->connection; $connection->insert('rtub') Loading