Gossamer Forum
Home : Products : Links 2.0 : Customization :

How to block ?

Quote Reply
How to block ?
Hello all,

Did have any solution how to block any bad word at title and description to been added to my database, i try to search in this forum but only found how to block the domain and url, please help.

Thank you so much.


Quote Reply
Re: How to block ? In reply to
Hack the Block URL Mod, located at:

http://lookhard.hypermart.net/links-mods/

Basically, it is a matter of putting a comma separated list of bad words into an array called something like @badwords.

Then rather than using @badurl in the Mod, use @badwords and rather than checking URL field, you would check the TITLE and DESCRIPTION fields.

Regards,

Eliot Lee
Quote Reply
Re: How to block ? In reply to
Check out the following link => http://lookhard.hypermart.net/...ods/blocksearch.html

Thomas
http://links.japanref.com
Quote Reply
Re: How to block ? In reply to
Thank you so much Elliot & Thomas

By the way, how to make the Title and Description will checking the bad word ? :

The script below i copy from the URL you give me, which one suppose i edit ?

$domain = $in{'URL'};
foreach $url (@blockurl) {
if ($in{'URL'} =~ /$url/i) {
&site_html_add_failure (qq|Url <a href="$domain">$url</a> is restricted from addition|);
return;
}
}


Thank you so much.


Quote Reply
Re: How to block ? In reply to
my @blockurl = qw( www.aol.com );
my @blocktitle = qw( nasty words );
my @blockdesc = qw( more words );

foreach (@blockurl) {
if ($in{'URL'} =~ /$_/i) {
&site_html_add_failure (qq|Url <a href="$domain">$_</a> is restricted from addition|);
return;
}
}
foreach (@blocktitle) {
if ($in{'Title'} =~ /$_/i) {
&site_html_add_failure (qq|$_ is restricted.|);
return;
}
}
foreach (@blockdesc) {
if ($in{'Description'} =~ /$_/i) {
&site_html_add_failure (qq|$_ is restricted.|);
return;
}
}




Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: How to block ? In reply to
Thank you PaulWison & Thanks for all

Quote Reply
Re: [Paul] How to block ? In reply to
I am trying to modify a copy of Links2 for a friend, the script had the blockurl mod installed and I have expanded it to also block by IP, email address, and bad words; similar to Pauls above, only using

require "$db_lib_path/blockurl.txt";
require "$db_lib_path/blockword.txt";

instead of

my @blockurl = qw( www.aol.com );
my @blockwords = qw( bad words );

The current blockurl.txt contains:
@blockurl = ('domain.com',domain2.com',etc')

I have been asked to make the contents of this file editable from the admin (which I have done ok Smile) but in the format:

domain.com
domain2.com
domain3.com
etc

ie. just a straight list, 1 domain per line, without the @blockurl = ('

This of course made it easier to edit from the admin, as now a text area just shows a nice vertical list of domains.

But the blockurl mod does not work with the file contents in this format. So I am assuming when I open the file from add.cgi to read the array of banned domains, I need to somehow transpose this back into a standard array format.

This is where I am struggling.... a lot Unsure
Unfortunately my knowledge of perl is minimal so most of what i have tried has been guesswork from looking at other code.

I can open the file and get the contents ok,

my $blockurl = $db_lib_path . "/blockurl1.txt";;
open (BLOCKURL, "< $blockurl") or &cgierr ("Unable to open: $blockurl. Reason: $!");
$domain_list = <BLOCKURL>;
close BLOCKURL;

So I get $domain_list which resembles

domain.com
domain2.com
domain3.com
etc.

(It also indents from the second line on, I'm not sure if that will be a problem)

I hoped something simple like
@blockurl = $domain_list
might give me the right output , but no, unfortunately not.

I would greatly appreciate it if one of you experts out there could point me in the right direction.

Mark