Skip to content

Commit aa41f5f

Browse files
author
davydov
committed
fix form checking
1 parent 5be6703 commit aa41f5f

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

antispambycleantalk.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,9 @@ public function onAfterRoute()
903903
'comment_type' => 'feedback_general_contact_form',
904904
'post_url' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''
905905
);
906-
if ($option_cmd == 'com_rsform')
906+
if ($app->input->get('option') == 'com_rsform')
907907
$post_info['comment_type'] = 'contact_form_joomla_rsform';
908-
if ($option_cmd = 'com_baforms')
908+
if ($app->input->get('option') == 'com_baforms')
909909
$post_info['comment_type'] = 'contact_form_joomla_balbooa';
910910
//Rapid
911911
if (isset($_POST['rp_email'])){
@@ -961,9 +961,9 @@ public function onAfterRoute()
961961
// Genertal test for any forms or form with custom fields
962962
elseif ($config['general_contact_forms_test'] ||
963963
$config['check_external'] ||
964-
$option_cmd == 'com_rsform' ||
965-
$option_cmd == 'com_virtuemart' ||
966-
$option_cmd == 'com_baforms')
964+
$app->input->get('option') == 'com_rsform' ||
965+
$app->input->get('option') == 'com_virtuemart' ||
966+
$app->input->get('option') == 'com_baforms')
967967
{
968968
$ct_temp_msg_data = $this->getFieldsAny($_POST);
969969
$sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
@@ -984,10 +984,9 @@ public function onAfterRoute()
984984
'sender_nickname' => $sender_nickname,
985985
'sender_email' => $sender_email,
986986
'message' => trim(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/","\n", $message)),
987-
'post_info' => $post_info,
987+
'post_info' => json_encode($post_info),
988988
)
989989
);
990-
991990
if ($ctResponse)
992991
{
993992
if (!empty($ctResponse) && is_array($ctResponse))
@@ -998,16 +997,18 @@ public function onAfterRoute()
998997
{
999998
if ($ctResponse['allow'] == 0)
1000999
{
1001-
if ($option_cmd == 'com_baforms')
1000+
if ($app->input->get('option') == 'com_baforms')
10021001
{
10031002
echo '<input id="form-sys-mesage" type="hidden" value="' .htmlspecialchars($ctResponse['comment'], ENT_QUOTES). '">';
10041003
print "<script>var obj = { type : 'baform', msg : document.getElementById('form-sys-mesage').value }; window.parent.postMessage(obj, '*');</script>";
1004+
die();
10051005
}
10061006
else {
10071007
$error_tpl=file_get_contents(dirname(__FILE__)."/error.html");
1008-
print str_replace('%ERROR_TEXT%',$ctResponse['comment'],$error_tpl);
1008+
print str_replace('%ERROR_TEXT%',$ctResponse['comment'],$error_tpl);
1009+
die();
10091010
}
1010-
die();
1011+
10111012
}
10121013
elseif ($ctResponse['allow'] == 1 && $config['check_external'] && isset($_POST['ct_action'], $_POST['ct_method']))
10131014
{
@@ -1078,7 +1079,7 @@ public function onValidateContact(&$contact, &$data) {
10781079
'sender_nickname' => $data[$user_name_key],
10791080
'sender_email' => $data[$user_email_key],
10801081
'message' => $data[$subject_key] . "\n " . $data[$message_key],
1081-
'post_info' => $post_info,
1082+
'post_info' => json_encode($post_info),
10821083
)
10831084
);
10841085
if ($ctResponse)
@@ -1221,7 +1222,7 @@ public function onJCommentsCommentBeforeAdd(&$comment) {
12211222
'message' =>preg_replace('/\s+/', ' ',str_replace("<br />", " ", $comment->comment)),
12221223
'sender_nickname' => $comment->name,
12231224
'sender_email' => $comment->email,
1224-
'post_info' => $post_info,
1225+
'post_info' => json_encode($post_info),
12251226
)
12261227
);
12271228
if ($ctResponse)

0 commit comments

Comments
 (0)