vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Can I use this code in vb4 ? (https://vborg.vbsupport.ru/showthread.php?t=280830)

sadiq6210 03-29-2012 08:53 AM

Can I use this code in vb4 ?
 
I was searching for this code but I found it for vb3
Can I use it in vb4?


Quote:

It would be easy enough to switch the way views are counted with a couple of plugins.

1- Hook Location: vba_links_showlink_goto
PHP Code:

$vbulletin->url $vba_links->_link['linkurl'];
eval(
print_standard_redirect('adv_links_transferring'));
exit; 


2- Hook Location: vba_links_showlink_showdetails_start
PHP Code:

$db->query_write("UPDATE LOW_PRIORITY " TABLE_PREFIX "adv_links SET views = views+1 WHERE linkid = $linkid"); 



kh99 03-29-2012 11:19 AM

I don't think there's anything that won't work for vb4. I don't think the eval() around the print_standard_redirect() is needed, but I don't think it hurts anything.

sadiq6210 03-31-2012 07:28 AM

I didn't think the eval() will work that's why I asked, but after read you post I tried to use it and it is working perfect with me.

Thanks dear

Pandemikk 03-31-2012 07:33 AM

The eval() may or may not be needed. I'm never sure on the context. It's not going to break your code, but it may prevent the redirect from working as intended. I'd leave it there.

But the exit is not needed, standard_redirect (which is called from print_standard_redirect) halts execution with an exit. :D

kh99 03-31-2012 09:57 AM

Quote:

Originally Posted by Pandemikk (Post 2315289)
But the exit is not needed, standard_redirect (which is called from print_standard_redirect) halts execution with an exit. :D

That's exactly the reason the eval() isn't needed - it never returns so nothing is ever eval'ed. In previous versions of vb print_standard_redirect() would return a string that needed to be eval'ed.

Pandemikk 03-31-2012 10:09 AM

Yeah I don't understand why vB uses eval so much. There's no need to eval print_standard_redirect unless I'm missing something from being up at this hour.


All times are GMT. The time now is 03:47 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.00942 seconds
  • Memory Usage 1,725KB
  • 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
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete