vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Miscellaneous Hacks - eD2K Links Hack (https://vborg.vbsupport.ru/showthread.php?t=126481)

Paul M 09-13-2006 09:36 PM

To cache templates in a plugin use the cache_templates hook and this code ;

PHP Code:

$globaltemplates[] = 'ed2k' ;
$globaltemplates[] = 'ed2kbit' 


MRGTB 09-13-2006 09:52 PM

Quote:

Originally Posted by Paul M
To cache templates in a plugin use the cache_templates hook and this code ;

PHP Code:

$globaltemplates[] = 'ed2k' ;
$globaltemplates[] = 'ed2kbit' 


Paul can you just copy the code from the plug-in and show me were that goes, if you will please.

aveon 09-13-2006 10:28 PM

hey gary when i try to add a link i get this error

Fatal error: Call to undefined function: handle_ed2k_links() in /kunden/137092_81737/www.e-paylas.de/forum/includes/class_bbcode.php on line 1071

MRGTB 09-13-2006 10:35 PM

check that you put the code in the class_bbcode.php file after this.

Code:

        * 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;
        }

An not after this marked in red:

Code:

        * 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;
        }
        }

So it should look like this:

Code:


       
Code:

       
        * 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;
        }
/**
* ed2k link start.
*/
        function handle_ed2k_links($text)
{
if(!$this->is_wysiwyg())
{
$text=preg_replace ("/(<\/?)(\w+)([^>]*>)/e","", $text);
$list=explode("ed2k://",$text);
$rand=rand(100, 999);
foreach ( $list as $key => $ed2k )
{
if (!empty($ed2k))
{
$ed2k = "ed2k://".$ed2k;
$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);
if(!$totalper){continue; }
$totalper.="TB";
}elseif($totalper>(1024*1024*1024)){
$totalper=round($totalper/1024/1024/1024,2);
if(!$totalper){continue; }
$totalper.="GB";
}elseif($totalper>(1024*1024)){
$totalper=round($totalper/1024/1024,2);
if(!$totalper){continue; }
$totalper.="MB";
}else{
$totalper=round($totalper/1024,2);
if(!$totalper){continue; }
$totalper.="KB";
}
++$i;
$key1=iif($i%2, 1, 2);
$ed2k_array[2]=rawurldecode($ed2k_array[2]);
eval('$ed2kbit .= "' . fetch_template('ed2kbit') . '";');
}
}
if($total>(1024*1024*1024*1024)){
$total=round($total/1024/1024/1024/1024,2);
$total.="TB";
}elseif($total>(1024*1024*1024)){
$total=round($total/1024/1024/1024,2);
$total.="GB";
}elseif($total>(1024*1024)){
$total=round($total/1024/1024,2);
$total.="MB";
}else{
$total=round($total/1024,2);
$total.="KB";
}
$key2=iif($key%2, 1, 2);
eval('$text = "' . fetch_template('ed2k') . '";');
}
else
{
$text ="[ed2k]".$text."[/ed2k]" ;
}
return $text;
}
/**
* ed2k link end.
*/
        }



There are two of these "}" in the code you search for at the end of it. Put the hack code before the very last one

concordancer 09-13-2006 10:37 PM

Quote:

Originally Posted by m0nde
eDonkey hasn't gone belly up, but is not as popular as Bit Torrent at the moment.

Yeah, sure...:( See http://yro.slashdot.org/yro/06/09/12/1932225.shtml

MRGTB 09-13-2006 11:18 PM

The hack has now been updated again.

All templates are "cached" now in the "plug-in", no need to edit the global.php file, instuctions have been updated in download to reflect this change.

Please re-download and install the hack via the plug-in (remove the other version first). And remove all edits to your global.php file if you made any to cache templates.

asj 09-14-2006 12:26 AM

Thanks

Paul M 09-14-2006 03:37 AM

So why, after i gave you the code have you created two cache_template plugins, and used array_merge .......

MRGTB 09-14-2006 03:42 AM

Paul, not sure what you mean. You know a lot more than me and I had to look at another hack to see how they had cached the templates and followed there way. If you can do it a better way. Please feel to post the full plug-in code here with your cache template code added to do it a better way. And I will update the plug-in with your code posted.

Pretty new to this plug-in coding

Paul M 09-14-2006 03:50 AM

That's not the way its done. :)

You create/edit plugins in your ACP and then export the product as an XML file afterwards, not try and add them directly to the XML file.

If you look in your plugins for this product, you will find you now have two associated with the cache_templates hook. Delete one, edit the other to contain the two lines of code I gave you, and then re-export it.


All times are GMT. The time now is 01:56 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01420 seconds
  • Memory Usage 1,750KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete