Skip to content

Commit 4eb5ed9

Browse files
authored
Merge pull request #7 from CleanTalk/2.5.2
2.5.2
2 parents cef3aa3 + 76b68b9 commit 4eb5ed9

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

cleantalk/cleantalk.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ function ct_attach_js($buffer){
6464
global $apbct_checkjs_val;
6565
if(
6666
!(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') // No ajax
67-
&& preg_match('/^\s*(<!doctype|<html)[\s\S]*html>\s*$/i', $buffer) == 1 // Only for HTML documents
67+
&& preg_match('/^\s*(<!doctype|<html)[\s\S]*html>/i', $buffer) == 1 // Only for HTML documents
6868
){
6969
$html_addition =
7070
'<script>var apbct_checkjs_val = "' . $apbct_checkjs_val . '";</script>'
7171
.'<script src="/cleantalk/js/ct_js_test.js"></script>'
7272
.'<script src="/cleantalk/js/ct_ajax_catch.js"></script>';
7373
$buffer = preg_replace(
74-
'/<\/body>\s*<\/html>\s*$/i',
74+
'/<\/body>\s*<\/html>/i',
7575
$html_addition.'</body></html>',
7676
$buffer,
7777
1

cleantalk/inc/admin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ function detect_cms( $path_to_index, $out = 'Unknown' ){
213213
$out = 'phpBB';
214214
if ( strpos( $index_file, '/wa-config/' ) && strpos( $index_file, 'waSystem::getInstance' ) )
215215
$out = 'ShopScript';
216-
216+
if (preg_match('/(DATALIFEENGINE.*?)/', $index_file))
217+
$out = 'DLE';
217218
}
218219

219220
return $out;

cleantalk/inc/common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
define( 'CLEANTALK_INITIAL_INCLUDE_PATH', get_include_path() );
44
define('APBCT_PLUGIN', 'uni');
5-
define('APBCT_VERSION', '2.5.1');
5+
define('APBCT_VERSION', '2.5.2');
66
define('APBCT_AGENT', APBCT_PLUGIN . '-' . str_replace( '.', '', APBCT_VERSION ) );
77
define('APBCT_USER_AGENT', 'Cleantalk-Antispam-Universal-Plugin/' . APBCT_VERSION);
88

cleantalk/inc/functions.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ function apbct_get_fields_any($arr, $message=array(), $email = null, $nickname =
281281
'CSRFToken',
282282
'page',
283283
'id',
284+
'skin',
285+
'sec_code'
284286
);
285287

286288
// Reset $message if we have a sign-up data
@@ -316,9 +318,10 @@ function apbct_get_fields_any($arr, $message=array(), $email = null, $nickname =
316318
$not_reg = true;
317319
}else{
318320
foreach($registration as $needle){
319-
if(stripos($key, $needle) !== false ||
320-
( $key == 'page' && $value == 'register' ) || //OsClass
321-
( $key == 'task' && $value == 'registration.register' ) // Joomla!
321+
if(stripos($key, $needle) !== false ||
322+
( $key == 'page' && $value == 'register' ) || //OsClass
323+
( $key == 'task' && $value == 'registration.register' ) || // Joomla!
324+
( $key == 'do' && $value == 'register' ) // DLE!
322325
){
323326
$reg = true;
324327
continue(2);
@@ -511,6 +514,19 @@ function apbct_die($comment, $registration = false, $additional_text = null){
511514
die(json_encode(array('status' =>'ok', 'data' => array('errors' => $comment))));
512515
}
513516

517+
// DLE integration
518+
if( $detected_cms === 'DLE' ) {
519+
if( ! headers_sent() ) {
520+
header('Content-Type:application/json' );
521+
}
522+
523+
if (isset($_REQUEST['mod']) && $_REQUEST['mod'] === 'addcomments') {
524+
die(json_encode(array("error" => true, "content" => "<script>\nvar form = document.getElementById('dle-comments-form');\n\n DLEalert('" . $comment . "', 'Добавление комментария');\n var timeval = new Date().getTime();\n\n\n\t\t\n\tif ( dle_captcha_type == \"1\" ) {\n\t\tif ( typeof grecaptcha != \"undefined\" ) {\n\t\t grecaptcha.reset();\n\t\t}\n } else if (dle_captcha_type == \"2\") {\n\t\tif ( typeof grecaptcha != \"undefined\" ) {\n\t\t\tvar recaptcha_public_key = $('#g-recaptcha-response').data('key');\n\t\t\tgrecaptcha.execute(recaptcha_public_key, {action: 'comments'}).then(function(token) {\n\t\t\t$('#g-recaptcha-response').val(token);\n\t\t\t});\n\t\t}\n\t}\n\n\tif ( form.question_answer ) {\n\n\t form.question_answer.value ='';\n jQuery('#dle-question').text('');\n }\n\n\tif ( document.getElementById('dle-captcha') ) {\n\t\tform.sec_code.value = '';\n\t\tdocument.getElementById('dle-captcha').innerHTML = '<img src=\"' + dle_root + 'engine/modules/antibot/antibot.php?rand=' + timeval + '\" width=\"160\" height=\"80\" alt=\"\">';\n\t}\n\t\t\n </script>" ), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ));
525+
}
526+
527+
die(json_encode(array('status' =>'ok', 'text' => $comment)));
528+
}
529+
514530
die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $comment,))));
515531

516532
// File exists?

cleantalk/install.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@
134134
case 'Question2Answer':
135135
$exclusions['dologin'] = '1';
136136
break;
137+
case 'DLE':
138+
array_push( $files_to_mod, $_SERVER['DOCUMENT_ROOT'] . "/engine/ajax/controller.php" );
139+
break;
137140
}
138141

139142
install( $files_to_mod, $api_key, $cms, $exclusions );

0 commit comments

Comments
 (0)