@@ -197,30 +197,34 @@ function cleantalk_check_message(&$msgOptions, $topicOptions, $posterOptions)
197
197
* @var CleantalkResponse $ct_result CleanTalk API call result
198
198
*/
199
199
$ ct_result = $ ct ->isAllowMessage ($ ct_request );
200
+ $ ct_answer_text = 'CleanTalk: ' . strip_tags ($ ct_result ->comment );
200
201
201
202
if ($ ct_result ->errno != 0 && !cleantalk_is_valid_js ()) {
202
203
cleantalk_log ('deny post (errno !=0, invalid js test) ' . strip_tags ($ ct_result ->comment ));
203
- fatal_error (' CleanTalk: ' . strip_tags ( $ ct_result -> comment ) , false );
204
+ fatal_error ($ ct_answer_text , false );
204
205
return ;
205
206
}
206
207
207
- if ($ ct_result ->stop_queue == 1 ) {
208
- cleantalk_log ('stop queue " ' . $ ct_result ->comment . '" ' );
209
- fatal_error ('CleanTalk: ' . strip_tags ($ ct_result ->comment ), false );
210
-
211
- } elseif ($ ct_result ->inactive == 1 ) {
212
- cleantalk_log ('inactive message " ' . $ ct_result ->comment . '" ' );
213
-
214
- if ($ modSettings ['postmod_active ' ]) {
215
- // If post moderation active then set message not approved
216
- $ msgOptions ['approved ' ] = 0 ;
208
+ if ($ ct_result ->allow == 0 ) {
209
+ $ msgOptions ['cleantalk_check_message_result ' ] = $ ct_result ->comment ;
210
+ if ($ modSettings ['postmod_active ' ] || true ) {
211
+ if ($ ct_result ->stop_queue == 1 ) {
212
+ cleantalk_log ('spam message " ' . $ ct_result ->comment . '" ' );
213
+ fatal_error ($ ct_answer_text , false );
214
+ } else {
215
+ // If post moderation active then set message not approved
216
+ cleantalk_log ('to postmoderation " ' . $ ct_result ->comment . '" ' );
217
+ $ msgOptions ['approved ' ] = 0 ;
218
+ }
219
+ } else {
220
+ cleantalk_log ('spam message " ' . $ ct_result ->comment . '" ' );
221
+ fatal_error ($ ct_answer_text , false );
217
222
}
218
- $ msgOptions ['cleantalk_check_message_result ' ] = $ ct_result ->comment ;
219
-
220
223
} else {
221
224
// all ok, only logging
222
225
cleantalk_log ('allow message for " ' . $ posterOptions ['name ' ] . '" ' );
223
226
}
227
+
224
228
}
225
229
226
230
/**
0 commit comments