Supporting non http:// links such as magnet, edonkey, .. Supporting non http:// links such as magnet, edonkey, ..
 

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

Supporting non http:// links such as magnet, edonkey, ..

Started by Chribu, February 09, 2005, 02:28:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chribu

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

Chribu

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.