From 0886c6deeb68bc0375d40626d6436a1bc939c392 Mon Sep 17 00:00:00 2001 From: SVFCode Date: Thu, 8 Aug 2024 05:36:16 +0000 Subject: [PATCH 01/23] Fix. Helper. Improved gathering email. --- lib/Cleantalk/Custom/Helper/Helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cleantalk/Custom/Helper/Helper.php b/lib/Cleantalk/Custom/Helper/Helper.php index 693329b..e61e172 100644 --- a/lib/Cleantalk/Custom/Helper/Helper.php +++ b/lib/Cleantalk/Custom/Helper/Helper.php @@ -345,8 +345,8 @@ static public function get_fields_any($arr, $fields_exclusions = '', $message = // Removes whitespaces $value = !is_null($value) ? $value : ''; - $value = urldecode( trim( $value ) ); // Fully cleaned message $value_for_email = trim( $value ); // Removes shortcodes to do better spam filtration on server side. + $value = urldecode( trim( $value ) ); // Fully cleaned message // Email if ( ! $email && preg_match( "/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/", $value_for_email ) ) { From ca3882577880ebba70d53f390de275130cdd1880 Mon Sep 17 00:00:00 2001 From: SVFCode Date: Wed, 14 Aug 2024 06:27:40 +0000 Subject: [PATCH 02/23] Fix. Integrations. Added exclusion for joomshoping login form. --- cleantalkantispam.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index 2dda6fe..c2afb38 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -519,7 +519,8 @@ private function exceptionList() ($option_cmd == 'com_virtuemart' && $task_cmd == 'cart') || ($option_cmd == 'com_rsform' && $task_cmd == 'ajaxValidate') || // RSFrom ajax validation on multipage form ($option_cmd == 'com_virtuemart' && !empty($ctask_cmd) && ($ctask_cmd !== 'savebtaddress' || empty($post_field_stage) || $post_field_stage !== 'final')) || - $option_cmd === 'com_civicrm' + $option_cmd === 'com_civicrm' || + ($option_cmd === 'com_jshopping' && $task_cmd === 'loginsave') ) return true; From 42ed09e80b807bd700ddcf98a30ca55e52d30c09 Mon Sep 17 00:00:00 2001 From: SVFCode Date: Sat, 17 Aug 2024 05:26:47 +0000 Subject: [PATCH 03/23] Fix. Search. Updated search handler. --- cleantalkantispam.php | 53 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index c2afb38..a2e0015 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -863,38 +863,37 @@ public function onAfterRoute() } } - if ($_SERVER['REQUEST_METHOD'] == 'GET') - { - if ($this->params->get('ct_check_search')) - { - if ( $option_cmd === 'com_search' && isset($_GET['searchword']) && $_GET['searchword'] !== '' ) // Search form + + // Search form + if ($_SERVER['REQUEST_METHOD'] == 'GET' && $this->params->get('ct_check_search')) { + if ($option_cmd === 'com_search' && isset($_GET['searchword']) && $_GET['searchword'] !== '' || + $option_cmd === 'com_finder' && isset($_GET['q']) && $_GET['q'] !== '' + ) { + $post_info['comment_type'] = 'site_search_joomla34'; + $sender_email = JFactory::getUser()->email; + $sender_nickname = JFactory::getUser()->username; + $message = isset($_GET['searchword']) ? trim($_GET['searchword']) : trim($_GET['q']); + $ctResponse = $this->ctSendRequest( + 'check_message', + array( + 'sender_nickname' => $sender_nickname, + 'sender_email' => $sender_email, + 'message' => trim(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $message)), + 'post_info' => json_encode($post_info), + ) + ); + if ($ctResponse) { - $post_info['comment_type'] = 'site_search_joomla34'; - $sender_email = JFactory::getUser()->email; - $sender_nickname = JFactory::getUser()->username; - $message = trim($_GET['searchword']); - $ctResponse = $this->ctSendRequest( - 'check_message', - array( - 'sender_nickname' => $sender_nickname, - 'sender_email' => $sender_email, - 'message' => trim(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $message)), - 'post_info' => json_encode($post_info), - ) - ); - if ($ctResponse) + if (!empty($ctResponse) && is_array($ctResponse)) { - if (!empty($ctResponse) && is_array($ctResponse)) + if ($ctResponse['errno'] != 0) + $this->sendAdminEmail("CleanTalk. Can't verify search form!", $ctResponse['comment']); + else { - if ($ctResponse['errno'] != 0) - $this->sendAdminEmail("CleanTalk. Can't verify search form!", $ctResponse['comment']); - else + if ($ctResponse['allow'] == 0) { - if ($ctResponse['allow'] == 0) - { - $this->doBlockPage($ctResponse['comment']); + $this->doBlockPage($ctResponse['comment']); - } } } } From 6d30ebbc125675ed3dc081a7e1b48c9c84d8b860 Mon Sep 17 00:00:00 2001 From: SVFCode Date: Tue, 27 Aug 2024 10:16:41 +0000 Subject: [PATCH 04/23] Fix. Integrations. Added exclusion for service request. --- js/ct-functions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/ct-functions.js b/js/ct-functions.js index 648e246..79d0364 100755 --- a/js/ct-functions.js +++ b/js/ct-functions.js @@ -276,6 +276,10 @@ function checkEasySocial(form) { } function ct_is_excluded_forms(form) { + if (form.onsubmit_prev && form.onsubmit_prev.toString().includes('validateRegistrationForm')) { + return true; + } + let value; for (let key in form.elements){ if (isNaN(+key)) { From 580523040c5fa763f4478c6725b65771f35ad75e Mon Sep 17 00:00:00 2001 From: SVFCode Date: Wed, 28 Aug 2024 08:42:45 +0000 Subject: [PATCH 05/23] Fix. RC. Fixed remote calls flow handler. --- cleantalkantispam.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index a2e0015..bcb7dbd 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -307,9 +307,17 @@ public function onAfterInitialise() /** @var \Cleantalk\Common\RemoteCalls\RemoteCalls $remote_calls_class */ $remote_calls_class = Mloader::get('RemoteCalls'); + /** @var \Cleantalk\Common\StorageHandler\StorageHandler $storage_handler */ + $storage_handler = Mloader::get('StorageHandler'); + if( $remote_calls_class::check() ) { - $rc = new $remote_calls_class( $apikey ); - $rc->process(); + $remote_calls = new $remote_calls_class( $apikey, new $storage_handler() ); + try { + die ($remote_calls->process()); + } catch ( \Cleantalk\Common\RemoteCalls\Exceptions\RemoteCallsException $exception ) { + error_log(var_export('RC error: ' . $exception->getMessage(),1)); + die ('FAIL ' . json_encode(array('error' => $exception->getMessage()))); + } } } From 9b4807b9a64c66f0bf5b89ddce871b83115647df Mon Sep 17 00:00:00 2001 From: SVFCode Date: Tue, 3 Sep 2024 09:34:14 +0000 Subject: [PATCH 06/23] Fix. RemoteCalls. Updated error handler. --- lib/Cleantalk/Common/RemoteCalls/RemoteCalls.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cleantalk/Common/RemoteCalls/RemoteCalls.php b/lib/Cleantalk/Common/RemoteCalls/RemoteCalls.php index f42c717..12e9906 100644 --- a/lib/Cleantalk/Common/RemoteCalls/RemoteCalls.php +++ b/lib/Cleantalk/Common/RemoteCalls/RemoteCalls.php @@ -120,7 +120,7 @@ public function process() $action_result = static::$action_method(); // Supports old results returned an array ['error'=>'Error text'] - if ( $action_result['error'] ) { + if ( isset($action_result['error']) && $action_result['error'] ) { throw new RemoteCallsException($action_result['error']); } From 274eba89c2cdb6c14e95811608af75fb430791b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Sep 2024 17:45:37 +0700 Subject: [PATCH 07/23] Fix. SendRequest. Excluding event_token from the request --- cleantalkantispam.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index 0bdc0f5..7ea8e2a 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -1123,12 +1123,19 @@ public function onAfterRoute() if( ! isset( $post_info['comment_type'] ) ) $post_info['comment_type'] = 'feedback_general_contact_form'; + if (is_string($message)) { + $message = json_decode($message, true); + } + if (isset($message['ct_bot_detector_event_token'])) { + unset($message['ct_bot_detector_event_token']); + } + $ctResponse = $this->ctSendRequest( 'check_message', array( 'sender_nickname' => $sender_nickname, 'sender_email' => $sender_email, - 'message' => $message, + 'message' => json_encode($message), 'post_info' => json_encode($post_info), ) ); From 5e84bd57ce34e00bcf2ee3f171ff915edfbdadf3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Sep 2024 17:14:17 +0700 Subject: [PATCH 08/23] Fix. Helper. Correction of null transmission in preg_match --- lib/Cleantalk/Common/Helper/Helper.php | 38 ++++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/Cleantalk/Common/Helper/Helper.php b/lib/Cleantalk/Common/Helper/Helper.php index 1c9b28f..b7730ff 100644 --- a/lib/Cleantalk/Common/Helper/Helper.php +++ b/lib/Cleantalk/Common/Helper/Helper.php @@ -868,26 +868,28 @@ public static function removeNonUTF8($data) public static function toUTF8($obj, $data_codepage = null) { // Array || object - if (is_array($obj) || is_object($obj)) { - foreach ($obj as $_key => &$val) { - $val = self::toUTF8($val, $data_codepage); - } - unset($val); - //String - } else { - if ( !preg_match('//u', $obj) ) { - if ( function_exists('mb_detect_encoding') ) { - $encoding = mb_detect_encoding($obj); - $encoding = $encoding ?: $data_codepage; - } else { - $encoding = $data_codepage; + if ($obj) { + if (is_array($obj) || is_object($obj)) { + foreach ($obj as $_key => &$val) { + $val = self::toUTF8($val, $data_codepage); } + unset($val); + //String + } else { + if ( !preg_match('//u', $obj) ) { + if ( function_exists('mb_detect_encoding') ) { + $encoding = mb_detect_encoding($obj); + $encoding = $encoding ?: $data_codepage; + } else { + $encoding = $data_codepage; + } - if ( $encoding ) { - if ( function_exists('mb_convert_encoding') ) { - $obj = mb_convert_encoding($obj, 'UTF-8', $encoding); - } elseif ( version_compare(phpversion(), '8.3', '<') ) { - $obj = @utf8_encode($obj); + if ( $encoding ) { + if ( function_exists('mb_convert_encoding') ) { + $obj = mb_convert_encoding($obj, 'UTF-8', $encoding); + } elseif ( version_compare(phpversion(), '8.3', '<') ) { + $obj = @utf8_encode($obj); + } } } } From afa2968ab97fdc79eab43bfcb73ad763dec8f892 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Fri, 13 Sep 2024 14:32:33 +0500 Subject: [PATCH 09/23] Fix. CleanTalk block. Die page instead of json for sp page builder. --- cleantalkantispam.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index b369535..dcf60e3 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -1185,7 +1185,8 @@ public function onAfterRoute() die(); } elseif ( $app->input->get('option') === 'com_sppagebuilder' && - !isset($app->input->get('form')['formId']) + !isset($app->input->get('form')['formId']) && + JFactory::getApplication()->input->get('option') === 'com_ajax' ) { $output['status'] = false; $output['content'] = '' . $ctResponse['comment'] . ''; From 1111cbe758585472bd641250e57a50af64e1de87 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Wed, 18 Sep 2024 15:45:26 +0500 Subject: [PATCH 10/23] Fix. Common Helper. Function toUTF8() - null object handling added. --- lib/Cleantalk/Common/Helper/Helper.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Cleantalk/Common/Helper/Helper.php b/lib/Cleantalk/Common/Helper/Helper.php index 1c9b28f..e48befc 100644 --- a/lib/Cleantalk/Common/Helper/Helper.php +++ b/lib/Cleantalk/Common/Helper/Helper.php @@ -867,6 +867,9 @@ public static function removeNonUTF8($data) */ public static function toUTF8($obj, $data_codepage = null) { + if ( empty($obj) ) { + return $obj; + } // Array || object if (is_array($obj) || is_object($obj)) { foreach ($obj as $_key => &$val) { From a42f18e297a6ecf6e181ff0c658e7bb7ad4301ae Mon Sep 17 00:00:00 2001 From: alexandergull Date: Fri, 13 Sep 2024 14:32:33 +0500 Subject: [PATCH 11/23] Fix. CleanTalk block. Die page instead of json for sp page builder. --- cleantalkantispam.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index 7ea8e2a..ad65a76 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -1192,7 +1192,8 @@ public function onAfterRoute() die(); } elseif ( $app->input->get('option') === 'com_sppagebuilder' && - !isset($app->input->get('form')['formId']) + !isset($app->input->get('form')['formId']) && + JFactory::getApplication()->input->get('option') === 'com_ajax' ) { $output['status'] = false; $output['content'] = '' . $ctResponse['comment'] . ''; From 92d92270360b95779fce6ceab93e6b874d12a9fc Mon Sep 17 00:00:00 2001 From: alexandergull Date: Wed, 18 Sep 2024 15:45:26 +0500 Subject: [PATCH 12/23] Fix. Common Helper. Function toUTF8() - null object handling added. --- lib/Cleantalk/Common/Helper/Helper.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Cleantalk/Common/Helper/Helper.php b/lib/Cleantalk/Common/Helper/Helper.php index b7730ff..3454555 100644 --- a/lib/Cleantalk/Common/Helper/Helper.php +++ b/lib/Cleantalk/Common/Helper/Helper.php @@ -867,6 +867,9 @@ public static function removeNonUTF8($data) */ public static function toUTF8($obj, $data_codepage = null) { + if ( empty($obj) ) { + return $obj; + } // Array || object if ($obj) { if (is_array($obj) || is_object($obj)) { From 50f995cb4b22aa89f5ad0323822eeb1f8f918435 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Mon, 30 Sep 2024 16:07:16 +0500 Subject: [PATCH 13/23] Fix. SFW. Cron updates. --- cleantalkantispam.php | 9 +++++++-- lib/Cleantalk/Common/Cron/Cron.php | 5 +++-- lib/Cleantalk/Common/Firewall/FirewallUpdater.php | 5 +++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index 0bdc0f5..2de53b6 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -2519,11 +2519,16 @@ private function apbct_run_cron() { /** @var \Cleantalk\Common\Cron\Cron $cron_class */ $cron_class = Mloader::get('Cron'); + $cron = new $cron_class(); + /** @var \Cleantalk\Common\RemoteCalls\RemoteCalls $rc_class */ $rc_class = Mloader::get('RemoteCalls'); - $cron = new $cron_class(); - if (!$this->params->get($cron->getCronOptionName())) { + /** @var \Cleantalk\Common\StorageHandler\StorageHandler $storage_handler_class */ + $storage_handler_class = Mloader::get('StorageHandler'); + $storage_handler_class = new $storage_handler_class(); + + if ( (int)$storage_handler_class->getSetting($cron->getCronOptionName()) === 0 ) { $cron->addTask( 'sfw_update', '\plgSystemCleantalkantispam::apbct_sfw_update', 86400, time() + 60 ); $cron->addTask( 'sfw_send_logs', '\plgSystemCleantalkantispam::apbct_sfw_send_logs', 3600 ); } diff --git a/lib/Cleantalk/Common/Cron/Cron.php b/lib/Cleantalk/Common/Cron/Cron.php index 616873a..f8e222d 100644 --- a/lib/Cleantalk/Common/Cron/Cron.php +++ b/lib/Cleantalk/Common/Cron/Cron.php @@ -64,7 +64,6 @@ public function __construct( } $this->tasks = $this->getTasks(); - if ( !empty($this->tasks) ) { $this->createId(); usleep(10000); // 10 ms @@ -124,7 +123,6 @@ public function getTasks() $storage_handler_class = Mloader::get('StorageHandler'); $storage_handler_class = new $storage_handler_class(); $tasks = $storage_handler_class->getSetting($this->cron_option_name); - return empty($tasks) ? array() : $tasks; } @@ -238,6 +236,9 @@ public function checkTasks() // No tasks to run if ( empty($this->tasks) || $storage_handler_class->getSetting('cleantalk_cron_pid') !== $this->id ) { + if ($this->debug) { + error_log(var_export('Wrong cleantalk_cron_pid or task list empty', true)); + } return false; } diff --git a/lib/Cleantalk/Common/Firewall/FirewallUpdater.php b/lib/Cleantalk/Common/Firewall/FirewallUpdater.php index 40d6278..e1550fd 100644 --- a/lib/Cleantalk/Common/Firewall/FirewallUpdater.php +++ b/lib/Cleantalk/Common/Firewall/FirewallUpdater.php @@ -727,10 +727,11 @@ public static function endOfUpdate($_api_key, $is_first_updating = false) $cron = new $cron_class(); $sfw_update_handler = defined( 'APBCT_CRON_HANDLER__SFW_UPDATE' - ) ? APBCT_CRON_HANDLER__SFW_UPDATE : 'apbct_sfw_update__init'; + ) ? APBCT_CRON_HANDLER__SFW_UPDATE : '\plgSystemCleantalkantispam::apbct_sfw_update'; $cron->updateTask('sfw_update', $sfw_update_handler, $fw_stats->update_period); $cron->removeTask('sfw_update_checker'); + self::removeUpdDir($fw_stats->updating_folder); // Reset all FW stats @@ -971,7 +972,7 @@ public function updateFallback() $cron->removeTask('sfw_update_checker'); $sfw_update_handler = defined( 'APBCT_CRON_HANDLER__SFW_UPDATE' - ) ? APBCT_CRON_HANDLER__SFW_UPDATE : 'apbct_sfw_update__init'; + ) ? APBCT_CRON_HANDLER__SFW_UPDATE : '\plgSystemCleantalkantispam::apbct_sfw_update'; $cron->updateTask('sfw_update', $sfw_update_handler, $fw_stats->update_period); /** From 006ea11c3f91eb4adb77cb9808c5844fc76edee7 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Mon, 30 Sep 2024 16:10:56 +0500 Subject: [PATCH 14/23] Mod. SFW. Run direct update via const APBCT_SFW_DIRECT_UPDATE --- lib/Cleantalk/Common/Firewall/FirewallUpdater.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cleantalk/Common/Firewall/FirewallUpdater.php b/lib/Cleantalk/Common/Firewall/FirewallUpdater.php index e1550fd..7f20424 100644 --- a/lib/Cleantalk/Common/Firewall/FirewallUpdater.php +++ b/lib/Cleantalk/Common/Firewall/FirewallUpdater.php @@ -131,7 +131,7 @@ private function updateInit($delay = 0) $this->fwStats->updating_last_start = time(); $fw_class::saveFwStats($this->fwStats); - if ( !empty($prepare_dir__result['error']) || !empty($test_rc_result['error']) ) { + if ( (defined('APBCT_SFW_DIRECT_UPDATE') && APBCT_SFW_DIRECT_UPDATE) || !empty($prepare_dir__result['error']) || !empty($test_rc_result['error']) ) { return $this->directUpdate(); } @@ -219,7 +219,7 @@ private function updateWorker($checker_work = false) } } - if ( isset($result['error'], $result['status']) && $result['status'] === 'FINISHED' ) { + if ( ( isset($result['error'], $result['status']) && $result['status'] === 'FINISHED' ) ) { $this->updateFallback(); $direct_upd_res = $this->directUpdate(); From 4c18c25fdddc2908cc1e7162ac6a5a0483109873 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Mon, 30 Sep 2024 16:11:33 +0500 Subject: [PATCH 15/23] Mod. SFW. Remove all the cron jobs and stats if SFW is disabled. --- cleantalkantispam.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index 2de53b6..062c3ee 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -489,9 +489,31 @@ public function onExtensionAfterSave($name, $data) $new_config = json_decode($data->params, true); $access_key = trim($new_config['apikey']); + $cron_class = Mloader::get('Cron'); + $cron = new $cron_class(); + if (isset($new_config['ct_sfw_enable'])) { - self::apbct_sfw_update($access_key); - self::apbct_sfw_send_logs($access_key); + if ($new_config['ct_sfw_enable'] == 1) { + //update tasks + /** @var \Cleantalk\Common\Cron\Cron $cron */ + $cron->updateTask( 'sfw_update', '\plgSystemCleantalkantispam::apbct_sfw_update', 86400, time() + 60 ); + $cron->updateTask( 'sfw_send_logs', '\plgSystemCleantalkantispam::apbct_sfw_send_logs', 3600 ); + // run update itself + $update_result = self::apbct_sfw_update($access_key); + self::apbct_sfw_send_logs($access_key); + } else { + //remove tasks + $cron->removeTask( 'sfw_update'); + $cron->removeTask( 'sfw_send_logs'); + $cron->removeTask( 'sfw_update_checker'); + //remove fwstats + $firewall = new \Cleantalk\Common\Firewall\Firewall( + $access_key, + APBCT_TBL_FIREWALL_LOG + ); + $empty_stats = new \Cleantalk\Common\Firewall\FwStats(); + $firewall::saveFwStats($empty_stats); + } } $this->ctSendFeedback($access_key, '0:' . self::ENGINE); From ca04842d46b2d33840c6f6d91f635bfc47c2916a Mon Sep 17 00:00:00 2001 From: alexandergull Date: Mon, 30 Sep 2024 16:16:53 +0500 Subject: [PATCH 16/23] Fix. CURL options state returned to the state before common libs updated. --- lib/Cleantalk/Common/Http/Request.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cleantalk/Common/Http/Request.php b/lib/Cleantalk/Common/Http/Request.php index b6587b7..47ef741 100644 --- a/lib/Cleantalk/Common/Http/Request.php +++ b/lib/Cleantalk/Common/Http/Request.php @@ -417,10 +417,10 @@ protected function appendOptionsObligatory() $this->options = array_replace( array( CURLOPT_URL => ! is_array($this->url) ? $this->url : null, - CURLOPT_TIMEOUT => 10, - CURLOPT_LOW_SPEED_TIME => 7, + CURLOPT_TIMEOUT => 75, + CURLOPT_LOW_SPEED_TIME => 25, CURLOPT_RETURNTRANSFER => true, - CURLOPT_CONNECTTIMEOUT => 5000, + CURLOPT_CONNECTTIMEOUT => 10000, CURLOPT_FORBID_REUSE => true, CURLOPT_USERAGENT => self::AGENT, CURLOPT_POST => true, From 6e2da8a89348fa03435743a4635198bb68eb9e6c Mon Sep 17 00:00:00 2001 From: alexandergull Date: Mon, 30 Sep 2024 17:06:08 +0500 Subject: [PATCH 17/23] Mod. Code. Use const APBCT_CRON_HANDLER__SFW_UPDATE instead common lib modifying. --- cleantalkantispam.php | 1 + lib/Cleantalk/Common/Firewall/FirewallUpdater.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index 394de3b..1a6dafa 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -64,6 +64,7 @@ define('APBCT_SELECT_LIMIT', 5000); // Select limit for logs. define('APBCT_WRITE_LIMIT', 5000); // Write limit for firewall data. define('APBCT_DIR_PATH', __DIR__); +define('APBCT_CRON_HANDLER__SFW_UPDATE', 'plgSystemCleantalkantispam::apbct_sfw_update'); //define('APBCT_EXCLUSION_STRICT_MODE', true); class plgSystemCleantalkantispam extends JPlugin diff --git a/lib/Cleantalk/Common/Firewall/FirewallUpdater.php b/lib/Cleantalk/Common/Firewall/FirewallUpdater.php index 7f20424..6f1453e 100644 --- a/lib/Cleantalk/Common/Firewall/FirewallUpdater.php +++ b/lib/Cleantalk/Common/Firewall/FirewallUpdater.php @@ -727,7 +727,7 @@ public static function endOfUpdate($_api_key, $is_first_updating = false) $cron = new $cron_class(); $sfw_update_handler = defined( 'APBCT_CRON_HANDLER__SFW_UPDATE' - ) ? APBCT_CRON_HANDLER__SFW_UPDATE : '\plgSystemCleantalkantispam::apbct_sfw_update'; + ) ? APBCT_CRON_HANDLER__SFW_UPDATE : 'apbct_sfw_update__init'; $cron->updateTask('sfw_update', $sfw_update_handler, $fw_stats->update_period); $cron->removeTask('sfw_update_checker'); @@ -972,7 +972,7 @@ public function updateFallback() $cron->removeTask('sfw_update_checker'); $sfw_update_handler = defined( 'APBCT_CRON_HANDLER__SFW_UPDATE' - ) ? APBCT_CRON_HANDLER__SFW_UPDATE : '\plgSystemCleantalkantispam::apbct_sfw_update'; + ) ? APBCT_CRON_HANDLER__SFW_UPDATE : 'apbct_sfw_update__init'; $cron->updateTask('sfw_update', $sfw_update_handler, $fw_stats->update_period); /** From e8b42d06f8d2cc8a0969aa12492a4460014e4df1 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Fri, 4 Oct 2024 14:36:59 +0500 Subject: [PATCH 18/23] Mod. Cookie. Detect secure statement for cookies automatically. --- cleantalkantispam.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index 1a6dafa..c383e27 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -48,6 +48,7 @@ use Cleantalk\Common\Cleaner\Sanitize; use Cleantalk\Common\Mloader\Mloader; +use Cleantalk\Common\Variables\Cookie; use Cleantalk\Common\Variables\Server; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; @@ -2329,7 +2330,7 @@ private function ct_setcookie( $name, $value ) } else { // To cookies - setcookie($name, $value, 0, '/'); + Cookie::set($name, $value); } } From 0dcd3a2071a46ba4485add6d8ad35f4c83fccc4b Mon Sep 17 00:00:00 2001 From: alexandergull Date: Tue, 22 Oct 2024 13:49:40 +0500 Subject: [PATCH 19/23] Update version: 3.2.5 --- README.md | 4 ++-- cleantalkantispam.php | 2 +- cleantalkantispam.xml | 2 +- plugin-updates.xml | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a45b07a..3131a0f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Anti-spam plugin for Joomla 3.X.-4.x ============ -Version 3.2.4 +Version 3.2.5 ======= ## Simple antispam test @@ -22,4 +22,4 @@ Example how to use plugin to filter spam bots at any Joomla form. ## Requirements -* CleanTalk account https://cleantalk.org/register?product=anti-spam \ No newline at end of file +* CleanTalk account https://cleantalk.org/register?product=anti-spam diff --git a/cleantalkantispam.php b/cleantalkantispam.php index c383e27..73cb760 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -3,7 +3,7 @@ /** * CleanTalk joomla plugin * - * @version 3.2.4 + * @version 3.2.5 * @package Cleantalk * @subpackage Joomla * @author CleanTalk (welcome@cleantalk.org) diff --git a/cleantalkantispam.xml b/cleantalkantispam.xml index dd04d7a..e517dad 100644 --- a/cleantalkantispam.xml +++ b/cleantalkantispam.xml @@ -7,7 +7,7 @@ GNU/GPLv2 welcome@cleantalk.org cleantalk.org - 3.2.4 + 3.2.5 PLG_SYSTEM_CLEANTALKANTISPAM_DESCRIPTION updater.php diff --git a/plugin-updates.xml b/plugin-updates.xml index bcaebc7..3341a1f 100644 --- a/plugin-updates.xml +++ b/plugin-updates.xml @@ -6,9 +6,9 @@ cleantalkantispam plugin system - 3.2.4 + 3.2.5 - https://github.com/CleanTalk/joomla3.x-4.x-antispam/archive/3.2.4.zip + https://github.com/CleanTalk/joomla3.x-4.x-antispam/archive/3.2.5.zip stable @@ -17,4 +17,4 @@ site - \ No newline at end of file + From 98d5454f0fae1125af0d3772b60d88956df6e2cb Mon Sep 17 00:00:00 2001 From: alexandergull Date: Wed, 23 Oct 2024 13:03:07 +0500 Subject: [PATCH 20/23] Engine version updated to joomla34-325 --- cleantalkantispam.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cleantalkantispam.php b/cleantalkantispam.php index 73cb760..7f4dfc7 100644 --- a/cleantalkantispam.php +++ b/cleantalkantispam.php @@ -74,7 +74,7 @@ class plgSystemCleantalkantispam extends JPlugin * Plugin version string for server * @since 1.0 */ - const ENGINE = 'joomla34-324'; + const ENGINE = 'joomla34-325'; /** * Flag marked JComments form initialization. From 79f00538d233940160468d395c74dc7e6c45e9e5 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Wed, 23 Oct 2024 16:08:09 +0500 Subject: [PATCH 21/23] Fix. Users checker. Wrong accounting of users fixed. --- js/ct-checkusers.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/ct-checkusers.js b/js/ct-checkusers.js index 76156f9..db28623 100644 --- a/js/ct-checkusers.js +++ b/js/ct-checkusers.js @@ -11,7 +11,8 @@ window.apbct = window.apbct || {}; totalUsers: 0, limit: 20, offset: 0, - improvedCheck: false + improvedCheck: false, + cleared: false }; apbct = apbct || {}; @@ -47,6 +48,9 @@ window.apbct = window.apbct || {}; usersChecker.setListeners = () => { $('#check_spam_users').click(() => { + if (scanInProgress) { + return; + } usersChecker.improvedCheck = $("#ct_impspamcheck_checkbox").is(":checked"); usersChecker.clearUserCheckerResults() @@ -130,6 +134,11 @@ window.apbct = window.apbct || {}; }; usersChecker.clearUserCheckerResults = () => { + if (usersChecker.cleared) + { + return; + } + usersChecker.cleared = true; usersChecker.layoutClearById('spamusers_table'); const data = {action: 'usersChecker', route: 'clearResults'}; return usersChecker.ajaxRequest(data); @@ -176,6 +185,7 @@ window.apbct = window.apbct || {}; response => { try { usersChecker.runUserCheckerSuccess(JSON.parse(response)); + usersChecker.cleared = false; } catch (error) { usersChecker.runUserCheckerError(error); } From c05b31093fccbe292ca213ba54abe9429483b8ef Mon Sep 17 00:00:00 2001 From: alexandergull Date: Wed, 23 Oct 2024 16:09:44 +0500 Subject: [PATCH 22/23] Fix. Users checker. Get data on the page direct refresh with checker tab selected. --- js/ct-settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ct-settings.js b/js/ct-settings.js index eb910e7..3f9c4f7 100644 --- a/js/ct-settings.js +++ b/js/ct-settings.js @@ -194,7 +194,7 @@ jQuery(document).ready(function(){ .append("

") .append(""+ct_license_notice+""); - jQuery('#key_buttons_wrapper').closest('.control-label').css('width', 'auto').next().empty(); + jQuery('#key_buttons_wrapper').closest('.control-label').css('width', 'auto').next().empty(); } } @@ -357,7 +357,7 @@ jQuery(document).ready(function(){ } } - if (joomlaVersion() === '4') { + if (joomlaVersion() === '4' || joomlaVersion() === '5') { const apbctSettingsTabs = jQuery('#myTab button[role="tab"]'); jQuery.each(apbctSettingsTabs, function (index, tab) { let tabElement = jQuery(tab); From f2a7eb584459898eff6f864546a2c0987f9fc0f2 Mon Sep 17 00:00:00 2001 From: alexandergull Date: Wed, 23 Oct 2024 17:00:57 +0500 Subject: [PATCH 23/23] Fix. Users checker. Fixed clearance condition place. --- js/ct-checkusers.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/js/ct-checkusers.js b/js/ct-checkusers.js index db28623..a303bfd 100644 --- a/js/ct-checkusers.js +++ b/js/ct-checkusers.js @@ -48,7 +48,7 @@ window.apbct = window.apbct || {}; usersChecker.setListeners = () => { $('#check_spam_users').click(() => { - if (scanInProgress) { + if (scanInProgress || usersChecker.cleared) { return; } usersChecker.improvedCheck = $("#ct_impspamcheck_checkbox").is(":checked"); @@ -134,13 +134,9 @@ window.apbct = window.apbct || {}; }; usersChecker.clearUserCheckerResults = () => { - if (usersChecker.cleared) - { - return; - } - usersChecker.cleared = true; usersChecker.layoutClearById('spamusers_table'); const data = {action: 'usersChecker', route: 'clearResults'}; + usersChecker.cleared = true; return usersChecker.ajaxRequest(data); };