class vB_Api_Options extends vB_Api

vB_Api_Options

Traits

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected $disableWhiteList
protected array $disableFalseReturnOnly Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected string $controller API Controller from vB_Api
protected vB_Database $db Database object. from vB_Api
protected $library

Methods

__sleep()

No description

__wakeup()

No description

static 
getApiClassName($controller)

No description

from vB_Api
static 
getApiClassNameInternal($controller)

No description

from vB_Api
static 
getApiClass($controller, $errorCheck = true)

No description

from vB_Api
static vB_Api
instanceInternal(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API

from vB_Api
static vB_Api
instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

from vB_Api
static 
clearCache()

Clears all previously loaded API objects.

from vB_Api
The
callNamed()

Call the given api function by name with a named arguments list.

from vB_Api
static string
map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

from vB_Api
static 
map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

from vB_Api
static 
map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

from vB_Api
__construct()

No description

checkApiState($method)

This method checks whether the API method is enabled.

bool
isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

from vB_Api
bool
isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

from vB_Api
toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

from vB_Api
none
checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
boolean
hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

from vB_Api
checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
setController(string $controller)

Set controller

from vB_Api
inDebugMode()

No description

from vB_Api
array
fetch(array $options = null)

This function returns the options data from the specified option groups, in a multi dimensional array having the group name as key and the options as values.

static array
fetchStatic(string|array $options = null)

Returns the requested vBulletin options as specified by the $options parameter.

array
getSettingsXML(string $product = 'vbulletin')

This function gets the settings for given product or vbulletin if not specified

array
getGroupSettingsXML(boolean $ignore_blacklist, string $product = 'vbulletin')

This function gets a product or set vbulletin as default and prints the XML file for it's options.

array
importSettingsXML(string $settingsFile, string $serverFile, string $restore, boolean $blacklist)

This function gets the settings for given product or vbulletin if not specified

array
fetchValues(array $options)

Fetch option values

array
insertSetting(array $setting)

This function inserts a Settings value

array,
updateSetting(array $values)

This function updates specified settings

updateValue($varname, $value, $rebuild = true)

This updates a value in datastore settings

updateAttachPath(bool $value)

This updates the attachpath value in datastore settings

updateAttachSetting(bool $value)

This updates the attachpath value in datastore settings

array
killSetting($varname)

This function deletes specified settings

mixed
deleteGroupSettings(string $groupTitle)

Delete group of settings

array
addGroupSettings(array $group)

Insert group settings

array,
updateGroupSettings($group, $username, $oldproduct = '', $adminperm = false)

This function updates group settings.

array,
changeSearchType(string $implementation, string $options)

This function changes the search type for settings

array,
validateSettings(string $varname, array $setting)

This function changes the search type for settings

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Api at line 63
static getApiClassName($controller)

Parameters

$controller

in vB_Api at line 69
static protected getApiClassNameInternal($controller)

Parameters

$controller

in vB_Api at line 97
static protected getApiClass($controller, $errorCheck = true)

Parameters

$controller
$errorCheck

in vB_Api at line 177
static vB_Api instanceInternal(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 203
static vB_Api instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 237
static clearCache()

Clears all previously loaded API objects.

Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.

in vB_Api at line 259
The callNamed()

Call the given api function by name with a named arguments list.

Used primarily to translate REST requests into API calls.

Return Value

The return of the method or an error if the method doesn't exist, or is static, a constructor or destructor, or otherwise shouldn't be callable as and API method. It is also an error if the value of a paramater is not provided and that parameter doesn't have a default value.

in vB_Api at line 313
static string map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

May alter request array.

Parameters

string $method -- vb4 method name
array $request -- $_REQUEST array for this api request

Return Value

string

in vB_Api at line 497
static map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- output array from vb5

in vB_Api at line 545
static map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- error array from vb5

at line 25
protected __construct()

at line 31
checkApiState($method)

This method checks whether the API method is enabled.

For extensions check make sure $controller property is already set.

Parameters

$method

in vB_Api at line 657
protected bool isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method is or is not a white list.

in vB_Api at line 685
protected bool isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method returns false response only.

in vB_Api at line 712
protected toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

Parameters

string $str The string to be converted

in vB_Api at line 734
protected none checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

Checks for: * A valid CP Session * The passed adminpermission.

Parameters

string $adminPermission The admin permission to check

Return Value

none

Exceptions

inlinemodauth_required -- The current session is not a mod/admin session
nopermission_loggedin -- The user does not have the given permission
no_permission -- The user is not logged in at all.

in vB_Api at line 753
protected boolean hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

Useful if you need to know if the calling user but do not care why they do not have that permission. Generally useful if there is a behavior difference between admins and non admins, but the call can be processed for either.

Parameters

string $adminPermission The admin permission to check

Return Value

boolean true if checks pass, false otherwise

in vB_Api at line 807
protected checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

in vB_Api at line 821
protected setController(string $controller)

Set controller

Parameters

string $controller Controller name

in vB_Api at line 831
protected inDebugMode()

at line 62
array fetch(array $options = null)

This function returns the options data from the specified option groups, in a multi dimensional array having the group name as key and the options as values.

This function is misnamed and/or placed in the wrong API class. It acually returns any of the DATASTORE items, ONE of which is the vBulletin Options array.

Parameters

array $options The array of the DATASTORE items that you want to return. If empty, it will return all allowed items. Currently allowed entries are -- options (or publicoptions either will return the publicoptions values with the key 'options' -- miscoptions all other values will be ignored.

Return Value

array

at line 123
static array fetchStatic(string|array $options = null)

Returns the requested vBulletin options as specified by the $options parameter.

Only returns public options. If a private option is requested, the returned value for it will be null.

Parameters

string|array $options Specify one option (as a string), or multiple options (as an array)

Return Value

array Array of $option name => $value

at line 156
array getSettingsXML(string $product = 'vbulletin')

This function gets the settings for given product or vbulletin if not specified

Parameters

string $product

Return Value

array

at line 188
array getGroupSettingsXML(boolean $ignore_blacklist, string $product = 'vbulletin')

This function gets a product or set vbulletin as default and prints the XML file for it's options.

.

Parameters

boolean $ignore_blacklist -- ignore the settings with blacklist =1
string $product

Return Value

array response

at line 248
array importSettingsXML(string $settingsFile, string $serverFile, string $restore, boolean $blacklist)

This function gets the settings for given product or vbulletin if not specified

Parameters

string $settingsFile url
string $serverFile url
string $restore
boolean $blacklist

Return Value

array

at line 303
array fetchValues(array $options)

Fetch option values

Parameters

array $options An array of option names to be fetched

Return Value

array Options' values

at line 315
array insertSetting(array $setting)

This function inserts a Settings value

Parameters

array $setting ( varname, defaultvalue, product, volatile, title, description, username )

Return Value

array $response

at line 426
array, updateSetting(array $values)

This function updates specified settings

Parameters

array $values 'varname' => $vbulletin->GPC['varname'], 'grouptitle' => $vbulletin->GPC['grouptitle'], 'optioncode' => $vbulletin->GPC['optioncode'], 'defaultvalue' => $vbulletin->GPC['defaultvalue'], 'displayorder' => $vbulletin->GPC['displayorder'], 'volatile' => $vbulletin->GPC['volatile'], 'datatype' => $vbulletin->GPC['datatype'], 'validationcode' => $vbulletin->GPC['validationcode'], 'product' => $vbulletin->GPC['product'], 'blacklist' => $vbulletin->GPC['blacklist'], 'title' => $vbulletin->GPC['title'], 'username' => $vbulletin->userinfo['username'], 'description' => $vbulletin->GPC['description']

Return Value

array, $response

at line 440
updateValue($varname, $value, $rebuild = true)

This updates a value in datastore settings

Parameters

$varname
$value
$rebuild

at line 453
updateAttachPath(bool $value)

This updates the attachpath value in datastore settings

@param mixed the settings value

Parameters

bool $value whether to rebuild the datastore. Normally true

@return mixed   normally array ('update' => 'true')

at line 470
updateAttachSetting(bool $value)

This updates the attachpath value in datastore settings

@param mixed the settings value

Parameters

bool $value whether to rebuild the datastore. Normally true

@return mixed   normally array ('update' => 'true')

at line 484
array killSetting($varname)

This function deletes specified settings

Parameters

$varname

Return Value

array

at line 534
mixed deleteGroupSettings(string $groupTitle)

Delete group of settings

Parameters

string $groupTitle

Return Value

mixed response

at line 646
array addGroupSettings(array $group)

Insert group settings

Parameters

array $group ( [grouptitle] , [title] , [product] , [displayorder] , [volatile] )

Return Value

array response

at line 714
array, updateGroupSettings($group, $username, $oldproduct = '', $adminperm = false)

This function updates group settings.

Parameters

$group
$username
$oldproduct
$adminperm

Return Value

array, $response

at line 839
array, changeSearchType(string $implementation, string $options)

This function changes the search type for settings

Parameters

string $implementation
string $options

Return Value

array, response

at line 870
array, validateSettings(string $varname, array $setting)

This function changes the search type for settings

Parameters

string $varname
array $setting

Return Value

array, response