Mod."ed2k"

Jeśli masz problem z nie autoryzowaną modyfikacją, nie możesz jej zainstalować lub występują błędy po jej instalacji to pisz w tym dziale.
pawel2006
Posty: 3
Rejestracja: 12 stycznia 2007, 10:08

Mod."ed2k"

Post autor: pawel2006 » 12 stycznia 2007, 10:23

Witam :) , szukam pomocy tutaj bo na innych forach to tak pomagaja ze .... :cry: mam forum chce zainstalowac moda.ed2k ale cos mi to nie wychodzi mam zalaczam tutaj moda.ed2k i moje BBcode moze ktos ma czas i umie mi to zrobic :(

mod.ed2k
##############################################################
## MOD Title: eD2k Links add all Feature
## MOD Author: Simon Moon <simon@gomp.net> (Christian Riesen) http://www.blackpearltech.com/
## 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.1.1
##
## Installation Level: moderate
## Installation Time: 5 Minutes
## Files To Edit: includes/bbcode.php
## viewtopic.php
## Included Files: n/a
##############################################################
## 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 thi 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:
##
## 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']);

#
#-----[ FIND ]------------------------------------------
#
$replacements[] = $bbcode_tpl['url4'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
// [url=ed2k://|file|...]name[/url] code
$patterns[] = "#\(.*?)\[/url\]#si";
$replacements[] = $bbcode_tpl['url5'];

// [url=ed2k://|server|...]name
code
$patterns[] = "#\[url=(ed2k:(//)?\|server\|[\d\.]+\|\d+\|/?)\](.*?)\[/url\]#si";
$replacements[] = $bbcode_tpl['url6'];


#
#-----[ FIND ]------------------------------------------
#
function make_clickable($text)
{

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

#
#-----[ AFTER, ADD ]------------------------------------------
#
// ed2k files
$ret = preg_replace("#([\n ])(ed2k://\|file\|(.*)\|\d+\|\w+\|/?)#", "\\1ed2k: <a href=\"\\2\">\\3</a>", $ret);

// ed2k servers
$ret = preg_replace("#([\n ])(ed2k:(//)?\|server\|([\d\.]+)\|(\d+)\|/?)#", "\\1ed2k: <a href=\"\\2\">\\4 at \\5 </a>", $ret);


#
#-----[ FIND ]------------------------------------------
#

/**
* Nathan Codding - Feb 6, 2001
* Reverses the effects of make_clickable(), for use in editpost.
* - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs.
*
*/
function undo_make_clickable($text)
{

#
#-----[ BEFORE, 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 ]------------------------------------------
#
# EoM

Zablokowany

Wróć do „Pomoc”