File/includes/functions.php

Description
Constants
ERRTYPE_ARRAY = 0 (line 17)
ERRTYPE_CP = 2 (line 19)
ERRTYPE_SILENT = 3 (line 20)
ERRTYPE_STANDARD = 1 (line 18)
FETCH_USERINFO_ADMIN = 0x10 (line 1223)
FETCH_USERINFO_AVATAR = 0x02 (line 1220)
FETCH_USERINFO_ISFRIEND = 0x80 (line 1226)
FETCH_USERINFO_LOCATION = 0x04 (line 1221)
FETCH_USERINFO_PROFILEPIC = 0x08 (line 1222)
FETCH_USERINFO_SIGPIC = 0x20 (line 1224)
FETCH_USERINFO_USERCSS = 0x40 (line 1225)
FORUM_PREPEND = '    ' (line 14)
REQ_AUTO = 2 (line 31)
REQ_INCR = 3 (line 32)
REQ_NO = 0 (line 29)
REQ_YES = 1 (line 30)
VF_CODE = 2 (line 24)
VF_METHOD = '_-_mEtHoD_-_' (line 27)
VF_METHODNAME = 3 (line 25)
VF_REQ = 1 (line 23)
VF_TYPE = 0 (line 22)
Functions
addslashes_js (line 5317)

Escapes quotes in strings destined for Javascript

string addslashes_js (string $text, [string $quotetype = "'"])
  • string $text: String to be prepared for Javascript
  • string $quotetype: Type of quote (single or double quote)
build_datastore (line 5254)

Saves the specified data into the datastore

void build_datastore ([string $title = ''], [mixed $data = ''], [integer $unserialize = 0])
  • string $title: The name of the datastore item to save
  • mixed $data: The data to be saved
  • integer $unserialize: 1 or 0 as to whether this value is to be automatically unserialised on retrieval
cache_ordered_forums (line 3184)

Gets counter information and makes sure the forums are in the proper order for tree iteration. Changes will be made to the forum cache directly.

void cache_ordered_forums ([boolean $getcounters = 0], [boolean $getinvisibles = 0], [integer $userid = 0])
  • boolean $getcounters: Whether or not to get the forum counter info
  • boolean $getinvisibles: Whether to include invisible forums in the liast
  • integer $userid: ID of the user that subscribed forums should be fetched for
cache_permissions (line 3933)

Returns the full set of permissions for the specified user (called by global or init)

  • return: Permissions component of user info array
array cache_permissions (array &$user, [boolean $getforumpermissions = true], [boolean $resetaccess = false])
  • array &$user: (ref) User info array
  • boolean $getforumpermissions: If true, returns combined usergroup permissions, individual forum permissions, individual calendar permissions and attachment permissions
  • boolean $resetaccess: Reset the accesscache array for permissions following access mask update. Only allows one reset.
cache_templates (line 3038)

Fetches a number of templates from the database and puts them into the templatecache

void cache_templates (array $templates, string $templateidlist)
  • array $templates: List of template names to be fetched
  • string $templateidlist: Serialized array of template name => template id pairs
can_moderate (line 4518)

Returns whether or not the given user can perform a specific moderation action in the specified forum

boolean can_moderate ([integer $forumid = 0], [string $do = ''], [integer $userid = -1], [string $usergroupids = ''])
  • integer $forumid: Forum ID
  • string $do: If you want to check a particular moderation permission, name it here
  • integer $userid: User ID
  • string $usergroupids: Comma separated list of usergroups to which the user belongs
construct_forum_jump (line 3305)

Returns the HTML for the forum jump menu

void construct_forum_jump ([integer $parentid = -1], [boolean $addbox = true], [string $prependchars = ''], [string $permission = ''])
  • integer $parentid: ID of the parent forum for the group to be shown (-1 for all)
  • boolean $addbox: If true, evaluate the forumjump template too
  • string $prependchars: Characters to prepend to forum titles to indicate depth
  • string $permission: Not sure actually...
construct_language_options (line 5101)

Constructs a language chooser HTML menu

string construct_language_options ([integer $depthmark = ''], [boolean $quickchooser = false])
  • integer $depthmark: Style ID
  • boolean $quickchooser: Whether or not this will build the quick chooser menu
construct_navbits (line 2410)

Returns the HTML for the navigation breadcrumb in the navbar

This function will also set the GLOBAL $pagetitle to equal whatever is the last item in the navbits

string construct_navbits (array $nav_array)
  • array $nav_array: Array of link => title pairs from which to build the link chain
construct_page_nav (line 2281)

Returns the HTML for multi-page navigation

  • return: Page navigation HTML
string construct_page_nav (integer $pagenumber, integer $perpage, integer $results, string $address, [string $address2 = ''], [ $anchor = ''])
  • integer $pagenumber: Page number being displayed
  • integer $perpage: Number of items to be displayed per page
  • integer $results: Total number of items found
  • string $address: Base address for links eg: showthread.php?t=99{&page=4}
  • string $address2: Ending portion of address for links
  • $anchor
construct_phrase (line 2466)

Construct Phrase

this function is actually just a wrapper for sprintf but makes identification of phrase code easier and will not error if there are no additional arguments. The first parameter is the phrase text, and the (unlimited number of) following parameters are the variables to be parsed into that phrase.

  • return: The parsed phrase
string construct_phrase (string 0, mixed 1, mixed 2)
  • string 0: Text of the phrase
  • mixed 1: First variable to be inserted
  • mixed 2: Nth variable to be inserted
construct_style_options (line 5168)

Constructs a style chooser HTML menu

string construct_style_options ([integer $styleid = -1], [string $depthmark = ''], [boolean $init = true], [boolean $quickchooser = false])
  • integer $styleid: Style ID
  • string $depthmark: String repeated before style name to indicate nesting
  • boolean $init: Whether or not to initialize this function (this function is recursive)
  • boolean $quickchooser: Whether or not this will build the quick chooser menu
convert_bbarray_cookie (line 2032)

Replaces all those none safe characters so we dont waste space in array cookie values with URL entities

array convert_bbarray_cookie (string $cookie, [string $dir = 'get'])
  • string $cookie: Cookie array
  • string $dir: Direction ('get' or 'set')
convert_bits_to_array (line 3904)

Converts a bitfield into an array of 1 / 0 values based on the array describing the resulting fields

array convert_bits_to_array (integer &$bitfield, array $_FIELDNAMES)
  • integer &$bitfield: (ref) Bitfield
  • array $_FIELDNAMES: Array containing field definitions - array('canx' => 1, 'cany' => 2, 'canz' => 4) etc
convert_int_to_utf8 (line 3646)

Converts an integer into a UTF-8 character string

string convert_int_to_utf8 (integer $intval)
  • integer $intval: Integer to be converted
convert_unicode_char_to_charset (line 3728)

Converts a single unicode character to the desired character set if possible.

Attempts to use iconv if it's available. Callback function for the regular expression in convert_urlencoded_unicode.

  • return: Character in desired character set or as an HTML entity
string convert_unicode_char_to_charset (integer $unicode_int, string $charset)
  • integer $unicode_int: Unicode code point value
  • string $charset: Character to convert to
convert_urlencoded_unicode (line 3686)

Converts Unicode entities of the format %uHHHH where each H is a hexadecimal character to &#DDDD; or the appropriate UTF-8 character based on current charset.

  • return: Decoded text
string convert_urlencoded_unicode (string $text)
  • string $text: Encoded text
create_full_url (line 2983)

Translates a relative URL to a fully-qualified URL. URLs not beginning with a / are assumed to be within the main vB-directory

void create_full_url (string $url, string 1)
  • string 1: Fully-qualified URL
  • string $url: Relative URL
datamanager_init (line 67)

Class factory. This is used for instantiating the extended classes.

  • return: An instance of the desired class
vB_DataManager &datamanager_init (string $classtype, vB_Registry &$registry, [integer $errtype = ERRTYPE_STANDARD], [string $forcefile = ''])
  • string $classtype: The type of the class to be called (user, forum etc.)
  • vB_Registry &$registry: An instance of the vB_Registry object.
  • integer $errtype: One of the ERRTYPE_x constants
  • string $forcefile: Option to force loading a class from a specific file; no extension
devdebug (line 3756)

Stuffs a message into the $DEVDEBUG array

void devdebug ([string $text = ''])
  • string $text: Message to store
exec_headers (line 3773)

Sends the appropriate HTTP headers for the page that is being displayed

void exec_headers ([boolean $headers = true], [boolean $nocache = true])
  • boolean $headers: If true, send HTTP 200
  • boolean $nocache: If true, send no-cache headers
exec_header_redirect (line 2939)

Halts execution and redirects to the specified URL invisibly

void exec_header_redirect (string $url)
  • string $url: Destination URL
exec_mail_queue (line 769)

Reads the email message queue and delivers a number of pending emails to the message sender

void exec_mail_queue ()
exec_nocache_headers (line 3821)

Sends no-cache HTTP headers

void exec_nocache_headers ([boolean $sendcontent = true])
  • boolean $sendcontent: If true, send content-type header
exec_shut_down (line 5579)

Performs general clean-up after the system exits, such as running shutdown queries

void exec_shut_down ()
exec_switch_bg (line 2149)

Reads $bgclass and returns the alternate table class

  • return: CSS class name
string exec_switch_bg ([integer $alternate = 0])
  • integer $alternate: If > 0, allows us to have multiple classes on one page without them overwriting each other
exec_vbsetcookie (line 1921)

Calls PHP's setcookie() or sends raw headers if 'httponly' is required.

Should really only be called through vbsetcookie()

  • return: True on success
boolean exec_vbsetcookie (string $name, string $value, int $expires, [string $path = ''], [string $domain = ''], [boolean $secure = false], [boolean $httponly = false])
  • string $name: Name
  • string $value: Value
  • int $expires: Expire
  • string $path: Path
  • string $domain: Domain
  • boolean $secure: Secure
  • boolean $httponly: HTTP only - see http://msdn.microsoft.com/workshop/author/dhtml/httponly_cookies.asp
fetch_bbarray_cookie (line 1970)

Returns the value for an array stored in a cookie

mixed fetch_bbarray_cookie (string $cookiename, mixed $id)
  • string $cookiename: Name of the cookie
  • mixed $id: ID of the data within the cookie
fetch_censored_text (line 550)

Replaces any instances of words censored in $vbulletin->options['censorwords'] with $vbulletin->options['censorchar']

string fetch_censored_text (string $text)
  • string $text: Text to be censored
fetch_email_phrases (line 2517)

Returns 2 lines of eval()-able code -- one sets $message, the other $subject.

string fetch_email_phrases (string $email_phrase, [integer $languageid = -1], [string $emailsub_phrase = ''], [string $varprefix = ''])
  • string $email_phrase: Name of email phrase to fetch
  • integer $languageid: Language ID from which to pull the phrase (see fetch_phrase $languageid)
  • string $emailsub_phrase: If not empty, select the subject phrase with the given name
  • string $varprefix: Optional prefix for $message/$subject variable names (eg: $varprefix = 'test' -> $testmessage, $testsubject)
fetch_error (line 2545)

Fetches an error phrase from the database and inserts values for its embedded variables

  • return: The parsed phrase text
string fetch_error (string 0, mixed 1, mixed 2, mixed 3)
  • string 0: Varname of error phrase
  • mixed 1: Value of 1st variable
  • mixed 2: Value of 2nd variable
  • mixed 3: Value of Nth variable
fetch_foruminfo (line 1059)

Returns an array containing info for the specified forum, or false if forum is not found

mixed fetch_foruminfo (integer &$forumid, [boolean $usecache = true])
  • integer &$forumid: (ref) Forum ID
  • boolean $usecache: Whether or not to return the result from the forumcache if it exists
fetch_forum_clause_sql (line 1443)

Returns an SQL condition like (forumid = 1 OR forumid = 2 OR forumid = 3) for each of a forum's parents

string fetch_forum_clause_sql (integer $forumid, [string $field = 'forumid'], [string $joiner = 'OR'], [string $parentlist = ''])
  • integer $forumid: Forum ID
  • string $field: The name of the field to be used in the clause
  • string $joiner: The 'joiner' word - could be 'OR' or 'AND' etc.
  • string $parentlist: The parentlist of the specified forum (comma separated string)
fetch_forum_parent_list (line 1400)

Returns the parentlist of the specified forum

  • return: Comma separated list of parent forum IDs
string fetch_forum_parent_list (integer $forumid)
  • integer $forumid: Forum ID
fetch_gzipped_text (line 1718)

Returns a gzip-compressed version of the specified string

string fetch_gzipped_text (string $text, [integer $level = 1])
  • string $text: Text to be gzipped
  • integer $level: Level of Gzip compression (1-10)
fetch_language_fields_sql (line 879)

Returns a portion of an SQL query to select language fields from the database

string fetch_language_fields_sql ([boolean $addtable = true])
  • boolean $addtable: If true, select 'language.fieldname' otherwise 'fieldname'
fetch_membergroupids_array (line 353)

Returns an array of usergroupids from all the usergroups to which a user belongs

  • return: Usergroup IDs to which the user belongs
array fetch_membergroupids_array (array $user, [boolean $getprimary = true])
  • array $user: User info array - must contain usergroupid and membergroupid fields
  • boolean $getprimary: Whether or not to fetch the user's primary group as part of the returned array
fetch_moderator_permissions (line 4401)

Returns moderator permissions bitfield for the given forum and user

integer fetch_moderator_permissions (integer $forumid, [integer $userid = -1], [boolean $useglobalperms = false])
  • integer $forumid: Forum ID
  • integer $userid: User ID
  • boolean $useglobalperms: Include Global Permissions for Super Moderators
fetch_musername (line 991)

fetches the proper username markup and title

string fetch_musername (array &$user, [string $displaygroupfield = 'displaygroupid'], [string $usernamefield = 'username'])
  • array &$user: (ref) User info array
  • string $displaygroupfield: Name of the field representing displaygroupid in the User info array
  • string $usernamefield: Name of the field representing username in the User info array
fetch_options_overrides (line 5002)

Function to override various settings in $vbulletin->options depending on user preferences

void fetch_options_overrides (array $userinfo)
  • array $userinfo: User info array
fetch_permissions (line 4337)

Returns permissions for given forum and user

mixed fetch_permissions ([integer $forumid = 0], [integer $userid = -1], [array $userinfo = false])
  • integer $forumid: Forum ID
  • integer $userid: User ID
  • array $userinfo: User info array
fetch_postinfo (line 1187)

Returns an array contining info for the specified post, or false if post is not found

mixed fetch_postinfo (integer &$postid)
  • integer &$postid: (ref) Post ID
fetch_profilefield_display (line 1360)

Converts the database value of a profilefield and prepares the displayable value as $profilefield['value']

  • return: Profilefield data including 'value' key
array fetch_profilefield_display (array &$profilefield, string $profilefield_value)
  • array &$profilefield: Profilefield data (SELECT * FROM profilefield WHERE profilefieldid = $profilefieldid)
  • string $profilefield_value: Database value of profilefield
fetch_query_sql (line 936)

Returns an UPDATE or INSERT query string for use in big queries with loads of fields...

string fetch_query_sql (array $queryvalues, string $table, [string $condition = ''], [array $exclusions = ''])
  • array $queryvalues: Array of fieldname = value pairs - array('userid' => 21, 'username' => 'John Doe')
  • string $table: Name of the table into which the data should be saved
  • string $condition: SQL condition to add to the query string
  • array $exclusions: Array of field names that should be ignored from the $queryvalues array
fetch_soft_break_string (line 695)

Breaks up strings (typically URLs) semi-invisibly to avoid word-wrapping issues

string fetch_soft_break_string (string $string)
  • string $string: Text to be broken
fetch_start_end_total_array (line 2386)

Returns an array so you can print 'Showing results $arr[first] to $arr[last] of $totalresults'

  • return: In the format of - array('first' => x, 'last' => y)
array fetch_start_end_total_array (integer $pagenumber, integer $perpage, integer $total)
  • integer $pagenumber: Current page number
  • integer $perpage: Results to show per-page
  • integer $total: Total results found
fetch_stylevars (line 4904)

Returns the complete array of StyleVars

array fetch_stylevars (array &$style, array $userinfo)
  • array &$style: (ref) Style info array
  • array $userinfo: User info array
fetch_template (line 3096)

Returns a single template from the templatecache or the database

string fetch_template (string $templatename, [integer $escape = 0], [boolean $gethtmlcomments = true])
  • string $templatename: Name of template to be fetched
  • integer $escape: Escape quotes in template? 1: escape template; -1: unescape template; 0: do nothing
  • boolean $gethtmlcomments: Wrap template in HTML comments showing the template name?
fetch_threadinfo (line 1109)

Returns an array containing info for the speficied thread, or false if thread is not found

mixed fetch_threadinfo (integer &$threadid, [ $usecache = true])
  • integer &$threadid: (ref) Thread ID
  • $usecache
fetch_time_data (line 3399)

Sets various time and date related variables according to visitor's preferences

Sets $timediff, $datenow, $timenow, $copyrightyear

void fetch_time_data ()
fetch_trimmed_title (line 641)

Trims a string to the specified length while keeping whole words

string fetch_trimmed_title (string $title, [integer $chars = -1], [boolean $append = true])
  • string $title: String to be trimmed
  • integer $chars: Number of characters to aim for in the trimmed string
  • boolean $append: Append "..." to shortened text
fetch_userinfo (line 1248)

Fetches an array containing info for the specified user, or false if user is not found

Values for Option parameter:

  1. - Nothing ...
  2. - Get avatar
4 - Process user's online location 8 - Join the customprofilpic table to get the userid just to check if we have a picture 16 - Join the administrator table to get various admin options 32 - Join the sigpic table to get the userid just to check if we have a picture 64 - Get user's custom CSS 128 - Is the logged in User a friend of this person? Therefore: Option = 6 means 'Get avatar' and 'Process online location' See fetch_userinfo() in the do=getinfo section of member.php if you are still confused

  • return: The information for the requested user
array fetch_userinfo (integer &$userid, [integer $option = 0], [ $languageid = 0])
  • integer &$userid: (ref) User ID
  • integer $option: Bitfield Option (see description)
  • $languageid
fetch_word_wrapped_string (line 606)

Attempts to intelligently wrap excessively long strings onto multiple lines

string fetch_word_wrapped_string (string $text, [integer $limit = false], [string $wraptext = ' '])
  • string $text: Text to be wrapped
  • integer $limit: If specified, max word wrap length
  • string $wraptext: Text to insert at the wrap point
file_extension (line 746)

Fetches the remaining characters in a filename after the final dot

  • return: The extension of the provided file
string file_extension (string $filename)
  • string $filename: The filename to test
iif (line 51)

Essentially a wrapper for the ternary operator.

  • return: Either the second or third parameter of this function
  • deprecated: Deprecated as of 3.5. Use the ternary operator.
mixed iif (string $expression, mixed $returntrue, [mixed $returnfalse = ''])
  • string $expression: Expression to be evaluated
  • mixed $returntrue: Return this if the expression evaluates to true
  • mixed $returnfalse: Return this if the expression evaluates to false
init_language (line 5049)

Returns the initial $vbphrase array

array init_language ()
in_coventry (line 452)

Works out if the specified user is 'in Coventry'

boolean in_coventry (integer $userid, [boolean $includeself = false])
  • integer $userid: User ID
  • boolean $includeself: Whether or not to confirm that the visiting user is himself in Coventry or not
is_browser (line 4741)

Browser detection system - returns whether or not the visiting browser is the one specified

boolean is_browser (string $browser, [float $version = 0])
  • string $browser: Browser name (opera, ie, mozilla, firebord, firefox... etc. - see $is array)
  • float $version: Minimum acceptable version for true result (optional)
is_demo_mode (line 4727)

Returns whether or not vBulletin is running in demo mode

if DEMO_MODE is defined and set to true in config.php this function will return false, the main purpose of which is to disable parsing of stuff that is undesirable for a board running with a publicly accessible admin control panel

boolean is_demo_mode ()
is_member_of (line 384)

Works out if a user is a member of the specified usergroup(s)

This function can be overloaded to test multiple usergroups: is_member_of($user, 1, 3, 4, 6...)

boolean is_member_of (array $userinfo, integer $usergroupid, [boolean $cache = true])
  • array $userinfo: User info array - must contain userid, usergroupid and membergroupids fields
  • integer $usergroupid: Usergroup ID to test
  • boolean $cache: Pull result from cache
is_valid_email (line 759)

Tests a string to see if it's a valid email address

boolean is_valid_email (string $email)
  • string $email: Email address
print_no_permission (line 2593)

Halts execution and shows an error message stating that the visitor does not have permission to view the page

void print_no_permission ()
print_output (line 5385)

Finishes off the current page (using templates), prints it out to the browser and halts execution

void print_output (string $vartext, [boolean $sendheader = true])
  • string $vartext: The HTML of the page to be printed
  • boolean $sendheader: Send the content length header?
print_standard_error (line 2730)

Returns eval()-able code to initiate a standard error

  • deprecated: Deprecated since 3.5. Use standard_error(fetch_error(...)) instead.
string print_standard_error (string $err_phrase, [boolean $doquery = true], [boolean $savebadlocation = true])
  • string $err_phrase: Name of error phrase
  • boolean $doquery: If false, use the name of error phrase as the phrase text itself
  • boolean $savebadlocation: If true, set the visitor's status on WOL to error page
print_standard_redirect (line 2843)

Returns eval()-able code to initiate a standard redirect

The global variable $url should contain the URL target for the redirect

string print_standard_redirect (string $redir_phrase, [boolean $doquery = true], [boolean $forceredirect = false], [integer $languageid = -1])
  • string $redir_phrase: Name of redirect phrase
  • boolean $doquery: If false, use the name of redirect phrase as the phrase text itself
  • boolean $forceredirect: Whether or not to force a redirect message to be shown
  • integer $languageid: Language ID to fetch the phrase from (-1 uses the page-wide default)
process_replacement_vars (line 5340)

Returns the provided string with occurences of replacement variables replaced with their appropriate replacement values

string process_replacement_vars (string $newtext, [array $paramstyle = false])
  • string $newtext: Text containing replacement variables
  • array $paramstyle: Override global $style if specified
sanitize_maxposts (line 2201)

Ensures that the variables for a multi-page display are sane

  • return: Maximum posts perpage that a user can see
integer sanitize_maxposts ([ $perpage = 0])
  • $perpage
sanitize_pageresults (line 2241)

Ensures that the variables for a multi-page display are sane

void sanitize_pageresults (integer $numresults, integer &$page, integer &$perpage, [integer $maxperpage = 20], [integer $defaultperpage = 20])
  • integer $numresults: Total number of items to be displayed
  • integer &$page: (ref) Current page number
  • integer &$perpage: (ref) Desired number of results to show per-page
  • integer $maxperpage: Maximum allowable results to show per-page
  • integer $defaultperpage: Default number of results to show per-page
set_bbarray_cookie (line 2001)

Sets the value for data stored in an array-cookie

void set_bbarray_cookie (string $cookiename, mixed $id, mixed $value, [boolean $permanent = false])
  • string $cookiename: Name of the cookie
  • mixed $id: ID of the data within the cookie
  • mixed $value: Value for the data
  • boolean $permanent: If true, make this a permanent cookie
sign_client_string (line 2062)

Signs a string we intend to pass to the client but don't want them to alter

  • return: MD5 hash followed immediately by the string
string sign_client_string (string $string, [ $extra_entropy = ''])
  • string $string: String to be signed
  • $extra_entropy
split_string (line 142)

Splits a string into individual words for use in the search index

  • return: Array of words based on the input string
array split_string (string $string)
  • string $string: String to be seperated into individual words
standard_error (line 2758)

Halts execution and shows the specified error message

void standard_error ([string $error = ''], [string $headinsert = ''], [boolean $savebadlocation = true], [string $override_template = ''])
  • string $error: Error message
  • string $headinsert: Optional HTML code to insert in the <head> of the error page
  • boolean $savebadlocation: If true, set the visitor's status on WOL to error page
  • string $override_template: Optional template to force the display to use. Ignored if showing a lite error
standard_redirect (line 2873)

Halts execution and redirects to the address specified

If the 'useheaderredirect' option is on, the system will attempt to redirect invisibly using header('Location... However, 'useheaderredirect' is overridden by setting $forceredirect to a true value.

void standard_redirect ([string $message = ''], [string $forceredirect = false])
  • string $message: Redirect message
  • string $forceredirect: URL to which to redirect the browser
strip_bbcode (line 1661)

Strips away bbcode from a given string, leaving plain text

string strip_bbcode (string $message, [boolean $stripquotes = false], [boolean $fast_and_dirty = false], [ $showlinks = true])
  • string $message: Text to be stripped of bbcode tags
  • boolean $stripquotes: If true, strip away quote tags AND their contents
  • boolean $fast_and_dirty: If true, use the fast-and-dirty method rather than the shiny and nice method
  • $showlinks
strip_blank_ascii (line 497)

Replaces any non-printing ASCII characters with the specified string.

This also supports removing Unicode characters automatically when the entered value is >255 or starts with a 'u'.

string strip_blank_ascii (string $text, string $replace)
  • string $text: Text to be processed
  • string $replace: String with which to replace non-printing characters
strip_quotes (line 1555)

Strips away [quote] tags and their contents from the specified string

string strip_quotes (string $text)
  • string $text: Text to be stripped of quote tags
unhtmlspecialchars (line 3628)

Returns a string where HTML entities have been converted back to their original characters

string unhtmlspecialchars (string $text, [boolean $doUniCode = false])
  • string $text: String to be parsed
  • boolean $doUniCode: Convert unicode characters back from HTML entities?
update_loadavg (line 5280)

Updates the LoadAverage DataStore

void update_loadavg ()
vbchop (line 201)

Chops off a string at a specific length, counting entities as once character and using multibyte-safe functions if available.

  • return: Chopped string
string vbchop (string $string, integer $length)
  • string $string: String to chop
  • integer $length: Number of characters to chop at
vbdate (line 3462)

Formats a UNIX timestamp into a human-readable string according to vBulletin prefs

Note: Ifvbdate() is called with a date format other than than one in $vbulletin->options[], set $locale to false unless you dynamically set the date() and strftime() formats in the vbdate() call.

  • return: Formatted date string
string vbdate (string $format, [integer $timestamp = TIMENOW], [boolean $doyestoday = false], [boolean $locale = true], [boolean $adjust = true], [boolean $gmdate = false], [array $userinfo = ''])
  • string $format: Date format string (same syntax as PHP's date() function)
  • integer $timestamp: Unix time stamp
  • boolean $doyestoday: If true, attempt to show strings like "Yesterday, 12pm" instead of full date string
  • boolean $locale: If true, and user has a language locale, use strftime() to generate language specific dates
  • boolean $adjust: If true, don't adjust time to user's adjusted time .. (think gmdate instead of date!)
  • boolean $gmdate: If true, uses gmstrftime() and gmdate() instead of strftime() and date()
  • array $userinfo: If set, use specified info instead of $vbulletin->userinfo
vbheaders_sent (line 1768)

Checks whether or not any headers have been sent to the browser yet

  • return: True if headers have been sent
boolean vbheaders_sent (string &$filename, integer &$linenum)
  • string &$filename: (ref) File name (> PHP 4.3.x)
  • integer &$linenum: (ref) Line number (> PHP 4.3.x)
vbmail (line 812)

Starts the process of sending an email - either immediately or by adding it to the mail queue.

void vbmail (string $toemail, string $subject, string $message, [boolean $notsubscription = false], [string $from = ''], [string $uheaders = ''], [string $username = ''])
  • string $toemail: Destination email address
  • string $subject: Email message subject
  • string $message: Email message body
  • boolean $notsubscription: If true, do not use the mail queue and send immediately
  • string $from: Optional name/email to use in 'From' header
  • string $uheaders: Additional headers
  • string $username: Username of person sending the email
vbmail_end (line 861)

Stop adding mail to the mail queue and insert the mailqueue data for sending later

void vbmail_end ()
vbmail_start (line 790)

Begin adding email to the mail queue

void vbmail_start ()
vbrand (line 328)

vBulletin's own random number generator

void vbrand (integer $min, integer $max, [mixed $seed = -1])
  • integer $min: Minimum desired value
  • integer $max: Maximum desired value
  • mixed $seed: Seed for the number generator (if not specified, a new seed will be generated)
vbsetcookie (line 1790)

Sets a cookie based on vBulletin environmental settings

void vbsetcookie (string $name, [mixed $value = ''], [boolean $permanent = true], [boolean $allowsecure = true], [boolean $httponly = false])
  • string $name: Cookie name
  • mixed $value: Value to store in the cookie
  • boolean $permanent: If true, do not set an expiry date for the cookie
  • boolean $allowsecure: Allow secure cookies (SSL)
  • boolean $httponly: Set 'httponly' for cookies in supported browsers
vbstrlen (line 172)

Attempts to do a character-based strlen on data that might contain HTML entities.

By default, it only converts numeric entities but can optional convert &quot;, &lt;, etc. Uses a multi-byte aware function to do the counting if available.

  • return: Length of string
integer vbstrlen (string $string, [boolean $unhtmlspecialchars = false])
  • string $string: String to be measured
  • boolean $unhtmlspecialchars: If true, run unhtmlspecialchars on string to count &quot; as one, etc.
vbstrtolower (line 118)

Converts A-Z to a-z, doesn't change any other characters

  • return: Lowercase string
string vbstrtolower (string $string)
  • string $string: String to convert to lowercase
vb_number_format (line 253)

Formats a number with user's own decimal and thousands chars

  • return: The formatted number
mixed vb_number_format (mixed $number, [integer $decimals = 0], [boolean $bytesize = false], [ $decimalsep = null], [ $thousandsep = null])
  • mixed <