Hi all gallery users, my site http>//www.asizomos.com/index.php is getting bigger and bigger and now its really hard to be deleting all irritating comments people get in their pictures, most of them are just caused by bad words.
So here is my problem, Is there anyway to filter de input text like if it contains some words the comment wont show up_ or lets say just the bad words wont show up in the comment?
Thanks alot I love this gallery
Posts: 196
Hey asizomos!
I read your request and got to thinking that I might need something like this too so I did some searching on the net and found some code, changed it a bit, and implemented it for Gallery
I've only tested it briefly but it seems to work good. Since people can also use bad words for their name I also have the filter working on the commenter name field.
This may be a downside or a plus, but you will need to input your array of words you consider "bad" and their replacements. I actually consider this a plus because I don't mind words like ass but don't want some of the more obscene curse words in there. The code I'll post below will have words in it that aren't usually considered "bad words" but I don't want to put an entire list of curse words here for all to see... you can change the array to your needs.
You'll need to modify two files: util.php and add_comments.php.
In util.php go to the very end. The very last couple lines in the file should be:
}
?>
We are going to put our new code in util.php here:
}
// NEW CODE HERE
?>
Basically, between the "}" and "?>"
Where I have // NEW CODE HERE above, insert the following:
Now in add_comment.php find the section of code that starts with
if (isset($save)) {
and ends with
dismissAndReload();
and replace all that with this:
If you decide you later want to allow bad words, all you need to do is change the $replace = 1 code above to $replace = 0 and the comments and username should allow bad words once again (without deleting all the code).
Depending on your version of Gallery, you may or may not have exactly what I typed above to start with. Basically, you should be able to find the IF statement and the dismissAndReload() function and, if your code is a little different, try to figure out what I changed above and add it to your code. If you need help, post your original code and I'll see if I can change it for you for your version of Gallery.
Oh, and my usual disclaimers apply... I'm not a programmer but this seems to work so if anybody sees something I need to change/fix/update, please post here
Posts: 11
But no success.. when i add a comment it gives me a white page.. :\..
check it out..
http://192.117.122.120/g2/gallery/dsfdsf/mossad
Posts: 5
Wow zman!
Thanks alot for the fast response, I implemented it last night and its working great! You just saved me a lot of work
Thank you for your censoring system, this should be added to newer versions I think.
:lol:
Posts: 196
Excellent! But, just to be clear, the majority of the code isn't mine. I found it on the web, changed it a little, and stuck it in the right places for Gallery
Glad it's working for ya!
Posts: 565
<Oh, and my usual disclaimers apply... I'm not a programmer but this seems to work so if anybody sees something I need to change/fix/update, please post here...>
Some little turd has jumped out of his pram and is mouthing off on my gallery site... I knew that, one day, I would get one;~/
I'm on 1.4.1-rc4 (AIU this is pretty much the same as the subsequent 1.4.1) and implementing this results in a failure to add the comment. Have now had to revert... any ideas?
best wishes, Robert
Posts: 81
Tried implementing this myself info gallery, however I get the follwing error message when clicking on the "post" comment button.
I'm running version: v1.4.4-pl4
Error: Requested index [-1] out of bounds [254]
Fatal error: Call to a member function on a non-object in /www/b/username/htdocs/gallery/classes/Album.php on line 1494
Any ideas anyone.
Thanks Brett[/b]
Posts: 81
Nevermind, just got it to work.
Thanks
Posts: 54
But I can't get it to work
Any ideas anyone?
Posts: 31
Hello,
Can somebody tell my where to find those two files ??
>You'll need to modify two files: util.php and add_comments.php.
Thanks a lot in advance,
Pierre