\web\lib\adminOptionParser

This class parses HTML field input from POST and FILES and extracts valid and authorized options to be set.

Summary

Methods
Properties
Constants
__construct()
processSubmittedFields()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
checkUploadSanity()
postProcessValidAttributes()
postProcessCoordinates()
displaySummaryInUI()
collateOptionArrays()
sendOptionsToDatabase()
sanitiseInputs()
$validator
$uiElements
$optioninfoObject
N/A

Properties

$validator

$validator : \web\lib\common\InputValidation

an instance of the InputValidation class which we use heavily for syntax checks.

Type

\web\lib\common\InputValidation —

$uiElements

$uiElements : \web\lib\admin\UIElements

an instance of the UIElements() class to draw some UI widgets from.

Type

\web\lib\admin\UIElements —

$optioninfoObject

$optioninfoObject : \core\Options

a handle for the Options singleton

Type

\core\Options —

Methods

__construct()

__construct() 

initialises the various handles.

processSubmittedFields()

processSubmittedFields(  object, mixed|string|int  postArray, mixed|string|int  filesArray,   eaptype = NULL,   device = NULL) : 

The main function: takes all HTML field inputs, makes sense of them and stores valid data in the database

Parameters

object

The object for which attributes were submitted

mixed|string|int postArray

incoming attribute names and values as submitted with $_POST

mixed|string|int filesArray

incoming attribute names and values as submitted with $_FILES

eaptype

for eap-specific attributes (only used where $object is a ProfileRADIUS instance)

device

for device-specific attributes (only used where $object is a ProfileRADIUS instance)

Throws

\Exception

Returns

text to be displayed in UI with the summary of attributes added

checkUploadSanity()

checkUploadSanity(  optiontype,   incomingBinary) : 

Verifies whether an incoming upload was actually valid data

Parameters

optiontype

for which option was the data uploaded

incomingBinary

the uploaded data

Returns

whether the data was valid

postProcessValidAttributes()

postProcessValidAttributes(mixed|string|int  options, mixed|string|int  good, mixed|string|int  bad) : mixed|string|int

Known-good options are sometimes converted, this function takes care of that.

Cases in point:

  • CA import by URL reference: fetch cert from URL and store it as CA file instead
  • Logo import by URL reference: fetch logo from URL and store it as logo file instead
  • CA file: mangle the content so that only the valid content remains (raw input may contain line breaks or spaces which are valid, but some supplicants choke upon)

Parameters

mixed|string|int options

the list of options we got

mixed|string|int good

by-reference: the future list of actually imported options

mixed|string|int bad

by-reference: the future list of submitted but rejected options

Returns

mixed|string|int —

the options, post-processed

postProcessCoordinates()

postProcessCoordinates(mixed|string|int  postArray, mixed|string|int  good) : mixed|string|int

extracts a coordinate pair from _POST (if any) and returns it in our standard attribute notation

Parameters

mixed|string|int postArray
mixed|string|int good

Returns

mixed|string|int —

displaySummaryInUI()

displaySummaryInUI(mixed|string|int  good, mixed|string|int  bad, mixed|string|int  mlAttribsWithC) : 

creates HTML code for a user-readable summary of the imports

Parameters

mixed|string|int good

list of actually imported options

mixed|string|int bad

list of submitted but rejected options

mixed|string|int mlAttribsWithC

list of language-variant options

Returns

HTML code

collateOptionArrays()

collateOptionArrays(mixed|string|int  postArray, mixed|string|int  filesArray) : mixed|string|int

Incoming data is in $_POST and possibly in $_FILES. Collate values into one array according to our name and numbering scheme.

Parameters

mixed|string|int postArray

_POST

mixed|string|int filesArray

_FILES

Returns

mixed|string|int —

sendOptionsToDatabase()

sendOptionsToDatabase(  object, mixed|string|int  options, mixed|string|int  pendingattributes,   device = NULL,   eaptype = NULL) : mixed|string|int

The very end of the processing: clean input data gets sent to the database for storage

Parameters

object

for which object are the options

mixed|string|int options

the options to store

mixed|string|int pendingattributes

list of attributes which are already stored but may need to be deleted

device

when the $object is Profile, this indicates device-specific attributes

eaptype

when the $object is Profile, this indicates eap-specific attributes

Throws

\Exception

Returns

mixed|string|int —

list of attributes which were previously stored but are to be deleted now

sanitiseInputs()

sanitiseInputs(mixed|string|int  listOfEntries, mixed|string|int  multilangAttrsWithC, mixed|string|int  bad) : mixed|string|int

filters the input to find syntactically correctly submitted attributes

Parameters

mixed|string|int listOfEntries

list of POST and FILES entries

mixed|string|int multilangAttrsWithC

by-reference: future list of language-variant options and their "default lang" state

mixed|string|int bad

by-reference: future list of submitted but rejected options

Throws

\Exception

Returns

mixed|string|int —

sanitised list of options