coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: Chribu on February 09, 2005, 02:28:41 AM

Title: Supporting non http:// links such as magnet, edonkey, ..
Post by: Chribu on February 09, 2005, 02:28:41 AM
I'd like to upload screenshots of videos with the relative p2p download link, such as:
magnet:?xt=urn:tree:tiger:HROOEAT4TKPVS227BFB5VUNYKNAUPKJFKZ46LMQ&dn=Myhomevideo1.avi
but if i put it as [ url=magnet:?xt=urn:tree:tiger:HROOEAT4TKPVS227BFB5VUNYKNAUPKJFKZ46LMQ&dn=Myhomevideo1.avi ]link[/url] i get a link pointing to http://magnet:?xt=urn:tree:tiger:HROOEAT4TKPVS227BFB5VUNYKNAUPKJFKZ46LMQ&dn=Myhomevideo1.avi

The easiest thing to have would be forcing one of the custom fields to show its content as a link
e.g. i add custom field hash, in there i can just type magnet:?xt=urn:tree:tiger:HROOEAT4TKPVS227BFB5VUNYKNAUPKJFKZ46LMQ&dn=Myhomevideo1.avi and it automatically comes printed as a link.
Would it be simple to do just changing something in the code?
Any suggestions?

Thanks in advance
Chribu
Title: Re: Supporting non http:// links such as magnet, edonkey, ..
Post by: Chribu on February 12, 2005, 06:32:51 PM
kinda solved by modifying
/include/functions.inc.php

and changing lines

            // $bbcode_tpl['url2'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['url']);
               // $bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url2']);
      $bbcode_tpl['url2'] = str_replace('{URL}', 'magnet:?xt=urn:tree:tiger:\\1', $bbcode_tpl['url']);
               $bbcode_tpl['url2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['url2']);
           //     $patterns[2] = "#\[url\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#si";
           //     $replacements[2] = $bbcode_tpl['url2'];
                $patterns[2] = "#\[cf\]([A-Z0-9]+)\[cf\]#si";
                $replacements[2] = $bbcode_tpl['url2'];

i'm no good at php but it works a bit.