Thnx to my chinees warez peopel:
*open: includes/class_bbcode.php
*find:
/**
* Returns whether this parser is a WYSIWYG parser. Useful to change
* behavior slightly for a WYSIWYG parser without rewriting code.
*
* @return bool True if it is; false otherwise
*/
function is_wysiwyg()
{
return false;
}
*add below:
/**
*
* @param string URLs of ed2k
*
* @return string table with download list
*
* @by explon
*/
function handle_ed2k_links($text)
{
global $vbulletin;
if (!$this->is_wysiwyg())
{
if (strpos($text, "<br>") OR strpos($text, "<br />"))
{
$text = str_replace("<br>", "<br />", $text);
$text = str_replace("<br />", "\n", $text);
$ed2klist = explode("\n", $text);
}
else
{
$ed2klist = explode("\n", $text);
}
$ed2k_rand = rand(0, 1000);
$text = "<br /><table class=\"tborder\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"center\"><thead><tr><td class=\"tcat\" colspan=\"2\">eMule download</td></tr></thead><tbody>";
foreach ($ed2klist AS $key => $ed2k)
{
$ed2klen = strlen($ed2k);
if ($ed2k AND $ed2klen > 7)
{
$ed2k_array = explode("|", $ed2k);
$total += $ed2k_array[3];
$totalper = $ed2k_array[3];
if ($totalper > (1024*1024*1024*1024))
{
$totalper = round($totalper/1024/1024/1024/1024,2);
$totalper .= "TB";
}
else if ($totalper > (1024*1024*1024))
{
$totalper = round($totalper/1024/1024/1024,2);
$totalper .= "GB";
}
else if($totalper > (1024*1024))
{
$totalper = round($totalper/1024/1024,2);
$totalper .= "MB";
}
else
{
$totalper = round($totalper/1024,2);
$totalper .= "KB";
}
$ed2k_array[2] = urldecode($ed2k_array[2]);
$text .= "<tr align=\"left\" class=\"alt" . iif($key%2, 1, 2) . "\"><td width=\"80%\" align=\"left\"><input type=\"checkbox\" class=\"button\" name=\"ed2k" . $ed2k_rand . "\" value=\"" . $ed2k . "\" onclick=\"Ed2KFileSize('ed2k" . $ed2k_rand . "');\" checked=\"checked\" /> <a href=\"" . $ed2k . "\">" . $ed2k_array[2] . "</a></td><td align=\"center\">" . $totalper . "</td></tr>";
}
}
if ($total > (1024*1024*1024*1024))
{
$total = round($total/1024/1024/1024/1024,2);
$total .= "TB";
}
else if($total > (1024*1024*1024))
{
$total = round($total/1024/1024/1024,2);
$total .= "GB";
}
else if ($total > (1024*1024))
{
$total = round($total/1024/1024,2);
$total .= "MB";
}
else
{
$total = round($total/1024,2);
$total .= "KB";
}
$text .= "<tr align=\"left\" class=\"alt" . iif($key%2, 1, 2) . "\"><td width=\"80%\" align=\"left\"><input type=\"checkbox\" class=\"button\" id=\"CheckAll_ed2k".$ed2k_rand."\" onclick=\"Ed2KCheckAll('ed2k" . $ed2k_rand . "', this.checked)\" checked=\"checked\" /> <label for=\"CheckAll_ed2k" . $ed2k_rand . "\" style=\"margin-right:6px\">all</label> <input type=\"button\" class=\"button\" value=\"download selected\" onclick=\"Ed2KDownLoad('ed2k" . $ed2k_rand . "', 0, 1)\" /> <input type=\"button\" class=\"button\" value=\"copy selected\" onclick=\"Ed2KCopyLink('ed2k" . $ed2k_rand . "')\" /><div id=\"Ed2KLink_ed2k" . $ed2k_rand . "\" style=\"position:absolute; height:0px; width:0px; overflow:hidden;\"></div> </td><td align=\"center\" id=\"FileSize_ed2k" . $ed2k_rand . "\">" . $total . "</td></tr></tbody></table>";
}
else
{
$text = "[ed2k]" . $text . "[/ed2k]" ;
}
return $text;
}
*find:
if ($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_HTML)
{
// [HTML]
$tag_list['no_option']['html'] = array(
'callback' => 'handle_bbcode_html',
'strip_empty' => true,
'stop_parse' => true,
'disable_smilies' => true,
'disable_wordwrap' => true,
'strip_space_after' => 1
);
}
*add below:
if (($vbulletin->options['allowedbbcodes']) OR $force_all)
{
// [ED2K]
$tag_list['no_option']['ed2k'] = array(
'callback' => 'handle_ed2k_links',
'strip_empty' => true,
'stop_parse' => true,
'disable_smilies' => true,
'disable_wordwrap' => true,
'strip_space_after' => 1
);
}
*open: clientscript/vbulletin_global.js
*add at the end:
function Ed2KCheckAll(str, checked)
{
var a = document.getElementsByName(str);
var n = a.length;
for (var i = 0; i < n; i++)
{
a[i].checked = checked;
}
Ed2KFileSize(str);
}
function Ed2KDownLoad(str, i, first)
{
var a = document.getElementsByName(str);
var n = a.length;
for (var i = i; i < n; i++)
{
if(a[i].checked)
{
window.location = a[i].value;
if (first)
{
timeout = 6000;
}
else
{
timeout = 500;
}
i++;
window.setTimeout("Ed2KDownLoad('"+str+"', "+i+", 0)", timeout);
break;
}
}
}
function Ed2KCopyLink(str)
{
var a = document.getElementsByName(str);
var n = a.length;
var CopyLink = document.getElementById("Ed2KLink_" + str)
CopyLink.innerHTML = ""
for (var i = 0; i < n; i++)
{
if(a[i].checked)
{
CopyLink.innerHTML += a[i].value;
CopyLink.innerHTML += "<br />";
}
}
var rng = document.body.createTextRange();
rng.moveToElementText(CopyLink)
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
function Ed2KFileSize(str)
{
var a = document.getElementsByName(str);
var n = a.length;
try
{
var Input_CheckAll = document.getElementById("CheckAll_"+str);
var FileSize = 0;
Input_CheckAll.checked = true ;
for (var i=0; i < n; i++)
{
if (a[i].checked)
{
var piecesArray = a[i].value.split("|");
FileSize += piecesArray[3]*1;
}
else
{
Input_CheckAll.checked = false;
}
}
OutPut = document.getElementById("FileSize_" + str);
OutPut.innerHTML = Ed2KGetSize(FileSize, 3, 2);
}
catch (e)
{
// Nothing
}
}
function Ed2KGetSize(val, li, sepa)
{
sep = Math.pow(10, sepa);
li = Math.pow(10, li);
retval = val;
unit = 'Bytes';
if (val >= li*1000000000)
{
val = Math.round(val / (1099511627776/sep)) / sep;
unit = 'TB';
}
else if (val >= li*1000000)
{
val = Math.round(val / (1073741824/sep)) / sep;
unit = 'GB';
}
else if (val >= li*1000)
{
val = Math.round(val / (1048576/sep)) / sep;
unit = 'MB';
}
else if (val >= li)
{
val = Math.round(val / (1024/sep)) / sep;
unit = 'KB';
}
return val + unit;
}
*edit temple: editor_toolbar_on
*find:
$vBeditTemplate[extrabuttons]
*add above:
<!-- ED2K --><td><div class="imagebutton" id="{$editorid}_cmd_wrap0_ed2k"><img src="$stylevar[imgdir_editor]/ed2k.gif" width="21" height="20" alt="Wrap eD2k tag" /></div></td><!-- /ED2K -->
======================
Make your own ed2k.gif