phpBB Italia chiude!
phpBB Italia ringrazia tutti gli utenti che hanno dato fiducia al nostro progetto per ben 9 anni, e che, grazie al grande lavoro fatto da tutto lo Staff (rigorosamente a titolo gratuito), hanno portato il portale a diventare il principale punto di riferimento italiano alla piattaforma phpBB.

Purtroppo, causa motivi personali, non ho più modo di gestirlo e portarlo avanti. Il forum viene ora posto in uno stato di sola lettura, nonché un archivio storico per permettere a chiunque di fruire di tutte le discussioni trattate.

Il nuovo portale di assistenza per l'Italia di phpBB diventa phpBB-Store.it, cui ringrazio per aver deciso di portare avanti questo grande progetto.

Grazie ancora,
Carlo - Amministratore di phpBB Italia

Mod ed2k

Cerchi una MOD? Chiedi in questo forum.
Questa sezione è supportata dagli utenti del forum, pertanto lo Staff potrebbe non eseguire tali richieste.
Gelmo
Utente
Utente
Messaggi: 506
Iscritto il: 20/04/2009, 9:27
Versione: 3.0.5
Server: Windows

Re: Mod ed2k

Messaggio da Gelmo » 16/05/2010, 13:43

no.. perche la mod era gia installata nella mod di mssti.. la ho installata in modo indiretto.. quella ha dentro un dile chiamato intall.mod. e non riesco a capire come diavolo usarlo!
ImmagineImmagine


[center]Immagine[/center]

Avatar utente
Carlo
Amministratore
Amministratore
Messaggi: 9957
Iscritto il: 19/04/2009, 10:24
Sesso: Maschio
Versione: 3.2.0
Server: UNIX/Linux
PHP: 7.1.0
Database: MySQL(i) 10.0.27-MariaDB-cll-lve
Località: Puglia
Contatta:

Re: Mod ed2k

Messaggio da Carlo » 16/05/2010, 22:54

Ti faccio sapere. Vedrò quella MOD che hai linkato in un tuo precedente messaggio e vedrò anche se c'è ne sono altre.
MODs | Stili | Traduzioni MOD
Ogni MP contenente una richiesta di supporto verrà ignorato.

Gelmo
Utente
Utente
Messaggi: 506
Iscritto il: 20/04/2009, 9:27
Versione: 3.0.5
Server: Windows

Re: Mod ed2k

Messaggio da Gelmo » 17/05/2010, 20:57

grazie.. sei mitico!!
ImmagineImmagine


[center]Immagine[/center]

Avatar utente
Carlo
Amministratore
Amministratore
Messaggi: 9957
Iscritto il: 19/04/2009, 10:24
Sesso: Maschio
Versione: 3.2.0
Server: UNIX/Linux
PHP: 7.1.0
Database: MySQL(i) 10.0.27-MariaDB-cll-lve
Località: Puglia
Contatta:

Re: Mod ed2k

Messaggio da Carlo » 18/05/2010, 19:22

Ciao, non ho trovato altre MODs. Puoi comunque utilizzare quella MOD che c'è sul com, anche se sarebbe abbandonata e risalente ad una vecchia versione. L'installazione è piuttosto semplice. Apri con un editor di testo il file install.mod e leggi le istruzioni riportate.
MODs | Stili | Traduzioni MOD
Ogni MP contenente una richiesta di supporto verrà ignorato.

Gelmo
Utente
Utente
Messaggi: 506
Iscritto il: 20/04/2009, 9:27
Versione: 3.0.5
Server: Windows

Re: Mod ed2k

Messaggio da Gelmo » 19/05/2010, 15:41

altrimenti ho trovato questa... secondo te va bene??

Codice: Seleziona tutto

    ##############################################################
    ## 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 ]-----------------------------------------------
    #

    // [url=www.phpbb.com]phpBB[/url] 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) . '&nbsp;' . $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'>&nbsp;<a $href>$fname&nbsp;($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'>&nbsp;<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 ]-----------------------------------------------
ImmagineImmagine


[center]Immagine[/center]

Avatar utente
Carlo
Amministratore
Amministratore
Messaggi: 9957
Iscritto il: 19/04/2009, 10:24
Sesso: Maschio
Versione: 3.2.0
Server: UNIX/Linux
PHP: 7.1.0
Database: MySQL(i) 10.0.27-MariaDB-cll-lve
Località: Puglia
Contatta:

Re: Mod ed2k

Messaggio da Carlo » 19/05/2010, 15:52

Occhio:
Tested with phpBB Version 2.0.11 to 2.0.15
E' per phpBB2.
MODs | Stili | Traduzioni MOD
Ogni MP contenente una richiesta di supporto verrà ignorato.

Gelmo
Utente
Utente
Messaggi: 506
Iscritto il: 20/04/2009, 9:27
Versione: 3.0.5
Server: Windows

Re: Mod ed2k

Messaggio da Gelmo » 20/05/2010, 20:36

ahhhhhh ho capito!!!!!!!!!!! cmq ho provato a fare quello che hai detto tu.. e per ora sembra funzionare!!
ImmagineImmagine


[center]Immagine[/center]

D_evil91
Utente
Utente
Messaggi: 38
Iscritto il: 01/10/2010, 1:32
Sesso: Maschio
Versione: 3.0.11
Server: UNIX/Linux
Contatta:

Re: Mod ed2k

Messaggio da D_evil91 » 01/10/2010, 1:51

frankie_ita77 ha scritto:Ciao raga, vorrei rendermi utile ;) ho visto che la discussione è un pò vecchiotta ma se l'autore del topic bazzica nel forum penso che leggerà questo msg.
Il mio consiglio è di installare questa MOD che uso nel mio forum e fa proprio quello che chiedi te il riconoscimento automatico dei link ED2k anche con le parentesi quadre e tonde all'interno del link stesso...
Proprio come fa DDUniverse....da te citato :D

AVVISO
Io ho installato la MOD nella vers. 3.0.7-PL1 style (Prosilver) e funziona perfettamente, ricordati di fare sempre e prove in locale per nn incorrere a brutte sorprese.

La MOD è questa:

Codice: Seleziona tutto

##############################################################
## MOD Title: eD2k links processing with availability statistics
##
## MOD Author: Meithar, then updated by Bill Hicks, C0de_m0nkey
##			   and DonGato (current maintainer)
##
## MoD Description: Displays all kind of ed2k links formatted
##					in any possible way and provides a link
##					to file statistics.
##
## MOD Version: 3.0.1 (phpBB 3, doesn't work with phpBB 2)
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: posting.php,
##				  viewtopic.php,
##				  includes/functions.php,
##				  includes/functions_content.php,
##				  includes/mcp/mcp_post.php,
##				  includes/mcp/mcp_topic.php,
##				  includes/ucp/ucp_pm_compose.php,
##				  includes/ucp/ucp_pm_viewmessage.php
##
## Included Files: emugle.gif, stats.gif
## License: GNU General Public License v2
##			http://opensource.org/licenses/gpl-license.php
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes (Bill Hicks):
##
## The razorback's search idea was mentioned one day by a friend
## who found it hard to see how files he had released were
## spread on the network.
## Before I came up with this mod he had to open a second client
## to check the spread status; not any more!
## With the link posted in phpBB you will see a small icon after
## the link. If you click this icon the code will automatically
## redirect you to razorback's statistics web.
## When you click the icon it searches the hash id for that link
## and returns how many full sources and users are downloading
## the file, as well as other useful data.
##
## Thanks to Meithar who made the filesize link code in the first place.
##############################################################
## MOD History:
##
##	2008.03.10	- Version 3.0.2 by DonGato
##				- Fixed issue with Moderation tasks
##				- Fixed issue with https links
##
##	2008.01.16	- Version 3.0.1 by DonGato
##				- Fixed issue with PMs not supporting ed2k links
##
##	2007.12.21	- Version 3.0.0 by DonGato
##				- Update for phpbBB3 release
##
##	2007.10.19	- Version 2.0.6 by DonGato
##				- Update for phpbBB3 RC7 big changes
##
##	2007.10.05	- Version 2.0.5 by DonGato
##				- Added ed2k processing to MCP
##
##	2007.07.30	- Version 2.0.4 by DonGato
##				- Fixed an issue with [URL] bbcode processing
##
##	2007.07.08	- Version 2.0.3 by DonGato
##				- Fixed an issue with Add All Links processing
##
##	2007.07.05	- Version 2.0.2 by DonGato
##				- Changed code to follow phpBB 3 coding guidelines
##
##	2007.07.01	- Version 2.0.1 by DonGato
##				- Updated for phpBB 3.0 (AKA Olympus)
##
##	2006.12.15	- Version 1.0.5 by DonGato
##				- Fixed issue with sizes in bytes
##				- Added option for Razorback's Memorial statistics
##				 (remove the // at the end of the ed2k_link_callback and delete the next line)
##
##	2006.03.24	- Version 1.0.4 by DonGato
##				- Replaced Razorback statistics by eMugle ones
##
##	2006.01.24	- Version 1.0.3 by DonGato
##				- Added modified code for Add All Links with support
##		 		  for one additional parameter
##
##	2006.01.04	- Version 1.0.2 by DonGato
##				- Updated code to last phpBB version, added processing of
##		 		  other link formats and fixed some minor issues.
##
##	2005.03.26	- Version 1.0.1
##				- Bill Hicks/c0de_m0nkey updated the code to include razorback2
##		 		  source search from hash id through a small info
##				  icon in front of the ed2k link.
##
##	2005.03.12	- Version 1.0.0
##				- Meithar posted the file size mod at www.phpbb.com
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#

#
#-----[ COPY ]------------------------------------------
#
copy images/emugle.gif to images/emugle.gif
copy images/stats.gif to images/stats.gif

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
	$message = smiley_text($message);

#
#-----[ AFTER, ADD ]------------------------------------------
#

	// eD2k links processing
	$message = process_ed2k($message);
	// eD2k Add all links feature
	$message = make_addalled2k_link($message, $row['post_id']);

#
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ FIND ]------------------------------------------
#
		unset($attachment_data);
	}

#
#-----[ AFTER, ADD ]------------------------------------------
#

	// eD2k links processing
	$preview_message = process_ed2k($preview_message);

#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------
#
			$scheme = ($mode == 'url') ? '[a-z\d+\-.]' : '[a-z\d+]'; // avoid automatic parsing of "word" in "last word.http://..."
			// generated with regex generation file in the develop folder
			return "[a-z]$scheme*:/{2}(?:(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?";

#
#-----[ REPLACE WITH ]------------------------------------------
#
			return "(irc|ftp|http|https):/{2}(?:(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?";

#
#-----[ OPEN ]------------------------------------------
#
includes/functions_content.php

#
#-----[ FIND ]------------------------------------------
#
		'text'			=> $text
	);
}

#
#-----[ AFTER, ADD ]------------------------------------------
#

// eD2k links processing
function humanize_size ($size, $rounder = 0)
{
	$sizes		= array('Bytes', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb');
	$rounders	= array(0, 1, 2, 2, 2, 3, 3, 3, 3);
	$ext		= $sizes[0];
	$rnd		= $rounders[0];

	if ($size < 1024)
	{
		$rounder	= 0;
		$format		= '%.' . $rounder . 'f Bytes';
	}
	else
	{
		for ($i = 1, $cnt = count($sizes); ($i < $cnt && $size >= 1024); $i++)
		{
			$size	= $size / 1024;
			$ext	= $sizes[$i];
			$rnd	= $rounders[$i];
			$format	= '%.' . $rnd . 'f ' . $ext;
		}
	}

	if (!$rounder)
	{
		$rounder = $rnd;
	}

	return sprintf($format, round($size, $rounder));
}

function ed2k_link_callback ($m)
{
	$max_len	= 100;
	$href		= 'href="' . $m[2] . '" class="postlink"';
	$fname		= rawurldecode($m[3]);
	$fname		= preg_replace('/&/i', '&', $fname);
	$size		= humanize_size($m[4]);

	if (strlen($fname) > $max_len)
	{
		$fname = substr($fname, 0, $max_len - 19) . '...' . substr($fname, -16);
	}
	if (preg_match('#[<>"]#', $fname))
	{
		$fname = htmlspecialchars($fname);
	}

//	return "ed2k: <a $href>$fname&nbsp;&nbsp;[$size]</a> <a href='http://www.emugle.com/details.php?f=$m[5]' target='_blank'><img src='images/emugle.gif' border='0' title='eMugle statistics' style='vertical-align: text-bottom;' /></a>";
	return "ed2k: <a $href>$fname&nbsp;&nbsp;[$size]</a> <a href='http://tothbenedek.hu/ed2kstats/ed2k?hash=$m[5]' target='_blank'><img src='images/stats.gif' border='0' title='File statistics' style='vertical-align: text-bottom;' /></a>";
}

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

	// Patterns and replacements for URL processing
	$patterns = array();
	$replacements = array();

	// [url]ed2k://|file|...[/url] code
	$patterns[] 	= '#\[url\](ed2k://\|file\|(.*?)\|\d+\|\w+\|(h=\w+\|)?/?)\[/url\]#is';
	$replacements[] = '<a href="$1" class="postlink">$2</a>';
	// [url=ed2k://|file|...]name[/url] code
	$patterns[] 	= '#\[url=(ed2k://\|file\|(.*?)\|\d+\|\w+\|(h=\w+\|)?/?)\](.*?)\[/url\]#si';
	$replacements[] = '<a href="$1" class="postlink">$4</a>';
	// [url]ed2k://|server|ip|port|/[/url] code
	$patterns[] 	= '#\[url\](ed2k://\|server\|([\d\.]+?)\|(\d+?)\|/?)\[/url\]#si';
	$replacements[] = 'ed2k server: <a href="$1" class="postlink">$2:$3</a>';
	// [url=ed2k://|server|ip|port|/]name[/url] code
	$patterns[] 	= '#\[url=(ed2k://\|server\|[\d\.]+\|\d+\|/?)\](.*?)\[/url\]#si';
	$replacements[] = '<a href="$1" class="postlink">$2</a>';
	// [url]ed2k://|friend|name|ip|port|/[/url] code
	$patterns[] 	= '#\[url\](ed2k://\|friend\|(.*?)\|[\d\.]+\|\d+\|/?)\[/url\]#si';
	$replacements[] = 'ed2k friend: <a href="$1" class="postlink">$2</a>';
	// [url=ed2k://|friend|name|ip|port|/]name[/url] code
	$patterns[] 	= '#\[url=(ed2k://\|friend\|(.*?)\|[\d\.]+\|\d+\|/?)\](.*?)\[/url\]#si';
	$replacements[] = '<a href="$1" class="postlink">$3</a>';

	$ret = preg_replace($patterns, $replacements, $ret);

	$ret = preg_replace_callback("#(^|(?<=[^\w\"']))(ed2k://\|file\|([^\\/\|:<>\*\?\"]+?)\|(\d+?)\|([a-f0-9]{32})\|(.*?)/?)(?![\"'])(?=([,\.]*?[\s<\[])|[,\.]*?$)#i", "ed2k_link_callback", $ret);
	// ed2k://|server|serverIP|serverPort
	$ret = preg_replace("#(^|(?<=[^\w\"']))(ed2k://\|server\|([\d\.]+?)\|(\d+?)\|/?)#i", "ed2k server: <a href=\"\\2\" class=\"postLink\">\\3:\\4</a>", $ret);
	// ed2k://|friend|name|clientIP|clientPort
	$ret = preg_replace("#(^|(?<=[^\w\"']))(ed2k://\|friend\|([^\\/\|:<>\*\?\"]+?)\|([\d\.]+?)\|(\d+?)\|/?)#i", "ed2k friend: <a href=\"\\2\" class=\"postLink\">\\3</a>", $ret);
	// -- END --

	// Remove our padding..
	$ret = substr($ret, 1);

	return($ret);
}

// eD2k Add all links feature
function make_addalled2k_link($text, $post_id)
{
	// padding
	$ret = ' ' . $text;

	// dig through the message for all ed2k links
	// split up by "ed2k:"
	$ed2k_raw = explode('ed2k://', $text);

	// The first item is garbage
	unset($ed2k_raw[0]);

	// no need to dig through it if there are not at least 2 links
	$ed2k_possibles = count($ed2k_raw);
	if ($ed2k_possibles > 1)
	{
		unset($ed2k_real_links);
		foreach ($ed2k_raw as $ed2k_raw_line)
		{
			$ed2k_parts = explode('|', $ed2k_raw_line);
			// This looks now like this (only important parts included)
			/*
			[1]=>
			string(4) "file"
			[2]=>
			string(46) "filename.extension"
			[3]=>
			string(9) "321456789"
			[4]=>
			string(32) "112233445566778899AABBCCDDEEFF11"
			[5]=>
			string(?) "source or AICH hash"
			*/

			// Check the obvious things
			if (strlen($ed2k_parts[1]) == 4 AND $ed2k_parts[1] == 'file' AND strlen($ed2k_parts[2]) > 0 AND floatval($ed2k_parts[3]) > 0 AND strlen($ed2k_parts[4]) == 32)
			{
				// This is a true link, lets paste it together and put it in an array
				if (substr($ed2k_parts[5], 0, 2) == 'h=' || substr($ed2k_parts[5], 0, 7) == 'sources')
				{
					$ed2k_real_links[] = 'ed2k://|file|' . str_replace('\'', '\\\'', $ed2k_parts[2]) . '|' . $ed2k_parts[3] . '|' . $ed2k_parts[4] . '|' . $ed2k_parts[5] . '|/';
				}
				else
				{
					$ed2k_real_links[] = 'ed2k://|file|' . str_replace('\'', '\\\'', $ed2k_parts[2]) . '|' . $ed2k_parts[3] . '|' . $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
		$ed2k_confirmed = count($ed2k_real_links);
		if ($ed2k_confirmed > 1)
		{
			$ed2k_insert = '<br /><br />';
			$ed2k_insert .= '<SCRIPT>';
			$ed2k_insert .= 'filearray' . $post_id . '=new Array;';
			$ed2k_insert .= 'n=0;';
			$i = 0;
			foreach($ed2k_real_links as $ed2k_link)
			{
				$ed2k_insert .= 'filearray' . $post_id . '[' . $i . ']=\'' . $ed2k_link . '\';';
				$i++;
			}
			$ed2k_insert .= 'iv=false;';
			$ed2k_insert .= 'function addfile' . $post_id . '()';
			$ed2k_insert .= '{';
			$ed2k_insert .= '	var s=filearray' . $post_id . '[n];';
			$ed2k_insert .= '	n++;';
			$ed2k_insert .= '	if(n==filearray' . $post_id . '.length && iv)';
			$ed2k_insert .= '	{';
			$ed2k_insert .= '		top.clearInterval(iv);';
			$ed2k_insert .= '		n=0;';
			$ed2k_insert .= ' 	}';
			$ed2k_insert .= '	top.document.location=s;';
			$ed2k_insert .= '	return true;';
			$ed2k_insert .= '}';
			$ed2k_insert .= 'function addall' . $post_id . '(){iv=top.setInterval("addfile' . $post_id . '()",250)}';
			$ed2k_insert .= '</SCRIPT>';
			$ed2k_insert .= '<span class="gensmall"><a href="javascript:addall' . $post_id. '()" class="postlink">[ Add all ' . $ed2k_confirmed . ' links to your ed2k client ]</a></span>';
			$ret = $ret . $ed2k_insert;
		}
	}

	// remove padding
	$ret = substr($ret, 1);

	return($ret);
}

#
#-----[ OPEN ]------------------------------------------
#
includes/mcp/mcp_post.php

#
#-----[ FIND ]------------------------------------------
#
	$message = smiley_text($message);

#
#-----[ AFTER, ADD ]------------------------------------------
#

	// eD2k links processing
	$message = process_ed2k($message);

#
#-----[ OPEN ]------------------------------------------
#
includes/mcp/mcp_topic.php

#
#-----[ FIND ]------------------------------------------
#
		$message = smiley_text($message);

#
#-----[ AFTER, ADD ]------------------------------------------
#

		// eD2k links processing
		$message = process_ed2k($message);

#
#-----[ OPEN ]------------------------------------------
#
includes/ucp/ucp_pm_compose.php

#
#-----[ FIND ]------------------------------------------
#
		$preview_subject = censor_text($subject);

#
#-----[ AFTER, ADD ]------------------------------------------
#

		// eD2k links processing
		$preview_message = process_ed2k($preview_message);

#
#-----[ OPEN ]------------------------------------------
#
includes/ucp/ucp_pm_viewmessage.php

#
#-----[ FIND ]------------------------------------------
#
	$url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm');

#
#-----[ AFTER, ADD ]------------------------------------------
#

	// eD2k links processing
	$message = process_ed2k($message);

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
sei un grandeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee!!!! è proprio quello che cercavooooooooooooo!! grazie milleeeeee !!! mi hai facilitato di molto le coseeeeeeeeee!!! ciaoooo!!

soldo
Utente
Utente
Messaggi: 13
Iscritto il: 23/04/2011, 16:25
Sesso: Maschio
Versione: 3.0.8
Server: UNIX/Linux
PHP: 5.2.13
Database: MySQL(i) 5.1.49-community-log

Re: Mod ed2k

Messaggio da soldo » 24/04/2011, 8:21

Provo ad installarla pure io...ma non ho molta dimestichezza con le modifiche....

Edit:

Installata...quasi con pieno successo. :D
Alora, le statistiche, il link era chiuso è ho inserito quello delle stats ufficiale.
Per la gif prima del link che mi dovrebbe far vedere il mulo, mi esce "ed2k:", ma non riesco a farle caricare la gif del mulo....
Qualche consiglio?
Probabilmente il file incriminato è il "includes/functions_content.php", alla stringa:

Codice: Seleziona tutto

//	return "ed2k: <a $href>$fname&nbsp;&nbsp;[$size]</a> <a href='http://www.emugle.com/details.php?f=$m[5]' target='_blank'><img src='images/emugle.png' border='0' title='eMugle statistics' style='vertical-align: text-bottom;' /></a>";
	return "ed2k: <a $href>$fname&nbsp;&nbsp;[$size]</a> <a href='http://ed2k.shortypower.org/ed2k?hash=$m[5]' target='_blank'><img src='images/stats.gif' border='0' title='File statistics' style='vertical-align: text-bottom;' /></a>";
}
Consigli?

Avatar utente
Carlo
Amministratore
Amministratore
Messaggi: 9957
Iscritto il: 19/04/2009, 10:24
Sesso: Maschio
Versione: 3.2.0
Server: UNIX/Linux
PHP: 7.1.0
Database: MySQL(i) 10.0.27-MariaDB-cll-lve
Località: Puglia
Contatta:

Re: Mod ed2k

Messaggio da Carlo » 24/04/2011, 9:56

Dovresti trovare:

Codice: Seleziona tutto

   return "ed2k:
e sostituirlo con:

Codice: Seleziona tutto

   return "<img src='http://www.tuosito.it/immagine_mulo.gif' />
MODs | Stili | Traduzioni MOD
Ogni MP contenente una richiesta di supporto verrà ignorato.

Rispondi

Torna a “Richiesta MOD”

Chi c’è in linea

Visitano il forum: Nessuno e 48 ospiti