bbCodes for Links bbCodes for Links
 

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]

Main Menu

bbCodes for Links

Started by brokenclaw, April 03, 2006, 06:37:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

brokenclaw

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?

Joachim Müller

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, findfunction 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 withfunction 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$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}" target="_blank">{DESCRIPTION}</a></span>';and replace with$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}">{DESCRIPTION}</a></span>';

brokenclaw

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.