You are here

private static function CleantalkFuncs::_cleantalk_apbct_cookies_test in Anti Spam by CleanTalk 8.3

Same name and namespace in other branches
  1. 8.4 src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::_cleantalk_apbct_cookies_test()
  2. 9.1.x src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::_cleantalk_apbct_cookies_test()

Cookie test

Return value

int 1|0

2 calls to CleantalkFuncs::_cleantalk_apbct_cookies_test()
CleantalkFuncs::_cleantalk_check_spam in src/CleantalkFuncs.php
Cleantalk inner function - performs antispam checking.
CleantalkFuncs::_cleantalk_get_submit_time in src/CleantalkFuncs.php

File

src/CleantalkFuncs.php, line 139

Class

CleantalkFuncs
Cleantalk class create request

Namespace

Drupal\cleantalk

Code

private static function _cleantalk_apbct_cookies_test() {
  if (\Drupal::config('cleantalk.settings')
    ->get('cleantalk_alternative_cookies_session')) {
    return 1;
  }
  $cookie_test = json_decode(stripslashes(self::apbct_getcookie('apbct_cookies_test')), true);
  if (is_null($cookie_test)) {
    return null;
  }
  $check_string = trim(\Drupal::config('cleantalk.settings')
    ->get('cleantalk_authkey'));
  foreach ($cookie_test['cookies_names'] as $cookie_name) {
    $check_string .= self::apbct_getcookie($cookie_name);
  }
  unset($cokie_name);
  if ($cookie_test['check_value'] == md5($check_string)) {
    return 1;
  }
  else {
    return 0;
  }
}