Kunena 6.2.5 & module Kunena Latest 6.0.7 released

The Kunena team has announce the arrival of Kunena 6.2.5 [K 6.2.5] which is now available for download as a native Joomla extension for J! 4.3.x/4.4.x/5.0.x. This version addresses most of the issues that were discovered in K 6.1 / K 6.2 and issues discovered during the last development stages of K 6.2

Question Sort of Anti-spam - preventing posts with banned word

More
13 years 4 months ago - 13 years 4 months ago #1 by nnggrr
Hi.
I'm trying to prevent posts uploading if the post contain sort of words.
When I looked the HTML source code of sending new post's page, I found this JavaScript lines:

function submitForm() {

submitme=1;

formname=document.postform.fb_authorname.value;

if ((formname.length<1)) {

alert("You've forgot enter the name.");

submitme=0;

}

formmail=document.postform.email.value;

if ((formmail.length<1)) {

alert("You've forgot enter mail address.");

submitme=0;

}

formsubject=document.postform.subject.value;

if ((formsubject.length<1)) {

alert("You've forgot enter the subject.");

submitme=0;

}

if (submitme>0) {

// var message = document.postform.message.value;

// message = message.replace(/</g,"&lt;");

// message = message.replace(/>/g,"&gt;");

// document.postform.message.value = message;

//change the following line to true to submit form

return true;

}else{

return false;


Like the conditions above, I want to add this condition:

myRegExp = /Alex/;
formmail=document.postform.email.value;
matchPos1 = formmail.search(myRegExp);
if (matchPos1 == -1) {
alert("we don't want any Alex.");
submitme=0;


But I didn't find the exact page which contains the code lines above.

So please:
Can you help me find the location of the code lines above?
And do you think It will do the job...
Last edit: 13 years 4 months ago by nnggrr.

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago - 13 years 4 months ago #2 by nnggrr
I've found where this lines are located: in folder "lib", file name: ‏‏"kunena.bbcode.js.php"
but because it is PHP file the source code is:
Code:
function submitForm() { submitme=1; formname=document.postform.fb_authorname.value; if ((formname.length<1)) { alert("<?php @print( _POST_FORGOT_NAME_ALERT); ?>"); submitme=0; } <?php if ($fbConfig->askemail) { ?> formmail=document.postform.email.value; if ((formmail.length<1)) { alert("<?php @print( _POST_FORGOT_EMAIL_ALERT); ?>"); submitme=0; } <?php } ?> formsubject=document.postform.subject.value; if ((formsubject.length<1)) { alert("<?php @print( _POST_FORGOT_SUBJECT_ALERT); ?>"); submitme=0; } if (submitme>0) { // var message = document.postform.message.value; // message = message.replace(/</g,"&lt;"); // message = message.replace(/>/g,"&gt;"); // document.postform.message.value = message; //change the following line to true to submit form return true; }else{ return false; } }

Can you please help me get this JS code lines into the PHP code above? :
Code:
var NGRegExp = /Alex/; if (NGRegExp.test(document.postform.message.value) = true) { alert("<?php @print( _POST_FORGOT_SUBJECT_ALERT); ?>"); submitme=0; }

Thanks!
Last edit: 13 years 4 months ago by nnggrr.

Please Log in or Create an account to join the conversation.

  • C0n
  • C0n's Avatar
  • Offline
  • Premium Member
  • Only the strongest will survive
More
13 years 4 months ago #3 by C0n
Do you have the locations of the files your trying to edit for example /components/com_kunena/lib/kunena.bbcode.js.php

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #4 by nnggrr

C0n wrote: Do you have the locations of the files your trying to edit for example
/components/com_kunena/lib/kunena.bbcode.js.php


yes. this is the exact location.
do you know how to put the JS code into this PHP page?

Please Log in or Create an account to join the conversation.

  • C0n
  • C0n's Avatar
  • Offline
  • Premium Member
  • Only the strongest will survive
More
13 years 4 months ago #5 by C0n
Im assuming your using a defualt template so it would be in either "components/com_kunena/template/defualt/plugin" or it would be in "components/com_kunena/template/defualt/js"

Please Log in or Create an account to join the conversation.

Time to create page: 0.341 seconds