Seite 1 von 1

Brauche Richtige MOD Für die edk2 Links

Verfasst: 08.06.2003 18:47
von Cpt Kurt
Ich habe die phpBB 2.0.4 version.Habe ein problem beim edk2 links.Die funktionieren nicht automatisch.Also ich will das die links wenn man drauf klick auf die eMule bzw.eDonkey geht.Habe hier ein paar mods gefunden aber tauch nicht.Es kommt immer eror wenn ich mods drauf hab.Was ist die richtige mod? oder was muss ich einstellen?Manche sagen du brauchst ein MOD manche sagen du musst beim admininistrator bereich html einstellungen machen.Was ist jetz?Brauche mod oder einstellung?Kann jemand mir helfen?

Vielen und Herzlichem dank

Cpt Kurt

Verfasst: 08.06.2003 19:09
von Tuxman
Also dieser "ed2k BBcode Mod" funzt net... auch bei mir net. :)

Verfasst: 09.06.2003 21:28
von Gast
Kann man gar nicht`s machen oder wie?Aber wie funzt bei den anderen?Es muss ein weg sein das das funz.

Verfasst: 08.01.2005 02:54
von BIG Mule
Hallo,

Hier hab ich eins zusammengestellt. Der Hash vom ed2k link wird versteckt. Funktioniert tadellos. Habs bei mir auch gemacht.

Code: Alles auswählen

##############################################################
## Mod Title:    ed2k (BBcode)
## Mod Author: [ Oki/Mozes/Meithar ]
## Completely WEBMASTER - http://www.vatan-board.net.tc
## Mod Description:   a little comfort URL Query based on Javascript
## Mod Version:      1.1.1
##
## Installation Level:   Easy
## Installation Time:   5 Minutes
## Files To Edit:   includes/bbcode.php
##                             viewtopic.php
##
## Included Files:   n/a
##############################################################
## Before Adding This Mod To Your Forum, You Should Back Up All Files Related To This Mod
##############################################################
#
#-----[ OPEN ]-----
#
bbcode.php

#
#-----[ FIND ]-----
#
$bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\2', $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[4] = "#\[url=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#si"; 
$replacements[4] = $bbcode_tpl['url4']; 

#
#-----[ AFTER, ADD ]-----
#
// 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 ]-----
#
function make_clickable($text)
{

	// pad it with a space so we can match things at the start of the 1st line.
	$ret = ' ' . $text;

	// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
	// xxxx can only be alpha characters.
	// yyyy is anything up to the first space, newline, comma, double quote or <
	$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);

	// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
	// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
	// zzzz is optional.. will contain everything up to the first space, newline, 
	// comma, double quote or <.
	$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);

	// matches an email@domain type address at the start of a line, or after a space.
	// 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);
}

#
#-----[ REPLACE WITH ]-----
#
function make_clickable($text) 
{ 
   // pad it with a space so we can match things at the start of the 1st line. 
   $ret = ' ' . $text; 

   // ed2k file links: (by Meithar) 
   // ed2k://|file|fileName|fileSize|fileHash|(optional params)|(optional params)|etc| 
   $ret = preg_replace("#(^|(?<=[^\w\"']))(ed2k://\|file\|([^\\/\|:<>\*\?\"]+?)\|(\d+?)\|([a-f0-9]{32})\|(.*?)/?)(?![\"'])(?=([,\.]*?[\s<\[])|[,\.]*?$)#i", "<a href=\"\\2\">\\3</a>", $ret); 
   // ed2k server links: (by Meithar) 
   // ed2k://|server|serverIP|serverPort 
   $ret = preg_replace("#(^|(?<=[^\w\"']))(ed2k://\|server\|([\d\.]+?)\|(\d+?)\|/?)#i", "<a href=\"\\2\">\\3:\\4</a>", $ret); 

   // matches an "xxxx://yyyy" URL at the start of a line, or after a space. 
   // xxxx can only be alpha characters. 
   // yyyy is anything up to the first space, newline, comma, double quote or < 
    $ret = preg_replace("#(^|[\n ])([\w]+?://[^ \|\"\n\r\t<]+)#i", "\\1<a href=\"\\2\">\\2</a>", $ret); 

   // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing 
   // Must contain at least 2 dots. xxxx contains either alphanum, or "-" 
   // zzzz is optional.. will contain everything up to the first space, newline, 
   // comma, double quote or <. 
    $ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]+)#i", "\\1<a href=\"http://\\2\">\\2</a>", $ret); 

   // matches an email@domain type address at the start of a line, or after a space. 
   // 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); 
}

#
#-----[ 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> "; 
$t_ed2kinsert .= "<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); 
} 
 
#
#-----[ 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 ]-----

[ Oki/Mozes/Meithar ] [ Completely WEBMASTER - http://www.vatan-board.net.tc]