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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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.