Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
List of changed var/array/function names
Brad
Join Date: Nov 2001
Posts: 4,765

 

Show Printable Version Email this Page Subscription
Brad Brad is offline 06-06-2005, 10:00 PM

A lot of things changed in 3.5 and you might find yourself lost for awhile as you figure out how to work with the new var/array/function names. This list should help you port your old 3.0.x hacks quicker, if you have anything to add to the list reply to this thread and I will edit the first post!

Note that some of these might not work in some parts of the new code, OOP changes a lot of things, in some cases you might be using $this-> or some other alternative to get to these.

On the front end they will work for the most part. Do remember that there are hooks littered in the 'build' functions like the one that builds postbit. For an example of working with such hooks you can check out a plug-in I released, I spend 5 minutes wondering why $post would not work until I realized I was begin an idiot!

Anyway check out the .xml file: https://vborg.vbsupport.ru/showthread.php?t=82623

Turned out I needed to use $this->post because that hook was inside of a function! Doh!

[high]The big list...[/high]

3.0.x version of the var will be on the left, 3.5 on the right as so:

3.0.x => 3.5

[high]Global[/high]

$DB_site-> => $db->
$bbuserinfo[] => $vbulletin->userinfo[]
$vboptions[] => $vbulletin->options[]
$_GET/$_REQUEST/$_POST/$_COOKIE => $vbulletin->GPC[]
globalize() => $vbulletin->input->clean_array_gpc()
Reply With Quote
  #42  
Old 06-14-2005, 03:10 PM
tamarian tamarian is offline
 
Join Date: Oct 2001
Location: Canada
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tmhall
Thanks for the info, tamarian. I'll just use $post[userid] in the postbit instead.

Do you have any idea how I can solve this problem? Is there a replacement for $GLOBALS?
How about this?

$vbulletin->userinfo['buddyarray'] = $buddyarray
Reply With Quote
  #43  
Old 06-15-2005, 05:11 AM
zetetic's Avatar
zetetic zetetic is offline
 
Join Date: Apr 2004
Posts: 338
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tamarian
How about this?

$vbulletin->userinfo['buddyarray'] = $buddyarray
Hm... Actually I think I goofed up somewhere else before. $GLOBALS is working fine now.
Reply With Quote
  #44  
Old 06-21-2005, 10:01 AM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

function construct_page_nav now accepts 5 params, not just 3 as the legacy one

but I don't really know why the phpdoc only states for 3 params:

PHP Code:
// #############################################################################
/**
* Returns the HTML for multi-page navigation - based on code from 3dfrontier.com
*
* @param    integer    Total number of items found
* @param    string    Base address for links eg: showthread.php?t=99{&page=4}
* @param    string    Ending portion of address for links
*
* @return    string    Page navigation HTML
*/
function construct_page_nav($pagenumber$perpage$results$address$address2 ''
1st param: current page number
2st param: number of items per page.
the last 3 params are defined in the phpdoc above, they're just like before.


Please update all the info that users submit so that others only have to look at the fist post so that they can check for what has been changed.
Reply With Quote
  #45  
Old 06-21-2005, 10:19 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tmhall
Yeah, I mentioned that u=$userinfo[userid] wasn't working in the postbit a few posts ago. I think we might have to wait for the documentation to find out all the new conditionals.
$userinfo did not change, it is still built in member.php take a look. The reason it didn't work in the postbit is it's not defined there, what your looking for is.

PHP Code:
$post[userid
Reply With Quote
  #46  
Old 06-21-2005, 01:10 PM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$url => $vbulletin->url

-----------------------------------------

I can't use $vbulletin->input->clean_array_gpc as globalize()

with globalize()

globalize($_POST, array('e' => INT, 'do' => STR_NOHTML, 'iconid' => INT));

gives value to varibles $e, $do, $iconid

but with

$vbulletin->input->clean_array_gpc('p', array('e' => TYPE_UINT, 'do' => TYPE_STR, 'iconid' => TYPE_UINT));

I can't get $e, $do, $iconid

any suggestion to use $vbulletin->input->clean_array_gpc properly ?

EDIT: I figured out it turns to be $vbulletin->GPC['e'], $vbulletin->GPC['do'], $vbulletin->GPC['iconid'], am I correct ? how complex.

------------------------------------------

print_standard_error(...)
is now redundant. Instead, use
standard_error(fetch_error(...))
Reply With Quote
  #47  
Old 06-25-2005, 06:39 PM
scotsmist scotsmist is offline
 
Join Date: May 2005
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

While looking at the changes needed for vbportal, I wanted to share what I found.

I see you have $bbuserinfo is now $vbulletin->userinfo listed, you may want to add $session is now $vbulletin->session

$session[sessionurl] for example is now $vbulletin->session->vars[sessionurl]
$session[sessionurl_js] is now $vbulletin->session->vars[sessionurl_js]

another is with the datastore caches which are unserialised in init.php

$forumcache is now $vbulletin->forumcache
$iconcache is now $vbulletin->iconcache
etc

another is $url is now $vbulletin->url
also $nozip is now $vbulletin->nozip
plus $scipt is now $vbulletin->script
and $scriptpath is now $vbulletin->scriptpath

in addition to $vbulletin->input->clean_array_gpc you can also use $vbulletin->input->clean_gpc when there is only one variable. you may wish to use something like $perpage = $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT); so you can use $perpage in a template

the bitwise $_FORUMOPTIONS and $_USEROPTIONS have been replaced by $vbulletin->bf_ugp_forumoptions and $vbulletin->bf_ugp_useroptions

notice that HTML_SELECTED and HTML_CHECKED are not defined now

function iif() is marked as obsolete to ! (one of my personal favourites)

function bbcode_parse is now $bbcode_parser->parse

the print_standard_redirect function has changed a little and it doesn't pass the $url anymore, so you need to set $vbulletin->url first. the function also supports forceredirect, so there's no need to set $GLOBALS['forceredirect'] anymore.
Reply With Quote
  #48  
Old 06-30-2005, 01:29 AM
mute mute is offline
 
Join Date: Dec 2002
Location: Phoenixville, PA
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Big-board here, with the annoying questions nobody wants to answer.

I read all about the 3.5 changes on vb.com, but I didn't see anything about the query_write query_read abstraction until just now. Color me floored!

My question is, for us large sites that use MySQL replication functionality, is there anything in place currently to distribute reads among a group of servers which are replicating? I'd love to be able to easily spread reads to our slave server(s) for queries, and have the ability to pseudo load balance queries, or at least have some type of "failover", that is, if our slave server is unresponsive to remove it from the pool of available query_read capable servers.

Obviously this would be a very rudimentary form of clustering, but I'll take what I can get at this point (It's more MySQL's fault than anything else, not having master<->master replication sucks).
Reply With Quote
  #49  
Old 06-30-2005, 03:41 PM
Ratchet Ratchet is offline
 
Join Date: May 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does anyone know how the style vars are stored now? $style["imgdir_misc"] still works as before, but $style["title"] and some others do not.
Reply With Quote
  #50  
Old 07-02-2005, 02:55 PM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Brad.loo
$_GET/$_REQUEST/$_POST/$_COOKIE => $vbulletin->GPC[]
I read the above, but still in the code, there are instances that vBulletin uses $_REQUEST.

Can someone shed some light on this? Based on the above, I changed a program to use $vbulletin->GPC instead of $_REQUEST and the program no longer works. Switched back to $_REQUEST and everything works fine.

I am puzzled.

I think I need to elaborate:

In the past, I was using this part of code:

PHP Code:
// ########################## REDIRECT ###############################
if ($_REQUEST['do'] == 'nextstep')
{
    
globalize($_REQUEST, array(
        
'action' => STR,
        
'done' => STR
    
));
    if (empty(
$action))
    {
        
define('CP_REDIRECT'THIS_SCRIPT '.php');
    }
    else
    {
        
define('CP_REDIRECT'THIS_SCRIPT '.php?step=' $action);
    }
    
print_stop_message('redirecting_please_wait');

Now, the code has to be changed to:

PHP Code:
if ($_REQUEST['do'] == 'nextstep')
{

    
$vbulletin->input->clean_array_gpc('r', array(
        
'action'=> TYPE_STR,
        
'done'=> TYPE_STR,
    ));

    if (empty(
$vbulletin->GPC['action']))
    {
        
define('CP_REDIRECT'THIS_SCRIPT '.php');
    }
    else
    {
        
define('CP_REDIRECT'THIS_SCRIPT '.php?step=' $vbulletin->GPC['action']);
    }
    
print_stop_message('redirecting_please_wait');

I found this after a lot of trials and errors. What's the reason for having to check for $_REQUEST['do'] in the first if, and then use $vbulletin->GPC in the next parts? Where do I use $_REQUEST and where $vbulletin->GPC????
Reply With Quote
  #51  
Old 07-02-2005, 05:21 PM
Cloudrunner's Avatar
Cloudrunner Cloudrunner is offline
 
Join Date: May 2003
Location: Butte, MT
Posts: 635
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sv1cec
I read the above, but still in the code, there are instances that vBulletin uses $_REQUEST.

Can someone shed some light on this? Based on the above, I changed a program to use $vbulletin->GPC instead of $_REQUEST and the program no longer works. Switched back to $_REQUEST and everything works fine.

I am puzzled.

I think I need to elaborate:

In the past, I was using this part of code:

PHP Code:
// ########################## REDIRECT ###############################
if ($_REQUEST['do'] == 'nextstep')
{
    
globalize($_REQUEST, array(
        
'action' => STR,
        
'done' => STR
    
));
    if (empty(
$action))
    {
        
define('CP_REDIRECT'THIS_SCRIPT '.php');
    }
    else
    {
        
define('CP_REDIRECT'THIS_SCRIPT '.php?step=' $action);
    }
    
print_stop_message('redirecting_please_wait');

Now, the code has to be changed to:

PHP Code:
if ($_REQUEST['do'] == 'nextstep')
{

    
$vbulletin->input->clean_array_gpc('r', array(
        
'action'=> TYPE_STR,
        
'done'=> TYPE_STR,
    ));

    if (empty(
$vbulletin->GPC['action']))
    {
        
define('CP_REDIRECT'THIS_SCRIPT '.php');
    }
    else
    {
        
define('CP_REDIRECT'THIS_SCRIPT '.php?step=' $vbulletin->GPC['action']);
    }
    
print_stop_message('redirecting_please_wait');

I found this after a lot of trials and errors. What's the reason for having to check for $_REQUEST['do'] in the first if, and then use $vbulletin->GPC in the next parts? Where do I use $_REQUEST and where $vbulletin->GPC????
Do this instead to avoid that situation:
PHP Code:
$vbulletin->input->clean_array_gpc('r', array(
    
'do' => TYPE_STR,
    
'action'=> TYPE_STR,
    
'done'=> TYPE_STR)
);

if (
$vbulletin->GPC['do'] == 'nextstep'){
    if (empty(
$vbulletin->GPC['action'])){
       
define('CP_REDIRECT'THIS_SCRIPT '.php');
    } else {
       
define('CP_REDIRECT'THIS_SCRIPT '.php?step=' $vbulletin->GPC['action']);
    }
    
print_stop_message('redirecting_please_wait');

This effectively puts the $_REQUEST['do'] into the GPC, thus removing the need for the call to any $_REQUESTs. Of course, if you are only using the $_REQUEST['do'] to navigate through your script and not calling anything else, then you can leave the $_REQUEST calls and it will remove some overhead according to KirbyDE when I asked basically the same question.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:03 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04934 seconds
  • Memory Usage 2,352KB
  • Queries Executed 27 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (7)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete