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
  #52  
Old 07-07-2005, 01:51 AM
Kadence Kadence is offline
 
Join Date: Nov 2004
Location: New Jersey
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The parameters for the print_forum_chooser() function in /includes/adminfunctions.php have changed.

Old (vB 3.0.7):
PHP Code:
function print_forum_chooser($name 'forumid'$selectedid = -1$topname NULL$title NULL$displaytop 1$multiple 0$displayselectforum 0
New (vB 3.5 Beta 3):
PHP Code:
function print_forum_chooser($title$name$selectedid = -1$topname null$displayselectforum false$multiple false
The $title parameter has moved from the 4th parameter to the 1st, $displayselectforum and $multiple have swapped places, and the $displaytop parameter has been deleted.
Reply With Quote
  #53  
Old 07-26-2005, 07:00 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It took me a while to figure out:

PHP Code:
$id intval($_REQUEST['id']); 
has become:

PHP Code:
    $vbulletin->input->clean_array_gpc('r', array(
        
'id'=> TYPE_UINT
    
));
    
$id $vbulletin->GPC['id']; 
Reply With Quote
  #54  
Old 07-26-2005, 07:02 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$id is empty because you must use $vbulletin->GPC['id']

Btw: For just one variable, it doesn't make too much sense to use clean_array_gpc().
Reply With Quote
  #55  
Old 07-26-2005, 07:09 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I edited my above post to add another example so that someone who's as stupid as me understands it


vBulletin provides this functions so I'll use them
Reply With Quote
  #56  
Old 07-26-2005, 07:14 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Easier approach & less overhead:
PHP Code:
$id $vbulletin->input->clean_gpc('r''id'TYPE_UINT); 
Reply With Quote
  #57  
Old 07-26-2005, 07:27 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you

One should edit the first post of this thread and add all usefull information
Reply With Quote
  #58  
Old 07-27-2005, 09:10 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What happened to $_FILES ?

What would this code look like:
PHP Code:
$imagesize getimagesize($_FILES['src']['tmp_name']); 
Reply With Quote
  #59  
Old 07-28-2005, 03:15 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would be using clean_gpc with a 'f' as the first parameter.
Reply With Quote
  #60  
Old 07-29-2005, 11:51 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
Easier approach & less overhead:
PHP Code:
$id $vbulletin->input->clean_gpc('r''id'TYPE_UINT); 
Interesting.
Reply With Quote
  #61  
Old 07-30-2005, 04:35 AM
RaidenDAWG2 RaidenDAWG2 is offline
 
Join Date: Mar 2005
Location: THE Ohio State University
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

These new globalize things are driving me nuts here.

I used to have something that looked like this in 3.0.x...

PHP Code:
if(isset($_POST['do']))
{
    
$do=$_POST['do'];
}
if(isset(
$_GET['u']))
{
    
$spammerid=$_GET['u'];
}
elseif(isset(
$_POST['u']))
{
    
$spammerid=$_POST['u'];
}
if(isset(
$_GET['t']))
{
    
$threadid=$_GET['t'];
}
elseif(isset(
$_POST['t']))
{
    
$threadid=$_POST['t'];
}
if(isset(
$_GET['p']))
{
    
$postid=$_GET['p'];
}
elseif(isset(
$_POST['p']))
{
    
$postid=$_POST['p'];

Pretty standard $_GET/$_POST structure that reads in either the get or post based on which step it is (it's a spam killing type thing, pops up a window with some options to confirm, then submits and does its thing).

So in trying to convert it over to 3.5 RC1, I tried this...

PHP Code:
$vbulletin->input->clean_array_gpc('g', array(
    
'do' => TYPE_STR,
    
'u'=> TYPE_INT,
    
't'=> TYPE_INT,
    
'p'=> TYPE_INT)
);
if(isset(
$vbulletin->GPC['do']))
{
    
$do $vbulletin->GPC['do'];
}

if(isset(
$vbulletin->GPC['u']));
{
    
$spammeruserid $vbulletin->GPC['u'];
}

if(isset(
$vbulletin->GPC['p']));
{
    
$spammerpostid $vbulletin->GPC['p'];
}

if(isset(
$vbulletin->GPC['t']));
{
    
$spammerthreadid $vbulletin->GPC['t'];

So...yeah...where am I going wrong here? Any help you guys can give me would be much appreciated

Thanks,
-RD
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 02:29 PM.


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.09424 seconds
  • Memory Usage 2,332KB
  • Queries Executed 25 (?)
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
  • (9)bbcode_php
  • (1)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_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