[2.0.19] Local Links

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
13
81%
Very Good
2
13%
Good
0
No votes
Fair
1
6%
Poor
0
No votes
 
Total votes : 16

[2.0.19] Local Links

Postby MOD Robot » Sun Feb 12, 2006 10:44 pm

MOD Name: Local Links
Author: drathbun
MOD Description: This MOD alters the way local links work. When someone posts a link from one topic to another topic within the same board it won't open in a new window.


MOD Version: 1.0.0

Download File: local_links.1.0.0.zip
mods overview page: View
File Size: 2418 Bytes

Security Score: 0

Support for this MOD needs to be asked within this topic. The phpBB Teams are not responsible or required to give anyone support for this MOD. By installing this MOD, the phpBB Support Team or phpBB MODifications Team may not be able to provide support.

This MOD has only been tested by the phpBB MOD Team with the phpBB version in the topic title. It may not work in any other versions of phpBB.
Last edited by MOD Robot on Mon Apr 30, 2007 12:30 am, edited 1 time in total.
(this is a non-active account manager for the phpBB MOD Team)
MOD Robot
MOD Queue Bot
MOD Queue Bot
 
Posts: 22156
Joined: Sat Aug 16, 2003 7:36 am

Postby Fountain of Apples » Mon Feb 27, 2006 11:28 pm

MOD Validated/Released

Notes:
Links made to anywhere on your board within a post won't open in a new window. For example, http://www.yourdomain.tld/pathtoforum/viewtopic.php?t=1 wouldn't open in a new window, while http://www.google.com would.
User avatar
Fountain of Apples
Former Team Member
 
Posts: 3725
Joined: Fri Jun 11, 2004 2:30 am
Location: Washington, DC

Postby drathbun » Tue Feb 28, 2006 2:03 am

There are no screenshots or supplemental information for this MOD. A very simple description is this...

This MOD takes the configuration information for your site from the $board_config array. From there it compares any item processed by the make_clickable() function. If the item is "local" meaning that it is located on the same server and (optionally) within the same directory path as your board, then it removes the target="_blank" code from the URL that is created. That way when someone links from one post to another post within your board they stay in the same browser window instead of opening a new one. 8)
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
 
Posts: 12160
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE

Postby tony44 » Tue Feb 28, 2006 2:38 am

Nice mod 8)
tony44
Registered User
 
Posts: 232
Joined: Sun Apr 17, 2005 4:34 pm

Postby freddie » Mon Mar 06, 2006 11:28 pm

sweet, works perfect :)
my homepage
who can convert this mod to phpbb ??? - sorry for my english ;)
User avatar
freddie
Registered User
 
Posts: 400
Joined: Sun Mar 31, 2002 1:40 pm
Location: Leuven, Belgium

Postby fahraeus » Fri Mar 10, 2006 1:10 am

Nice... it works...

But not if http:// is left out...

www.phpbb.com will still open in a new window (if mod was on this board)...

Is there a way around this, so that www.phpbb.com would open in the same window?
fahraeus
Registered User
 
Posts: 134
Joined: Tue Nov 23, 2004 3:47 pm

Postby drathbun » Sun Mar 12, 2006 3:21 pm

Remove this line:
Code: Select all
   $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';

... and the http or https is no longer required. 8) That's one of the lines in the new function, so open bbcode.php and remove it. If you want you can probably remove this line as well, especially if you're not using an alternate server port:
Code: Select all
   $server_port = (( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) : '') . '/';

FWIW, I don't use either of these two lines on my board. 8)
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
 
Posts: 12160
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE

Postby fahraeus » Sun Mar 12, 2006 9:10 pm

Thank you for your information!
fahraeus
Registered User
 
Posts: 134
Joined: Tue Nov 23, 2004 3:47 pm

Postby fahraeus » Sun Mar 12, 2006 11:15 pm

Hmmmm, removed the lines. But local links starting with www still open in a new window...

Ideas?
fahraeus
Registered User
 
Posts: 134
Joined: Tue Nov 23, 2004 3:47 pm

Postby drathbun » Tue Mar 14, 2006 4:39 pm

fahraeus wrote:Hmmmm, removed the lines. But local links starting with www still open in a new window...

Ideas?

It depends on how your sitename is defined in your config panel. All this MOD does it look for your sitename (url) within the link, and if found, it removes the target="_blank" text from the clickable link.

The "www" or no "www" is actually mentioned in the author notes.
Author Notes wrote:## Note that a user can circumvent this by leaving the www off
## of (or adding it in to) the link that they post. You can
## consider that a feature or a bug. :-)

If you want to look just for your sitename, whether it has the "www" in front or not, you can adjust the code to remove the "www" (if present) from your sitename, or simply hard-code your sitename instead of using the $board_config[] array entry. Find this line:
Code: Select all
   $server_name = strtolower($board_config['server_name']);

And replace it with (assuming your site is www.example.com and you want it to work for sites with or without the www) this line:
Code: Select all
   $server_name = 'example.com';

That will find only that specific string, and then remove the target="_blank" for all instances of your domain, with or without the www.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
 
Posts: 12160
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE

Postby Xusqui » Wed Apr 19, 2006 12:28 pm

I have version 0.5.0 [Beta] of this mod installed in my board... How should I upgrade to this approved version?

Thanks!!
User avatar
Xusqui
Registered User
 
Posts: 84
Joined: Wed Jun 02, 2004 10:35 pm

Postby BMX DIRECT » Wed Apr 19, 2006 5:13 pm

nice mod. thanks
User avatar
BMX DIRECT
Registered User
 
Posts: 200
Joined: Thu Oct 14, 2004 10:49 pm
Location: Poison city

Postby drathbun » Wed Apr 19, 2006 8:02 pm

Xusqui wrote:I have version 0.5.0 [Beta] of this mod installed in my board... How should I upgrade to this approved version?

There are very minimal changes. In fact, it just adds one big block of code. I think if you replace the new function that was added you would be fine. But to be honest, I don't remember 0.5.0 at all. :oops:
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
 
Posts: 12160
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE

Postby BMX DIRECT » Thu Apr 20, 2006 12:50 am

i installed this MOD earlier and my board seems quite a bit slower ( i tested on 2 PCs)....is it the MOD or did i do something wrong when installing. I used EM so i dont think i could have messed up. Installation went fine.

Any clues?? :roll:
User avatar
BMX DIRECT
Registered User
 
Posts: 200
Joined: Thu Oct 14, 2004 10:49 pm
Location: Poison city

Postby drathbun » Thu Apr 20, 2006 2:25 am

It should not be slower.

You can test by adding a return right after the first line of the included function, that will short-circuit the MOD without having to remove it all. Check and see if your board is still slow. If it is, then it's something else. If it's not slow anymore, and you remove that line and it slows down again, then I guess it would have to be assumed to be my code.

I'm not a fancy "regular expressions" guy, so I'm sure that the code could be more efficient than it is now. I'm doing the brute-force approach with string operations. But on the other hand, I've used this on many boards and never noticed a slowdown specific to this.

Specific change instructions...
find this
Code: Select all
function local_urls($text)
{
        global $board_config;

After, add this:
Code: Select all
return $text;

That will return the post text back exactly the way it came in, without doing any processing.

Let me know how your testing goes.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
 
Posts: 12160
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE

Next

Return to [2.0.x] MOD Database Releases

Who is online

Users browsing this forum: No registered users and 4 guests