| |
|
| :: |
| Author |
Message |
euroman PR0

Joined: 21 Oct 2006 Posts: 81
|
Posted: Tue Oct 31, 2006 11:57 pm Post subject: Word censoring/replacement with phpBB |
|
|
Would it be possible to make a small mod so its only guests that get effected by word censoring ?
The reason:
Sometimes Adsense gets beserk with certain topics. Fx. we had a user calling himself Tomcat and suddenly we get a lot of animal related ads. I had to rename him to tomc_at to get the ads back to normal.
It would be nice if it only was guests that gets effected and not the regular members when using word censoring to stear Adsense in the right direction. |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
Posted: Wed Nov 01, 2006 11:51 am Post subject: Re: Word censoring/replacement with phpBB |
|
|
Actually, it's not a bad idea.
And I think it's easy to do :
Open :
| Code: | | Includes/functions.php |
Find :
| Code: | function obtain_word_list(&$orig_word, &$replacement_word)
{
global $db;
//
// Define censored word matches
//
$sql = "SELECT word, replacement
FROM " . WORDS_TABLE;
//Begin sql cache
//if( !($result = $db->sql_query($sql)) )
if( !($result = $db->sql_query($sql, false, true)) )
//End sql cache
{
message_die(GENERAL_ERROR, 'Could not get censored words from database', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$orig_word[] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i';
$replacement_word[] = $row['replacement'];
}
while ( $row = $db->sql_fetchrow($result) );
}
return true;
} |
Replace with :
| Code: | function obtain_word_list(&$orig_word, &$replacement_word)
{
global $db, $userdata;
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
// Only return the censoring to guests users
if( $userdata['session_logged_in'] ) {
//
// Define censored word matches
//
$sql = "SELECT word, replacement
FROM " . WORDS_TABLE;
//Begin sql cache
//if( !($result = $db->sql_query($sql)) )
if( !($result = $db->sql_query($sql, false, true)) )
//End sql cache
{
message_die(GENERAL_ERROR, 'Could not get censored words from database', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$orig_word[] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i';
$replacement_word[] = $row['replacement'];
}
while ( $row = $db->sql_fetchrow($result) );
}
} else {
$orig_word = $replacement_word = array();
}
// www.phpBB-SEO.com SEO TOOLKIT END
return true;
} |
But, this means there won't be any censoring for logged users. And, if for example a word is censored in a topic title, it will thus be replaced in URL for guests, and AdSense will see the logged in version of it if the page is loaded by a logged in user.
This mean the zero duplicate would be necessary to avoid duplicate content, even if the problem should not occur that often.
Another way to turn around this would be to set up your AdSense account to filter such bad adds.
Though, this make me think that we could use a separate censoring word list for anything injected in URLs, but this would mean many more changes.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
euroman PR0

Joined: 21 Oct 2006 Posts: 81
|
Posted: Wed Nov 01, 2006 12:22 pm Post subject: Re: Word censoring/replacement with phpBB |
|
|
Thats cool
I am using simple rewrite with no words in urls - so that means I can use your suggestet mod as is with no problems - right ?
The ultimate solution I think would be that the censoring was only active for one (or a couple?) IP namely Mediapartners-Google/2.1. That way only the adsense bot would se the censoring and not even other guests or the google "content bot" (ie the search results in google wouldnt be affected). Dont know if thats easy or difficult to implement ?
Also if it was only Adsense bot who could see censured words you could actully use censoring as a tool - say replacing common words with special searchwords you want to affect the ads. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
Posted: Wed Nov 01, 2006 5:19 pm Post subject: Re: Word censoring/replacement with phpBB |
|
|
Exactly, this is safe to use up to the phpBB SEO mixed mod rewrite, as we should not use tricky keywords in our forums and categories URLs.
Then, censoring based on IP and / OR User Agent recognition would mean cloaking, eg showing different content to bots than to human.
And this is not a good thing to do as it's on of the number one way to get blacklisted by Google.
Have you had a look to your AdSense filters ?
And, at least for User names, the regular user name censoring would be enough to prevent bad user name registration.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
euroman PR0

Joined: 21 Oct 2006 Posts: 81
|
Posted: Wed Nov 01, 2006 5:47 pm Post subject: Re: Word censoring/replacement with phpBB |
|
|
OK you are right.
I just tried the MOD but nothing happens at all. The censored words are still censored both for the logged in users and for the guests ?? |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
euroman PR0

Joined: 21 Oct 2006 Posts: 81
|
Posted: Wed Nov 01, 2006 6:08 pm Post subject: Re: Word censoring/replacement with phpBB |
|
|
Yes even if I close all windows first - then reopen the window- press refresh - log on with a different user. No change - word censoring still in effect. Also tried to add a new censored word - still censoring.
I have just copied the code as is - I have not removed any // or so.
This is from includes/functions.php I just downloaded from my site:
| Code: | //
// Obtain list of naughty words and build preg style replacement arrays for use by the
// calling script, note that the vars are passed as references this just makes it easier
// to return both sets of arrays
//
function obtain_word_list(&$orig_word, &$replacement_word)
{
global $db, $userdata;
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
// Only return the censoring to guests users
if( $userdata['session_logged_in'] ) {
//
// Define censored word matches
//
$sql = "SELECT word, replacement
FROM " . WORDS_TABLE;
//Begin sql cache
//if( !($result = $db->sql_query($sql)) )
if( !($result = $db->sql_query($sql, false, true)) )
//End sql cache
{
message_die(GENERAL_ERROR, 'Could not get censored words from database', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$orig_word[] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i';
$replacement_word[] = $row['replacement'];
}
while ( $row = $db->sql_fetchrow($result) );
}
} else {
$orig_word = $replacement_word = array();
}
// www.phpBB-SEO.com SEO TOOLKIT END
return true;
}
//
// This is general replacement for die(), allows templated
// output in users ( |
|
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
euroman PR0

Joined: 21 Oct 2006 Posts: 81
|
Posted: Wed Nov 01, 2006 6:26 pm Post subject: Re: Word censoring/replacement with phpBB |
|
|
Works now - Thanks  |
|
|
| Back to top |
|
 |
|
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|