[How-To] vBulletin API Basics: Variables, Functions, Objects
by
10 Oct 2005
Rating: (4 votes
- 4.75 average)
vBulletin API Basics: Variables, Functions, Objects This How-To should serve as a reference to coders, who have a basic knowledge of PHP and who want to make their own mods. $vbulletin (Type: Object) Contains vBulletin data that has been in separate variables in vB 3.0.x. Below you can find a translation table of changed variables and functions. This is an expanded version of the list that you can find in vBulletin's source code (functions_legacy.php). vBulletin 3.0.3 locations are on the left hand side, and the corresponding vBulletin 3.5.0 locations are on the right hand side. Legacy locations can be enabled by running legacy_enable(), although this is officially not recommended for long term compatibility. Code:
* $vboptions['x'] --> $vbulletin->options['x'] * $iforumcache --> $vbulletin->iforumcache * $forumcache --> $vbulletin->forumcache * $usergroupcache --> $vbulletin->usergroupcache * $datastore['wol_spiders'] --> $vbulletin->wol_spiders * $smiliecache --> $vbulletin->smiliecache * $stylechoosercache --> $vbulletin->stylecache * $datastore['x'] --> $vbulletin->x * $bbuserinfo['x'] --> $vbulletin->userinfo['x'] * $session['x'] --> $vbulletin->session->vars['x'] * * $_BITFIELD['usergroup'] --> $vbulletin->bf_ugp * $_BITFIELD['usergroup']['x'] --> $vbulletin->bf_ugp_x * $_BITFIELD['usergroup']['x']['y'] --> $vbulletin->bf_ugp_x['y'] * $_BITFIELD['calmoderatorpermissions']['x'] --> $vbulletin->bf_misc_calmoderatorpermissions['x'] * $_BITFIELD['moderatorpermissions']['x'] --> $vbulletin->bf_misc_moderatorpermissions['x'] * $_BITFIELD['languageoptions']['x'] --> $vbulletin->bf_misc_languageoptions['x'] * $_USEROPTIONS['x'] --> $vbulletin->bf_misc_useroptions['x'] * $_FORUMOPTIONS['x'] --> $vbulletin->bf_misc_forumoptions['x'] * $_INTPERMS --> $vbulletin->bf_misc_intperms * $_INTPERMS['x'] --> $vbulletin->bf_misc_intperms['x'] * * ------------------------------------------------------------------------------ * Variables and Functions below are NOT affected/re-enabled by legacy_enable() * ------------------------------------------------------------------------------ * * $_GET/$_POST/$_REQUEST/$_COOKIE/$_FILES --> $vbulletin->GPC['x'] * $DB_Site->x() --> $vbulletin->db->x() * $url --> $vbulletin->url * $nozip --> $vbulletin->nozip * $script --> $vbulletin->script * $scriptpath --> $vbulletin->scriptpath * * HTML_SELECTED --> not defined anymore in vB 3.5 * HTML_CHECKED --> not defined anymore in vB 3.5 * * bbcode_parse() --> $bbcode_parser->parse * iif($condition, $r_true, $r_false) --> obsolete, use ($condition ? $r_true : $r_false) instead;
$db (Type: Object) As you might have judged from the Table 1 in this tutorial, the database object in vB3.5 is $vbulletin->db. However, $db is another way to access that object; it is the way that used everywhere unless you call it from within a function. In functions, use $vbulletin->db. Obviously, the purpose of the database method is to perform various operations on the database. Most common methods are described below.
Data Managers Data Managers (DMs) are an interface to various data objects used within vBulletin. They enforce necessary constraints and administrator-set options on the data to ensure that the data is valid. You can read more about Data Managers in http://www.vbulletin.com/docs/html/data_managers. Also, you can read specifically about the User DM in this KirbyDE's How-To, and about Thread DM here. Authentication Storage The authentication data is stored in the following way (thank to Kirby for this info): $_COOKIE: {cookiepfx}userid - plain(userid) {cookiepfx}password - md5(md5(md5('PlaintextPassword') . salt) . 'LicenseNo'). TABLE user: password - md5(md5('PlaintextPassword') . salt) Note that for cookie, {cookiepfx} is your board's cookie prefix. It is configurable via admincp and is accessible via the COOKIE_PREFIX constant. Important Functions
>> EOD |