forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: brokenclaw on April 03, 2006, 06:37:23 am

Title: bbCodes for Links
Post by: brokenclaw on April 03, 2006, 06:37:23 am
I have successfully installed Coppermine on my site at http://brokenclaw.net/gallery/index.php (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?
Title: Re: bbCodes for Links
Post by: Joachim Müller 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>';
Title: Re: bbCodes for Links
Post by: brokenclaw 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.