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: bbCodes for Links  (Read 4745 times)

0 Members and 1 Guest are viewing this topic.

brokenclaw

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
bbCodes for Links
« on: April 03, 2006, 06:37:23 am »

I have successfully installed Coppermine on my site at http://brokenclaw.net/gallery/index.php. I would like to add hyperlinks in the photo descriptions that link back to the associated web page on my site. I have read the Coppermine Photo Gallery v1.4.4: Documentation and Manual, section 4.10. The problem is that the links always open a new window/tab, which I don't think my users would want. Is there any way to code the links in Coppermine to open in the active window?
« Last Edit: April 05, 2006, 07:31:30 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: bbCodes for Links
« Reply #1 on: April 03, 2006, 07:00:39 am »

this has been changed in cpg1.4.x - the bbcode links then open in the same window. You're using cpg1.3.5, so you have posted in the wrong section of the board (cpg1.4 (BBS) integration / bridging). Moving your posting accordingly.
To fix your issue, upgrade to cpg1.4.4 or edit include/functions.inc.php, find
Code: [Select]
function make_clickable($text)
{
        $ret = " " . $text;
        $ret = preg_replace("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret);
        $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret);
        $ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
        $ret = substr($ret, 1);

        return($ret);
}
and replace with
Code: [Select]
function make_clickable($text)
{
        $ret = " " . $text;
        $ret = preg_replace("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#i", "\\1<a href=\"\\2://\\3\">\\2://\\3</a>", $ret);
        $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\">www.\\2.\\3\\4</a>", $ret);
        $ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
        $ret = substr($ret, 1);

        return($ret);
}
. Then find
Code: [Select]
$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}" target="_blank">{DESCRIPTION}</a></span>';and replace with
Code: [Select]
$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}">{DESCRIPTION}</a></span>';
Logged

brokenclaw

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: bbCodes for Links
« Reply #2 on: April 05, 2006, 03:06:06 am »

Sorry about the bad placement of my post... I must have been looking at the "Util mod 1.4" version in my Admin Tools.
Thanks for the help. I changed the code as you suggested and it works just fine.
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 20 queries.