class vB5_Frontend_ApplicationLight extends vB5_ApplicationAbstract

Light version of the application, for fixed routes like getting phrases, options, etc. At the time of writing this, the biggest improvement is skipping the route parsing. There's a lot of processing needed for handling forum-type, channel-type urls that isn't needed for the static routes.

Constants

ON_FIRE_MESSAGE

Properties

static protected $instance from vB5_ApplicationAbstract
protected $router from vB5_ApplicationAbstract
static protected $needCharset from vB5_ApplicationAbstract
protected $application
static protected $quickRoutes
static protected array $quickRoutePrefixMatch
protected $userid
protected $languageid

Methods

static 
instance()

No description

static 
init($configFile)

This is the standard way to initialize an application

static 
setHeaders()

Replacing meta tag from the header.xml with header in the requests. See VBV-6361

getRouter()

No description

string
getRequestCharset()

Attempt to determine what charset the browser is posting

static 
isAjax()

Is this an AJAX request.

convertInputArrayCharset()

Convert the PHP input superglobals to the vBulletin charset if it is different from what the request charset is. This is most likely on an AJAX request.

static 
handleException(mixed $exception, bool $simple = false)

Displays a vB page for exceptions

static 
handleNoPermission()

Displays a vB page for no_permission exception

static 
handleBannedUsers(mixed $bannedInfo)

Displays a vB page for banned users

static 
handlePermanentRedirect($url)

No description

static 
minErrorPage($error, $exception = null, $trace = null)

No description

static 
setCharset()

No description

static 
showErrorPage($error, $simple = false)

No description

static 
handleFormError($error, $url)

No description

static 
showErrorForm($error, $url)

No description

static 
checkState($route = array())

No description

static 
showMsgPage(string $title = '', string $msg = '', string $state = '')

Show a simple and clear message page which contains no widget

static 
showMsgPageBare(string $title = '', string $msg = '', string $state = '')

Same as showMsgPage(), but uses the message_page_bare template which uses the minimalistic bare_header & bare_footer templates.

static 
showNoPermissionPage($message = '')

No description

static 
showBannedPage($bannedInfo)

No description

static 
getPreheader()

No description

static 
getRouteInfo()

No description

static 
getIgnoreNPNotices()

No description

static 
checkCSRF()

No description

sendAsJson(mixed $data)

Sends the response as a JSON encoded string

outputToBrowserAndCloseConnection(String $output)

Attempts to close the connection to the browser without terminating the PHP script. This is heavily environment specific and somewhat fragile.

sendAsJsonAndCloseConnection(mixed $responseToSendAsJson = array())

Sends the response as a JSON encoded string Attempts to close the connection to the browser without terminating the PHP script. This is heavily environment specific and somewhat fragile.

allowRedirectToUrl($url)

No description

static bool
isQuickRoute()

Tells whether this class can process this request

__construct()

No description

bool
execute()

Executes the application. Normally this means to get some data. We usually return in json format.

fetchOptions(array $serverData)

This gets phrase data from an ajax request.

callRender(array $serverData)

Renders a template from an ajax call

handleAjaxApi(array $serverData)

This handles an ajax api call.

handleAjaxApiDetached(array $serverData)

This handles an ajax api call, detatched from the current request

fetchImage(array $serverData)

Outputs an attachment

handleImageError($errno)

If there is an error, there's little we can do. We have a 1px file. Let's return that with a header so the client won't request it again soon;

Details

static instance()

at line 135
static init($configFile)

This is the standard way to initialize an application

Parameters

$configFile

static protected setHeaders()

Replacing meta tag from the header.xml with header in the requests. See VBV-6361

getRouter()

protected string getRequestCharset()

Attempt to determine what charset the browser is posting

The HTTP/HTML standards make this difficult so we look at a number of different things to try to figure it out.

Return Value

string the charset string for the request or the empty string if it could not be determined.

static protected isAjax()

Is this an AJAX request.

Note that this can be easily spoofed. Do not rely on for anything with security implications.

protected convertInputArrayCharset()

Convert the PHP input superglobals to the vBulletin charset if it is different from what the request charset is. This is most likely on an AJAX request.

at line 645
static handleException(mixed $exception, bool $simple = false)

Displays a vB page for exceptions

Parameters

mixed $exception exception
bool $simple Bypass API and display simple error message

static handleNoPermission()

Displays a vB page for no_permission exception

static handleBannedUsers(mixed $bannedInfo)

Displays a vB page for banned users

Parameters

mixed $bannedInfo exception

static handlePermanentRedirect($url)

Parameters

$url

static protected minErrorPage($error, $exception = null, $trace = null)

Parameters

$error
$exception
$trace

static protected setCharset()

static protected showErrorPage($error, $simple = false)

Parameters

$error
$simple

static handleFormError($error, $url)

Parameters

$error
$url

static protected showErrorForm($error, $url)

Parameters

$error
$url

static checkState($route = array())

Parameters

$route

static showMsgPage(string $title = '', string $msg = '', string $state = '')

Show a simple and clear message page which contains no widget

Parameters

string $title Page title. HTML will be escaped.
string $msg Message to display. HTML is allowed and the caller must make sure it's valid.
string $state The state of the site

static showMsgPageBare(string $title = '', string $msg = '', string $state = '')

Same as showMsgPage(), but uses the message_page_bare template which uses the minimalistic bare_header & bare_footer templates.

Parameters

string $title Page title. HTML will be escaped.
string $msg Message to display. HTML is allowed and the caller must make sure it's valid.
string $state The state of the site

static protected showNoPermissionPage($message = '')

Parameters

$message

static protected showBannedPage($bannedInfo)

Parameters

$bannedInfo

static getPreheader()

static protected getRouteInfo()

static getIgnoreNPNotices()

final static checkCSRF()

sendAsJson(mixed $data)

Sends the response as a JSON encoded string

Parameters

mixed $data The data (usually an array) to send

outputToBrowserAndCloseConnection(String $output)

Attempts to close the connection to the browser without terminating the PHP script. This is heavily environment specific and somewhat fragile.

Currently only used by sendAsJsonAndCloseConnection().

Parameters

String $output Content to echo back to the browser along with the headers to signal connection termination.

sendAsJsonAndCloseConnection(mixed $responseToSendAsJson = array())

Sends the response as a JSON encoded string Attempts to close the connection to the browser without terminating the PHP script. This is heavily environment specific and somewhat fragile.

Parameters

mixed $responseToSendAsJson The data (usually an array) to send -- if data is an array function will add an "note" field indicating that the data was returned prior to processing (which can obscure errors) Parameter defaults to an empty array if there is no real data to send (which is common when terminating before substantial processing)

allowRedirectToUrl($url)

Parameters

$url

at line 79
static bool isQuickRoute()

Tells whether this class can process this request

Return Value

bool

at line 103
protected __construct()

at line 161
bool execute()

Executes the application. Normally this means to get some data. We usually return in json format.

Return Value

bool

Exceptions

vB_Exception_Api

at line 261
protected fetchOptions(array $serverData)

This gets phrase data from an ajax request.

Parameters

array $serverData Array of server data (from $_POST and/or $_GET, see execute())

at line 280
protected callRender(array $serverData)

Renders a template from an ajax call

Parameters

array $serverData Array of server data (from $_POST and/or $_GET, see execute())

at line 310
protected handleAjaxApi(array $serverData)

This handles an ajax api call.

Parameters

array $serverData Array of server data (from $_POST and/or $_GET, see execute())

at line 336
protected handleAjaxApiDetached(array $serverData)

This handles an ajax api call, detatched from the current request

Parameters

array $serverData Array of server data (from $_POST and/or $_GET, see execute())

at line 374
protected fetchImage(array $serverData)

Outputs an attachment

Parameters

array $serverData Array of server data (from $_POST and/or $_GET, see execute())

at line 612
handleImageError($errno)

If there is an error, there's little we can do. We have a 1px file. Let's return that with a header so the client won't request it again soon;

Parameters

$errno