PHP 클래스 PMA\libraries\config\Validator

Validation function takes two argument: id for which it is called and array of fields' values (usually values for entire formset, as defined in forms.inc.php). The function must always return an array with an error (or error array) assigned to a form element (formset name or field path). Even if there are no errors, key must be set with an empty value. Validation functions are assigned in $cfg_db['_validators'] (config.values.php).
파일 보기 프로젝트 열기: phpmyadmin/phpmyadmin 1 사용 예제들

공개 메소드들

메소드 설명
getValidators ( PMA\libraries\config\ConfigFile $cf ) : array Returns validator list
testDBConnection ( string $connect_type, string $host, string $port, string $socket, string $user, string $pass = null, string $error_key = 'Server' ) : boolean | array Test database connection
validate ( PMA\libraries\config\ConfigFile $cf, string | array $validator_id, &$values, boolean $isPostSource ) : boolean | array Runs validation $validator_id on values $values and returns error list.
validateByRegex ( string $path, array $values, string $regex ) : array Validates value according to given regular expression Pattern and modifiers must be a valid for PCRE and JavaScript RegExp
validateNonNegativeNumber ( string $path, array $values ) : array Validates non-negative number
validateNumber ( string $path, array $values, boolean $allow_neg, boolean $allow_zero, integer $max_value, string $error_string ) : string Tests integer value
validatePMAStorage ( string $path, array $values ) : array Validate pmadb config
validatePortNumber ( string $path, array $values ) : array Validates port number
validatePositiveNumber ( string $path, array $values ) : array Validates positive number
validateRegex ( string $path, array $values ) : array Validates regular expression
validateServer ( string $path, array $values ) : array Validate server config
validateTrustedProxies ( string $path, array $values ) : array Validates TrustedProxies field
validateUpperBound ( string $path, array $values, integer $max_value ) : array Validates upper bound for numeric inputs

메소드 상세

getValidators() 공개 정적인 메소드

Returns validator list
public static getValidators ( PMA\libraries\config\ConfigFile $cf ) : array
$cf PMA\libraries\config\ConfigFile Config file instance
리턴 array

testDBConnection() 공개 정적인 메소드

Test database connection
public static testDBConnection ( string $connect_type, string $host, string $port, string $socket, string $user, string $pass = null, string $error_key = 'Server' ) : boolean | array
$connect_type string 'tcp' or 'socket'
$host string host name
$port string tcp port to use
$socket string socket to use
$user string username to use
$pass string password to use
$error_key string key to use in return array
리턴 boolean | array

validate() 공개 정적인 메소드

Return values: o array, keys - field path or formset id, values - array of errors when $isPostSource is true values is an empty array to allow for error list cleanup in HTML document o false - when no validators match name(s) given by $validator_id
public static validate ( PMA\libraries\config\ConfigFile $cf, string | array $validator_id, &$values, boolean $isPostSource ) : boolean | array
$cf PMA\libraries\config\ConfigFile Config file instance
$validator_id string | array ID of validator(s) to run
$isPostSource boolean tells whether $values are directly from POST request
리턴 boolean | array

validateByRegex() 공개 정적인 메소드

Validates value according to given regular expression Pattern and modifiers must be a valid for PCRE and JavaScript RegExp
public static validateByRegex ( string $path, array $values, string $regex ) : array
$path string path to config
$values array config values
$regex string regular expression to match
리턴 array

validateNonNegativeNumber() 공개 정적인 메소드

Validates non-negative number
public static validateNonNegativeNumber ( string $path, array $values ) : array
$path string path to config
$values array config values
리턴 array

validateNumber() 공개 정적인 메소드

Tests integer value
public static validateNumber ( string $path, array $values, boolean $allow_neg, boolean $allow_zero, integer $max_value, string $error_string ) : string
$path string path to config
$values array config values
$allow_neg boolean allow negative values
$allow_zero boolean allow zero
$max_value integer max allowed value
$error_string string error message key: $GLOBALS["strConfig$error_lang_key"]
리턴 string empty string if test is successful

validatePMAStorage() 공개 정적인 메소드

Validate pmadb config
public static validatePMAStorage ( string $path, array $values ) : array
$path string path to config, not used keep this parameter since the method is invoked using reflection along with other similar methods
$values array config values
리턴 array

validatePortNumber() 공개 정적인 메소드

Validates port number
public static validatePortNumber ( string $path, array $values ) : array
$path string path to config
$values array config values
리턴 array

validatePositiveNumber() 공개 정적인 메소드

Validates positive number
public static validatePositiveNumber ( string $path, array $values ) : array
$path string path to config
$values array config values
리턴 array

validateRegex() 공개 정적인 메소드

Validates regular expression
public static validateRegex ( string $path, array $values ) : array
$path string path to config
$values array config values
리턴 array

validateServer() 공개 정적인 메소드

Validate server config
public static validateServer ( string $path, array $values ) : array
$path string path to config, not used keep this parameter since the method is invoked using reflection along with other similar methods
$values array config values
리턴 array

validateTrustedProxies() 공개 정적인 메소드

Validates TrustedProxies field
public static validateTrustedProxies ( string $path, array $values ) : array
$path string path to config
$values array config values
리턴 array

validateUpperBound() 공개 정적인 메소드

Validates upper bound for numeric inputs
public static validateUpperBound ( string $path, array $values, integer $max_value ) : array
$path string path to config
$values array config values
$max_value integer maximal allowed value
리턴 array