Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
sarmient
New Member
New Member



Joined: Aug 18, 2005
Posts: 9

PostPosted: Sun Dec 11, 2005 10:10 am Reply with quote

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 Smile
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Sun Dec 11, 2005 10:40 am Reply with quote

Here you go...


Code:
#################################################################

## Mod Title: Hide Links
## Mod Author: Nome < nome@bk.ru > 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
 
View user's profile Send private message
djvideofan
New Member
New Member



Joined: Jun 08, 2006
Posts: 14

PostPosted: Thu Jun 08, 2006 8:58 am Reply with quote

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
 
View user's profile Send private message
hitwalker







PostPosted: Thu Jun 08, 2006 9:01 am Reply with quote

this isnt realy related to a paticular version,and it does work....
just take your time to edit..
 
djvideofan







PostPosted: Thu Jun 08, 2006 9:19 am Reply with quote

i cant find many thing i use CTRL+F and search but no result :S im a big n00b in php
 
hitwalker







PostPosted: Thu Jun 08, 2006 9:30 am Reply with quote

well my files are edited so i cant swap files..
or just hire someone to do it..
 
djvideofan







PostPosted: Thu Jun 08, 2006 9:35 am Reply with quote

can u give me u r edited files???
 
Susann
Moderator



Joined: Dec 19, 2004
Posts: 3191
Location: Germany:Moderator German NukeSentinel Support

PostPosted: Thu Jun 08, 2006 9:44 am Reply with quote

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.
 
View user's profile Send private message
djvideofan







PostPosted: Thu Jun 08, 2006 10:05 am Reply with quote

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, support@freehostia.com 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: http://djvid.freehostia.com/modules.php?name=Forums&file=index
what are im doing wrong (try to start a topic to see result Confused

Edit: when i pt the orginal files back it works fine but not whit the edited
 
Susann







PostPosted: Thu Jun 08, 2006 10:18 am Reply with quote

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







PostPosted: Thu Jun 08, 2006 10:21 am Reply with quote

thats just the question

i think a big problem in my editing Confused im a real big n00b
 
djvideofan







PostPosted: Thu Jun 08, 2006 11:15 am Reply with quote

Something changed

and now when i try to start toic
i will get blank page

look: http://djvid.freehostia.com/modules.php?name=Forums
 
Susann







PostPosted: Thu Jun 08, 2006 11:25 am Reply with quote

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. Laughing


Last edited by Susann on Thu Jun 08, 2006 12:32 pm; edited 1 time in total 
djvideofan







PostPosted: Thu Jun 08, 2006 12:13 pm Reply with quote

i have doing that

could u check my 2 files
may u can find the problem

Here the files
http://eazyshare.net/files/1648/BBCodeLangMainForNukebb.rar

thanks in advance Smile
 
hitwalker







PostPosted: Thu Jun 08, 2006 12:47 pm Reply with quote

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







PostPosted: Thu Jun 08, 2006 12:52 pm Reply with quote

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







PostPosted: Thu Jun 08, 2006 1:32 pm Reply with quote

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 Only registered users can see links on this board! Get registered or login! code..
 
hitwalker







PostPosted: Thu Jun 08, 2006 2:32 pm Reply with quote

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







PostPosted: Thu Jun 08, 2006 2:49 pm Reply with quote

Hitwalker is this a discussion about hosting, code, knowledge or something else Question
 
hitwalker







PostPosted: Thu Jun 08, 2006 3:04 pm Reply with quote

no none of it...
i just made him aware of the fact that his site will last a year,i saw that...
 
djvideofan







PostPosted: Fri Jun 09, 2006 12:58 am Reply with quote

changed but now i get

[hide:de1681a091]test[/hide:de1681a091]

heuh

and hitwalker: yes im dutch
 
Susann







PostPosted: Fri Jun 09, 2006 8:51 am Reply with quote

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







PostPosted: Fri Jun 09, 2006 9:16 am Reply with quote

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 Confused
 
Susann







PostPosted: Fri Jun 09, 2006 9:39 am Reply with quote

Works perfectly:

http://djvid.freehostia.com/modules.php?name=Forums&file=viewtopic&p=6#6

Please remove my link.

Laughing
 
djvideofan







PostPosted: Fri Jun 09, 2006 9:48 am Reply with quote

but not the Hide the hide mot is not working perfectly i think
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©