The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Extended auto-linker (adds ed2k and sip link recognition) Details »» | |||||||||||||||||||||||||||
Extended auto-linker (adds ed2k and sip link recognition)
Developer Last Online: Nov 2023
Extended auto-linker 0.2
20051003 by mip This plugin extends the auto-parse url option to recognize ed2k and sip (VoIP) links correctly. ed2k file links are pretty-printed with the file name and a human-readable file size. INSTALLATION: Upload and activate plugin as usual. If you want to automatically include a tag in a parsed ed2k link, you should uncomment line 67 (// $filenametag = ...) and set your desired tag. NOTES: This plugin uses (among other things) a slightly modified regex which allows "|" characters inside all auto-recognized URLs as required for ed2k links. SCREENSHOTS: Writing a post containing some ed2k and sip URIs. Auto-parse URL option must be on. Preview of posting with recognized URLs. Note the formatting of ed2k file urls with the human readable size. Show Your Support
|
Comments |
#2
|
||||
|
||||
First one to install, thank you!
|
#3
|
||||
|
||||
God job, but if the ed2k link contain [ ] don?t work correctly :surprised:
is a minor bug, but it is possible to be solved? tanks for the modification *installed |
#4
|
|||
|
|||
Didn't EDonkey shut down because of fileswapping? Does this technology now have a legal use then?
|
#5
|
||||
|
||||
Legal_controversy
Quote:
|
#6
|
||||
|
||||
Are they any options/settings for this?
|
#7
|
|||
|
|||
Any chance you can port this over as a vB 3.0 hack?
|
#8
|
|||
|
|||
I see this is still in the Beta stages. I hope you fix the square brackets "[]" problem as this hack is very promising.
I also think the option to add your own tag is a great idea, very cool indeed and that gives you the ability to advertise your site in the tag in links. I have one sugestion though. Make the ed2k links so they open in the same browser window instead of a new browser window. By doing that you won't have to close a new browser window everytime to add a link from the board. Also take a look here at this same ed2k code created for phpbb for some extra ideas that might prove useful. This hack has come a long way and is the best ed2k hack out there. I'm sure there is stuff in this below you can use. Code:
############################################################## ## MOD Title: eD2k Links add all Feature ## MOD Author: Simon Moon <simon@gomp.net> (Christian Riesen) http://www.blackpearltech.com/ ## MOD Authors: [ Oki/Mozes/Meithar/ppw ] ## ## MOD Description: Makes ed2k links for files and servers clickable and adds a link for adding all files in a post at once. ## MOD Version: 1.2.0 ## ## Installation Level: moderate ## Installation Time: 6 Minutes ## Files To Edit: 2 ## includes/bbcode.php ## viewtopic.php ## Included Files: images/mule_icon.gif (http://www.ed2k-it.com/forum/images/mule_icon.gif) ## images/ed2k-info.gif (http://www.ed2k-it.com/forum/images/ed2k-info.gif) ## ## Tested with phpBB Version 2.0.11 to 2.0.15 ## Forum Link: http://www.phpbb.com/phpBB/viewtopic.php?t=206016 ############################################################## ## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ ############################################################## ## Author Notes: ## If you have already installed a ed2k hack (which you mostlikely will have) ## check the files mentioned below anyways and change it to this version of ## the hack. This is very important to ensure it will work properly, otherwise ## you might have weird problems. ## Change the line below that looks like this to have a different text: ## $t_ed2kinsert .= "<a href='javascript:addall()'>Add ".$t_ed2k_confirmed." links to ed2k client</a> "; ## You can for example leave away the number of files. ############################################################## ## MOD History: ## 2005-05-07 - Version 1.2.0 ## - compatible with latest ed2k link formats ## - friendly readable names, kB, MB ## - added icons ## ## 2004-06-27 - Version 1.1.1 ## - Error with ' sign in filenames ## ## 2004-06-27 - Version 1.1.0 ## - Javascript bug in add all, predefining of filearray ## ## 2004-06-27 - Version 1.0.0 ## - First release, works fine, could use some different look ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ OPEN ]----------------------------------------------- # includes/bbcode.php # #-----[ FIND ]----- # $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url4']); # #-----[ AFTER, ADD ]----------------------------------------------- # // ed2k links $bbcode_tpl['url5'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']); $bbcode_tpl['url5'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['url5']); // ed2k links with description $bbcode_tpl['url6'] = str_replace('{URL}', '\\1', $bbcode_tpl['url']); $bbcode_tpl['url6'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url6']); // end ed2k links # #-----[ FIND ]----------------------------------------------- # // phpBB code.. (no xxxx:// prefix). $patterns[] = "#\[url=((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is"; $replacements[] = $bbcode_tpl['url4']; # #-----[ AFTER, ADD ]----------------------------------------------- # // url-ed2k, name code $patterns[] = "#\[url=(ed2k://\|file\|.*\|\d+\|\w+\|/?)\](.*?)\[/url\]#si"; $replacements[] = $bbcode_tpl['url5']; // name code $patterns[] = "#\[url=(ed2k:(//)?\|server\|[\d\.]+\|\d+\|/?)\](.*?)\[/url\]#si"; $replacements[] = $bbcode_tpl['url6']; // end url-ed2k # #-----[ FIND ]----------------------------------------------- # /** * Rewritten by Nathan Codding - Feb 6, 2001. * - Goes through the given string, and replaces xxxx://yyyy with an HTML <a> tag linking * to that URL # #-----[ BEFORE, ADD ]----------------------------------------------- # // ed2k links // Returns a file size formatted in a more human-friendly format, rounded // to the nearest Gb, Mb, Kb, or byte. function ed2k_humanize_size ($size, $rounder = 0, $min = '') { $sizes = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); $rounders = array(0, 0, 0, 2, 2, 3, 3, 3, 3); $ext = $sizes[0]; $rnd = $rounders[0]; if ($min == 'KB' && $size < 1024) { $size = $size / 1024; $ext = 'KB'; $rounder = 1; } else { for ($i=1, $cnt=count($sizes); ($i < $cnt && $size >= 1024); $i++) { $size = $size / 1024; $ext = $sizes[$i]; $rnd = $rounders[$i]; } } if (!$rounder) { $rounder = $rnd; } return round($size, $rounder) . ' ' . $ext; } function ed2k_link_callback ($m) { $max_len = 120; $href = 'href="' . $m[2] . '" class="postlink"'; $size = ed2k_humanize_size($m[4]); $fname = urldecode($m[3]); if (strlen($fname) > $max_len) { $fname = substr($fname, 0, $max_len - 19) . '...' . substr($fname, -16); } if (preg_match('#[<>"]#', $fname)) { $fname = htmlspecialchars($fname); } // added an icon in front of link (ppw) return "<img src='images/mule_icon.gif' border='0'> <a $href>$fname ($size)</a>"; } // ed2k links end # #-----[ FIND ]----------------------------------------------- # function make_clickable($text) { $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); // pad it with a space so we can match things at the start of the 1st line. $ret = ' ' . $text; # #-----[ AFTER, ADD ]------------------------------------------ # // ed2k file links (Meithar): // ed2k://|file|fileName|fileSize|fileHash|(optional params)|(optional params)|etc| $ret = preg_replace_callback("#(^|(?<=[^\w\"']))(ed2k://\|file\|([^\\/\|:<>\*\?\"]+?)\|(\d+?)\|([a-f0-9]{32})\|(.*?)/?)(?![\"'])(?=([,\.]*?[\s<\[])|[,\.]*?$)#i", "ed2k_link_callback", $ret); // ed2k server links: // ed2k://|server|serverIP|serverPort $ret = preg_replace("#(^|(?<=[^\w\"']))(ed2k://\|server\|([\d\.]+?)\|(\d+?)\|/?)#i", "<a href=\"\\2\" class=\"postLink\">\\3:\\4</a>", $ret); // ed2k file links end # #-----[ FIND ]----------------------------------------------- # // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); // Remove our padding.. $ret = substr($ret, 1); return($ret); } # #-----[ AFTER, ADD ]----------------------------------------------- # /** * Christian Riesen - Jun 27, 2004 * Adds the "Add all links to ed2k client" link to the end of the post text */ function make_addalled2k_link($text,$post_id) { // padding $ret = ' ' . $text; // dig through the message for all ed2k links! // split up by "ed2k:" $t_ed2k_raw = explode("ed2k:",$text); // The first item is garbage unset($t_ed2k_raw[0]); // no need to dig through it if there are not at least 2 links! $t_ed2k_possibles = count($t_ed2k_raw); if ($t_ed2k_possibles > 1) { unset($t_ed2k_reallinks); foreach ($t_ed2k_raw as $t_ed2k_raw_line) { $t_ed2k_parts = explode("|",$t_ed2k_raw_line); // This looks now like this (only important parts included /* [1]=> string(4) "file" [2]=> string(46) "some-filename-here.txt" [3]=> string(9) "321456789" [4]=> string(32) "112233445566778899AABBCCDDEEFF11" */ // Check the obvious things if (strlen($t_ed2k_parts[1]) == 4 AND $t_ed2k_parts[1] === "file" AND strlen($t_ed2k_parts[2]) > 0 AND strlen($t_ed2k_parts[4]) == 32 AND floatval($t_ed2k_parts[3]) > 0) { // This is a true link, lets paste it together and put it in an array $t_ed2k_reallinks[] = "ed2k://|file|".str_replace("'","\'",$t_ed2k_parts[2])."|".$t_ed2k_parts[3]."|".$t_ed2k_parts[4]."|"; } } // Now lets see if we have 2 or more links // Only then, we do our little trick, because otherwise, it would be wasted for one link alone! $t_ed2k_confirmed = count($t_ed2k_reallinks); if ($t_ed2k_confirmed > 1) { $t_ed2kinsert = " \n"; $t_ed2kinsert .= "<SCRIPT> "; $t_ed2kinsert .= "filearray".$post_id."=new Array; "; $t_ed2kinsert .= "n=0; "; $i = 0; foreach($t_ed2k_reallinks as $t_ed2klink) { $t_ed2kinsert .= "filearray".$post_id."[".$i."]='".$t_ed2klink."'; "; $i++; } $t_ed2kinsert .= "iv=false; "; $t_ed2kinsert .= "function addfile".$post_id."(){ "; $t_ed2kinsert .= " var s=filearray".$post_id."[n]; "; $t_ed2kinsert .= " n++; "; $t_ed2kinsert .= " if(n==filearray".$post_id.".length && iv){ "; $t_ed2kinsert .= " top.clearInterval(iv); "; $t_ed2kinsert .= " n=0; "; $t_ed2kinsert .= " } "; $t_ed2kinsert .= " top.document.location=s; "; $t_ed2kinsert .= " return true; "; $t_ed2kinsert .= "} "; $t_ed2kinsert .= "function addall".$post_id."(){iv=top.setInterval('addfile".$post_id."()',250)} "; $t_ed2kinsert .= "</SCRIPT> "; //added an icon in front of link (ppw) $t_ed2kinsert .= "<img src='images/ed2k-info.gif' border='0'> <a href='javascript:addall".$post_id."()'>Add ".$t_ed2k_confirmed." links to ed2k client</a> "; $ret = $ret . $t_ed2kinsert; } } // remove padding $ret = substr($ret, 1); return($ret); } // Add all links to ed2k client end # #-----[ OPEN ]----------------------------------------------- # viewtopic.php # #-----[ FIND ]----------------------------------------------- # $message = make_clickable($message); # #-----[ BEFORE, ADD ]----------------------------------------------- # $message = make_addalled2k_link($message,$postrow[$i]['post_id']); // ed2k link and add all #-----[ SAVE/CLOSE ALL FILES ]----------------------------------------------- |
#9
|
||||
|
||||
Quote:
[*url=link]title[/url] becomes [*url="link"]title[/url] I tried to modify the plugin, and now it does add the quotes, but the hack doesn't recognize the link as a link anymore So, if I post a "normal" edk link (without [ or ]), it works, and adds the quotes, but if I post a link with [ in it, it doesn't parse it at all. edit : Did some code search in the plugin, but regex are a little bit like chinese to me |
#10
|
|||
|
|||
Quote:
[*url='link']title[/url] single quotes instead of double to see if that works |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|