| Author |
Message |
sarmient New Member


Joined: Aug 18, 2005 Posts: 9
|
Posted:
Sun Dec 11, 2005 10:10 am |
|
How to add this to my Forums? (as I see in your forums):
| Code: | Only registered users can see links on this board!
Get registered or login to the forums! |
Is there any mod or something?
Thanks in advance  |
|
|
|
 |
hitwalker Sells PC To Pay For Divorce

Joined: Posts: 5661
|
Posted:
Sun Dec 11, 2005 10:40 am |
|
Here you go...
| Code: | #################################################################
## Mod Title: Hide Links
## Mod Author: Nome < > 162783614
## Mod Version: 2.1.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.1.0 - Updated with latest bugfixes from phpbb groupe
## - 2.0.0 - Fixed a bug with [url] links
## - 1.0.0 - First released
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
function bbencode_second_pass($text, $uid)
{
global $lang, $bbcode_tpl;
#
#-----[ REPLACE WITH ]------------------------------------
#
function bbencode_second_pass($text, $uid)
{
global $lang, $bbcode_tpl, $userdata, $phpEx, $u_login_logout;
// The thing we replace links with. I like using a quote like box
$replacer = '<table width="40%" cellspacing="1" cellpadding="3" border="0"><tr><td class="quote">';
$replacer .= $lang['Links_Allowed_For_Registered_Only'] . '<br />';
$replacer .= sprintf($lang['Get_Registered'], "<a href=\"" . append_sid('profile.' . $phpEx . '?mode=register') . "\">", "</a>");
$replacer .= sprintf($lang['Enter_Forum'], "<a href=\"" . append_sid($u_login_logout) . "\">", "</a>");
$replacer .= '</td></tr></table>';
#
#-----[ FIND ]------------------------------------------
#
// matches a [url]xxxx://www.phpbb.com[/url] code..
$patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url1'];
// [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
$patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url2'];
// [url=xxxx://www.phpbb.com]phpBB[/url] code..
$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?\n\r\t].*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url3'];
// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\]([^?\n\r\t].*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url4'];
// [email]user@domain.tld[/email] code..
$patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
$replacements[] = $bbcode_tpl['email'];
#
#-----[ REPLACE WITH ]------------------------------------
#
// matches a [url]xxxx://www.phpbb.com[/url] code..
$patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is";
if ( !$userdata['session_logged_in'] )
{
$replacements[] = $replacer;
}
else
{
$replacements[] = $bbcode_tpl['url1'];
}
// [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
$patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is";
if ( !$userdata['session_logged_in'] )
{
$replacements[] = $replacer;
}
else
{
$replacements[] = $bbcode_tpl['url2'];
}
// [url=xxxx://www.phpbb.com]phpBB[/url] code..
$patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\]([^?\n\r\t].*?)\[/url\]#is";
if ( !$userdata['session_logged_in'] )
{
$replacements[] = $replacer;
}
else
{
$replacements[] = $bbcode_tpl['url3'];
}
// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
$patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\]([^?\n\r\t].*?)\[/url\]#is";
if ( !$userdata['session_logged_in'] )
{
$replacements[] = $replacer;
}
else
{
$replacements[] = $bbcode_tpl['url4'];
}
// [email]user@domain.tld[/email] code..
$patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\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]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $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)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
// matches an email@domain 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<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $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 = ' <table width="40%" cellspacing="1" cellpadding="3" border="0"><tr><td class="quote">';
$replacer .= $lang['Links_Allowed_For_Registered_Only'] . '<br />';
$replacer .= sprintf($lang['Get_Registered'], "<a href=\"" . append_sid('profile.' . $phpEx . '?mode=register') . "\">", "</a>");
$replacer .= sprintf($lang['Enter_Forum'], "<a href=\"" . append_sid($u_login_logout) . "\">", "</a>");
$replacer .= '</td></tr></table>';
// 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]+?://[^ \"\n\r\t<]*)#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)\.[^ \"\t\n\r<]*)#is", $replacer, $ret);
// matches an email@domain 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]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $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)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
// matches an email@domain 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<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $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 |
|
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Thu Jun 08, 2006 8:58 am |
|
have anyone complete? and can upload the php files
i cant get it working
who can give me pho en tlp files??
the version doenst matter but not lower then 2.0.15
and for bbnuke
not normal phpbb
big thx anyway |
|
|
|
 |
hitwalker Sells PC To Pay For Divorce

Joined: Posts: 5661
|
Posted:
Thu Jun 08, 2006 9:01 am |
|
this isnt realy related to a paticular version,and it does work....
just take your time to edit.. |
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Thu Jun 08, 2006 9:19 am |
|
i cant find many thing i use CTRL+F and search but no result :S im a big n00b in php |
|
|
|
 |
hitwalker Sells PC To Pay For Divorce

Joined: Posts: 5661
|
Posted:
Thu Jun 08, 2006 9:30 am |
|
well my files are edited so i cant swap files..
or just hire someone to do it.. |
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Thu Jun 08, 2006 9:35 am |
|
can u give me u r edited files??? |
|
|
|
 |
Susann Moderator

Joined: Dec 19, 2004 Posts: 3143 Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Thu Jun 08, 2006 9:44 am |
|
That´s very simple to install. Try it again and if you have several languages you need to edit the lang_main for that language in the folder modules/Forums/language. |
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Thu Jun 08, 2006 10:05 am |
|
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
--------------------------------------------------------------------------------
Apache/1.3.33 Server at djvid.freehostia.com Port 80
thats when i appely :'(
Forum:
what are im doing wrong (try to start a topic to see result
Edit: when i pt the orginal files back it works fine but not whit the edited |
|
|
|
 |
Susann Moderator

Joined: Dec 19, 2004 Posts: 3143 Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Thu Jun 08, 2006 10:18 am |
|
That´s strange because there is only simple add or replace. How can this produce server error 500 ? |
Last edited by Susann on Thu Jun 08, 2006 10:23 am; edited 1 time in total |
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Thu Jun 08, 2006 10:21 am |
|
thats just the question
i think a big problem in my editing im a real big n00b |
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Thu Jun 08, 2006 11:15 am |
|
Something changed
and now when i try to start toic
i will get blank page
look: |
|
|
|
 |
Susann Moderator

Joined: Dec 19, 2004 Posts: 3143 Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Thu Jun 08, 2006 11:25 am |
|
Try it again it´s a good exercise (always backup your original file) maybe use a better editor.
After you add the code in the lang_english/lang_main.php you ´ll see this in action but only if you have a post with a link in your forum.  |
Last edited by Susann on Thu Jun 08, 2006 12:32 pm; edited 1 time in total |
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Thu Jun 08, 2006 12:13 pm |
|
i have doing that
could u check my 2 files
may u can find the problem
Here the files
thanks in advance  |
|
|
|
 |
hitwalker Sells PC To Pay For Divorce

Joined: Posts: 5661
|
Posted:
Thu Jun 08, 2006 12:47 pm |
|
who installed your site then if your knowledge is like 0 ?
And btw...do you know that your site will be deleted after 1 year.... |
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Thu Jun 08, 2006 12:52 pm |
|
i installed by my self
and where can i see the Knowledge?
and why it will be deleted in 1 year
in that time there are many new versions
but is there something whong on php files? |
|
|
|
 |
Susann Moderator

Joined: Dec 19, 2004 Posts: 3143 Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Thu Jun 08, 2006 1:32 pm |
|
The lang_main is ok and the bbcode.php produced an error
Parse error: parse error, unexpected '[' in /bbcode.php on line 208 on my site.
You need to change only this on line 207 - 208
#
// matches a code.. |
|
|
|
 |
hitwalker Sells PC To Pay For Divorce

Joined: Posts: 5661
|
Posted:
Thu Jun 08, 2006 2:32 pm |
|
thats the rule of the free hosting you have,after one year it will be terminated,but then you can start over again...
i think your dutch.... |
|
|
|
 |
Susann Moderator

Joined: Dec 19, 2004 Posts: 3143 Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Thu Jun 08, 2006 2:49 pm |
|
Hitwalker is this a discussion about hosting, code, knowledge or something else  |
|
|
|
 |
hitwalker Sells PC To Pay For Divorce

Joined: Posts: 5661
|
Posted:
Thu Jun 08, 2006 3:04 pm |
|
no none of it...
i just made him aware of the fact that his site will last a year,i saw that... |
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Fri Jun 09, 2006 12:58 am |
|
changed but now i get
[hide:de1681a091]test[/hide:de1681a091]
heuh
and hitwalker: yes im dutch |
|
|
|
 |
Susann Moderator

Joined: Dec 19, 2004 Posts: 3143 Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Fri Jun 09, 2006 8:51 am |
|
From Line 207 to 209 looks like this:
| Code: |
#
// matches a [url]xxxx://www.phpbb.com[/url] code..
$patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is"; |
and the next is on line 211:
if ( !$userdata['session_logged_in'] ) |
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Fri Jun 09, 2006 9:16 am |
|
| Susann wrote: | From Line 207 to 209 looks like this:
| Code: |
#
// matches a [url]xxxx://www.phpbb.com[/url] code..
$patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is"; |
and the next is on line 211:
if ( !$userdata['session_logged_in'] ) |
i have doing that
and now i see online the [hide]Test 1,2,3[/hide] on forum not hided  |
|
|
|
 |
Susann Moderator

Joined: Dec 19, 2004 Posts: 3143 Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Fri Jun 09, 2006 9:39 am |
|
Works perfectly:
Please remove my link.
 |
|
|
|
 |
djvideofan New Member


Joined: Jun 08, 2006 Posts: 14
|
Posted:
Fri Jun 09, 2006 9:48 am |
|
but not the Hide the hide mot is not working perfectly i think |
|
|
|
 |
|
|
|
|