public static function CleantalkFuncs::_cleantalk_apbct_remote_call__perform in Anti Spam by CleanTalk 8.3
Cleantalk inner function - perform remote call
1 call to CleantalkFuncs::_cleantalk_apbct_remote_call__perform()
- BootSubscriber::handle in src/
EventSubscriber/ BootSubscriber.php - Handles a Request to convert it to a Response.
File
- src/
CleantalkFuncs.php, line 663
Class
- CleantalkFuncs
- Cleantalk class create request
Namespace
Drupal\cleantalkCode
public static function _cleantalk_apbct_remote_call__perform() {
$remote_calls_config = \Drupal::state()
->get('cleantalk_remote_calls');
$remote_action = $_GET['spbc_remote_call_action'];
$auth_key = trim(\Drupal::config('cleantalk.settings')
->get('cleantalk_authkey'));
if (is_array($remote_calls_config) && array_key_exists($remote_action, $remote_calls_config)) {
$cooldown = isset($remote_calls_config[$remote_action]['cooldown']) ? $remote_calls_config[$remote_action]['cooldown'] : 10;
if (time() - $remote_calls_config[$remote_action]['last_call'] > $cooldown || $remote_action == 'sfw_update__write_base' && isset($_GET['file_url_hash'])) {
$remote_calls_config[$remote_action]['last_call'] = time();
\Drupal::state()
->set('cleantalk_remote_calls', $remote_calls_config);
if (strtolower($_GET['spbc_remote_call_token']) == strtolower(md5($auth_key))) {
// Close renew banner
if ($remote_action == 'close_renew_banner') {
\Drupal::state()
->set('cleantalk_show_renew_banner', 0);
die('OK');
// SFW update
}
elseif ($remote_action == 'sfw_update') {
$result = self::_cleantalk_sfw_update($auth_key);
die(empty($result['error']) ? 'OK' : 'FAIL ' . json_encode(array(
'error' => $result['error_string'],
)));
// SFW send logs
}
elseif ($remote_action == 'sfw_update__write_base') {
$result = self::_cleantalk_sfw_update($auth_key);
die(empty($result['error']) ? 'OK' : 'FAIL ' . json_encode(array(
'error' => $result['error_string'],
)));
}
elseif ($remote_action == 'sfw_send_logs') {
$result = self::_cleantalk_sfw_send_logs($auth_key);
die(empty($result['error']) ? 'OK' : 'FAIL ' . json_encode(array(
'error' => $result['error_string'],
)));
// Update plugin
}
elseif ($remote_action == 'update_plugin') {
//add_action('wp', 'apbct_update', 1);
}
else {
die('FAIL ' . json_encode(array(
'error' => 'UNKNOWN_ACTION_2',
)));
}
}
else {
die('FAIL ' . json_encode(array(
'error' => 'WRONG_TOKEN',
)));
}
}
else {
die('FAIL ' . json_encode(array(
'error' => 'TOO_MANY_ATTEMPTS',
)));
}
}
else {
die('FAIL ' . json_encode(array(
'error' => 'UNKNOWN_ACTION',
)));
}
}