Thread: ed2k
View Single Post
  #8  
Old 03-01-2009, 06:11 PM
iyama iyama is offline
 
Join Date: Sep 2008
Posts: 327
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02165 seconds
  • Memory Usage 1,798KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete