Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Mod Name / Version: Correctly hyperlink URL's with a comma(s) in them

Description: Some URL's contain one or more commas in them which will not hyperlink correctly when pasted into a post. This mod will allow them to hyperlink correctly.

Ex. http://www.thesun.co.uk/section/0,,3,00.html

This mod should work in versions other than 6.3, but I cannot confirm.

---
NOTE: It will only apply to URL's which begin with http:// and not ones that begin with www. since those have a greater chance of being placed within text that may be preceeded by a comma not related to the URL.

Ex. I recently visted www.example.com, and found the site quite interesting.
---

Working Under: UBB.Threads 6.3

Mod Status: Finished

Any pre-requisites:

Author(s): Twisty

Date: 03/24/04

Credits:

Files Altered: ubbt.inc.php

New Files:

Database Altered: no

Info/Instructions: In ubbt.inc.php

CHANGE THIS:

Code
        $Body = preg_replace("#([\n\r ])([a-z]+?)://([^, \n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $Body);

TO THIS:

Code
        $Body = preg_replace("#([\n\r ])([a-z]+?)://([^ \n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $Body);



Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Sponsored Links
Joined: Mar 2004
Posts: 118
Journeyman
Journeyman
Offline
Joined: Mar 2004
Posts: 118
Does anyone now why this link is not properly linked:
Google

Last edited by PaNTerSan; 04/23/2004 2:18 AM.

Kind regards,
PaNTerSan

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)