Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: [Solved]: Making non-www web address clickable?  (Read 3932 times)

0 Members and 1 Guest are viewing this topic.

MarianneC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
[Solved]: Making non-www web address clickable?
« on: August 28, 2008, 05:12:09 am »

Hi,

I've noticed that displayimage.php makes any www.somewebaddress.com clickable.  That's great.  However, if the web address is simply somewebaddress.com or something.somewebaddress.com, it comes out as straight text. 

How can I make either form clickable?

Thank you!
Marianne
« Last Edit: August 29, 2008, 03:29:43 pm by Nibbler »
Logged

johanz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
Re: Making non-www web address clickable?
« Reply #1 on: August 28, 2008, 11:50:25 am »

But what if there is text like I went to school.Commie went away
It will be made url too. I don't really understand why you want this.
Just add http:// to link, I think it will become link too
Logged

MarianneC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
Re: Making non-www web address clickable?
« Reply #2 on: August 29, 2008, 05:16:37 am »

Thanks Johanz.  In our case, other folks don't submit, so that is less of a risk.  But I do understand your point.   :)
Logged

Nibbler

  • Guest
Re: Making non-www web address clickable?
« Reply #3 on: August 29, 2008, 12:24:54 pm »

Edit include/functions.inc.php, find

Code: [Select]
        $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" rel=\"external\">www.\\2.\\3\\4</a>", $ret);

change to

Code: [Select]
        $ret = preg_replace("#([\n ])(www\.)?([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://\\2\\3.\\4\\5\" rel=\"external\">\\2\\3.\\4\\5</a>", $ret);
Logged

MarianneC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
Re: Making non-www web address clickable?
« Reply #4 on: August 29, 2008, 02:05:15 pm »

Thank you, Nibbler!  That works great for us!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: Making non-www web address clickable?
« Reply #5 on: August 29, 2008, 09:13:11 pm »

@MarianneC: resolve your threads by clicking on the OK-tick in your initial posting on a thread. I did this for you. Do it yourself in the future.
Logged

MarianneC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
Re: [Solved]: Making non-www web address clickable?
« Reply #6 on: August 29, 2008, 11:05:32 pm »

Thanks Joachim - eventually I will get the hang of all this.
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 15 queries.