# Phpbb mod to hide email addresses?



## Elsterap (Dec 3, 2005)

Is there one anyone knows of? I cant find one but there mustr be one out there surely?

A rival site to mine is stealing my users by collecting their email addresses.


----------



## Sequal7 (Apr 15, 2001)

################################################################# 
## Mod Title: Hide Links 
## Mod Version: 2.2.0 
## Mod Description: This mod will prevent links from being shown 
## to unregistered users. Instead they'll be 
## advised to register or login. 
## Mod Features: 
## - hide http links and email from unregistered users 
## 
## Installation Level: Very Easy 
## Installation Time: 3 Minutes 
## 
## Files To Edit: 2
## includes/bbcode.php 
## language/lang_english/lang_main.php 
## 
################################################################# 
## Author's notes: 
## In order to change the thing you get instead of a link 
## edit $replacer. By default there is a quotelike box. 
## Pay attention to the fact that the second block of $replacers 
## has a space in the first line, it's a must there  
################################################################# 
################################################################# 
## History 
## - 2.2.0 - Updated with latest bugfixes from phpbb group 
## - 2.1.0 - Updated with latest bugfixes from phpbb group 
## - 2.0.0 - Fixed a bug with links
## - 1.0.0 - First released...= sprintf($lang['Get_Registered'], "[URL]", ""); 
$replacer .= sprintf($lang['Enter_Forum'], "", ""); 
$replacer .= '[/TD][/TR][/TABLE]';

# 
#-----[ FIND ]------------------------------------------ 
# 
// matches a xxxx://www.phpbb.com code.. 
$patterns[] = "#\[url\]([\w]+?://([\w\#$%&~/.\-;:=,[email protected]\]+]|\[(?!url=))*?)\[/url\]#is"; 
$replacements[] = $bbcode_tpl['url1'];

// www.phpbb.com code.. (no xxxx:// prefix). 
$patterns[] = "#\[url\]((www|ftp)\.([\w\#$%&~/.\-;:=,[email protected]\]+]|\[(?!url=))*?)\[/url\]#is"; 
$replacements[] = $bbcode_tpl['url2'];

// phpBB code.. 
$patterns[] = "#\+?://[\w\#$%&~/.\-;:=,[email protected]\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is"; 
$replacements[] = $bbcode_tpl['url3'];

// [url=www.phpbb.com]phpBB code.. (no xxxx:// prefix). 
$patterns[] = "#\+]*?)\]([^?\n\r\t].*?)\[/url\]#is"; 
$replacements[] = $bbcode_tpl['url4'];

// [email][email protected][/email] code.. 
$patterns[] = "#\[email\]([a-z0-9&\-_.][email protected][\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si"; 
$replacements[] = $bbcode_tpl['email'];

# 
#-----[ REPLACE WITH ]------------------------------------ 
# 
// matches a [URL]xxxx://www.phpbb.com code.. 
$patterns[] = "#\[url\]([\w]+?://([\w\#$%&~/.\-;:=,[email protected]\]+]|\[(?!url=))*?)\[/url\]#is"; 
if ( !$userdata['session_logged_in'] ) 
{ 
$replacements[] = $replacer; 
} 
else 
{ 
$replacements[] = $bbcode_tpl['url1']; 
}

// www.phpbb.com code.. (no xxxx:// prefix). 
$patterns[] = "#\[url\]((www|ftp)\.([\w\#$%&~/.\-;:=,[email protected]\]+]|\[(?!url=))*?)\[/url\]#is"; 
if ( !$userdata['session_logged_in'] ) 
{ 
$replacements[] = $replacer; 
} 
else 
{ 
$replacements[] = $bbcode_tpl['url2']; 
}

// phpBB code.. 
$patterns[] = "#\+?://[\w\#$%&~/.\-;:=,[email protected]\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is"; 
if ( !$userdata['session_logged_in'] ) 
{ 
$replacements[] = $replacer; 
} 
else 
{ 
$replacements[] = $bbcode_tpl['url3']; 
}

// [url=www.phpbb.com]phpBB code.. (no xxxx:// prefix). 
$patterns[] = "#\+]*?)\]([^?\n\r\t].*?)\[/url\]#is"; 
if ( !$userdata['session_logged_in'] ) 
{ 
$replacements[] = $replacer; 
} 
else 
{ 
$replacements[] = $bbcode_tpl['url4']; 
}

// [email][email protected][/email] code.. 
$patterns[] = "#\[email\]([a-z0-9&\-_.][email protected][\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si"; 
if ( !$userdata['session_logged_in'] ) 
{ 
$replacements[] = $replacer; 
} 
else 
{ 
$replacements[] = $bbcode_tpl['email']; 
}

# 
#-----[ FIND ]------------------------------------------ 
# 
function make_clickable($text) 
{

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
global $userdata, $lang, $phpEx, $u_login_logout;

# 
#-----[ FIND ]------------------------------------------ 
# 
// matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
// xxxx can only be alpha characters. 
// yyyy is anything up to the first space, newline, comma, double quote or < 
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", "\\1[URL]\\2", $ret);

// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
// Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
// zzzz is optional.. will contain everything up to the first space, newline, 
// comma, double quote or <. 
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", "\\1\\2", $ret);

// matches an [email protected] type address at the start of a line, or after a space. 
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". 
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1\\[email protected]\\3", $ret);

# 
#-----[ REPLACE WITH ]------------------------------------ 
# 
// 
// Hide links from unregistered users mod 
// 
if ( !$userdata['session_logged_in'] ) 
{ 
// The thing we replace links with. I like using a quote like box 
$replacer = ' 
'; 
$replacer .= $lang['Links_Allowed_For_Registered_Only'] . '
'; 
$replacer .= sprintf($lang['Get_Registered'], "", ""); 
$replacer .= sprintf($lang['Enter_Forum'], "", ""); 
$replacer .= '
';

// matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
// xxxx can only be alpha characters. 
// yyyy is anything up to the first space, newline, comma, double quote or < 
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", $replacer, $ret);

// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
// Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
// zzzz is optional.. will contain everything up to the first space, newline, 
// comma, double quote or <. 
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", $replacer, $ret);

// matches an [email protected] type address at the start of a line, or after a space. 
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". 
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", $replacer, $ret);

} 
else 
{ 
// matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
// xxxx can only be alpha characters. 
// yyyy is anything up to the first space, newline, comma, double quote or < 
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", "\\1\\2", $ret);

// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
// Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
// zzzz is optional.. will contain everything up to the first space, newline, 
// comma, double quote or <. 
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", "\\1\\2", $ret);

// matches an [email protected] type address at the start of a line, or after a space. 
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". 
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1\\[email protected]\\3", $ret); 
} 
// 
// Hide links from unregistered users mod 
//

# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------ 
# 
$lang['A_critical_error'] =

# 
#-----[ AFTER, ADD ]------------------------------------ 
#

// 
// Hide links from unregistered users mod 
// 
$lang['Links_Allowed_For_Registered_Only'] = 'Only registered users can see links on this board!'; 
$lang['Get_Registered'] = 'Get %sregistred%s or '; 
$lang['Enter_Forum'] = '%senter%s the forums!';

#-----[ SAVE/CLOSE ALL FILES ]-------------------------- 
# 
#EoM


----------

