LimeSurvey API - Master branch

sanitize_helper.php

Table of Contents

Constants

FLOAT  = 32
HTML  = 8
INT  = 16
LDAP  = 64
MAGIC_QUOTES  = 0
PARANOID  = 1
SYSTEM  = 4
UTF8  = 128

Functions

nice_addslashes()  : mixed
sanitize_filename()  : mixed
Function: sanitize_filename Returns a sanitized string, typically for URLs.
beautify_filename()  : mixed
sanitize_dirname()  : mixed
Function: sanitize_dirname sanitizes a string that will be used as a directory name
sanitize_paranoid_string()  : mixed
sanitize_cquestions()  : mixed
sanitize_system_string()  : mixed
sanitize_xss_string()  : mixed
sanitize_sql_db_tablename()  : mixed
sanitize_ldap_string()  : mixed
sanitize_html_string()  : mixed
sanitize_int()  : mixed
sanitize_user()  : mixed
sanitize_userfullname()  : mixed
sanitize_labelname()  : mixed
sanitize_float()  : mixed
sanitize()  : mixed
check_paranoid_string()  : mixed
check_int()  : mixed
check_float()  : mixed
check_html_string()  : mixed
check_system_string()  : mixed
check()  : bool
sanitize_languagecode()  : string
Sanitizes a language code by removing all non-alphanumeric and non-dash characters.
sanitize_languagecodeS()  : string
Sanitizes a space-separated string of language codes.
sanitize_googleapikey()  : string
/* Sanitize a google api key
sanitize_signedint()  : mixed
check_ip_address()  : bool
Checks the validity of IP address $ip
check_absolute_url()  : bool
Returns true if the argument is an absolute URL (either starting with schema+domain or just "/").
sanitize_alphanumeric()  : string
Remove all chars from $value that are not alphanumeric or dash or underscore
validate_path_component()  : bool
Validate that a value is safe to use as a single filesystem path component.

Constants

Functions

nice_addslashes()

nice_addslashes(mixed $string) : mixed
Parameters
$string : mixed

sanitize_filename()

Function: sanitize_filename Returns a sanitized string, typically for URLs.

sanitize_filename(mixed $filename[, mixed $force_lowercase = true ][, mixed $alphanumeric = false ][, mixed $beautify = true ][, mixed $directory = false ]) : mixed

Parameters: $string - The string to sanitize. $force_lowercase - Force the string to lowercase? $alphanumeric - If set to true, will remove all non-alphanumeric characters.

Parameters
$filename : mixed
$force_lowercase : mixed = true
$alphanumeric : mixed = false
$beautify : mixed = true
$directory : mixed = false

beautify_filename()

beautify_filename(string $filename) : mixed
Parameters
$filename : string

sanitize_dirname()

Function: sanitize_dirname sanitizes a string that will be used as a directory name

sanitize_dirname(mixed $string[, mixed $force_lowercase = false ][, mixed $alphanumeric = false ]) : mixed

Parameters: $string - The string to sanitize. $force_lowercase - Force the string to lowercase? $alphanumeric - If set to true, will remove all non-alphanumeric characters.

Parameters
$string : mixed
$force_lowercase : mixed = false
$alphanumeric : mixed = false

sanitize_paranoid_string()

sanitize_paranoid_string(mixed $string[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$string : mixed
$min : mixed = ''
$max : mixed = ''

sanitize_cquestions()

sanitize_cquestions(mixed $string[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$string : mixed
$min : mixed = ''
$max : mixed = ''

sanitize_system_string()

sanitize_system_string(mixed $string[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$string : mixed
$min : mixed = ''
$max : mixed = ''

sanitize_xss_string()

sanitize_xss_string(mixed $string) : mixed
Parameters
$string : mixed

sanitize_sql_db_tablename()

sanitize_sql_db_tablename(mixed $string) : mixed
Parameters
$string : mixed

sanitize_ldap_string()

sanitize_ldap_string(mixed $string[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$string : mixed
$min : mixed = ''
$max : mixed = ''

sanitize_html_string()

sanitize_html_string(mixed $string) : mixed
Parameters
$string : mixed

sanitize_int()

sanitize_int(mixed $integer[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$integer : mixed
$min : mixed = ''
$max : mixed = ''

sanitize_user()

sanitize_user(string $string) : mixed
Parameters
$string : string

sanitize_userfullname()

sanitize_userfullname(mixed $string) : mixed
Parameters
$string : mixed

sanitize_labelname()

sanitize_labelname(mixed $string) : mixed
Parameters
$string : mixed

sanitize_float()

sanitize_float(mixed $float[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$float : mixed
$min : mixed = ''
$max : mixed = ''

sanitize()

sanitize(mixed $input, mixed $flags[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$input : mixed
$flags : mixed
$min : mixed = ''
$max : mixed = ''

check_paranoid_string()

check_paranoid_string(mixed $input[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$input : mixed
$min : mixed = ''
$max : mixed = ''

check_int()

check_int(mixed $input[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$input : mixed
$min : mixed = ''
$max : mixed = ''

check_float()

check_float(mixed $input[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$input : mixed
$min : mixed = ''
$max : mixed = ''

check_html_string()

check_html_string(mixed $input[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$input : mixed
$min : mixed = ''
$max : mixed = ''

check_system_string()

check_system_string(mixed $input[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$input : mixed
$min : mixed = ''
$max : mixed = ''

check()

check( $input,  $flags[, string $min = '' ][, string $max = '' ]) : bool
Parameters
$input :
$flags :
$min : string = ''
$max : string = ''
Tags
throws
Exception
Return values
bool

sanitize_languagecode()

Sanitizes a language code by removing all non-alphanumeric and non-dash characters.

sanitize_languagecode(string $codetosanitize) : string

This function removes any characters that are not letters (a-z), numbers (0-9), or hyphens (-) from the input string. It is case-insensitive in its matching.

Parameters
$codetosanitize : string

The language code string to sanitize.

Tags
deprecated
7.0.0

Use LSYii_Validators::languageCodeFilter

Return values
string

The sanitized language code containing only letters and hyphens.

sanitize_languagecodeS()

Sanitizes a space-separated string of language codes.

sanitize_languagecodeS(string $codestringtosanitize) : string

This function takes a space-separated string of language codes, splits them into an array, sanitizes each individual language code by removing all non-alphanumeric and non-dash characters, and then rejoins them back into a space-separated string.

Parameters
$codestringtosanitize : string

A space-separated string of language codes to sanitize.

Tags
deprecated
7.0.0

Use LSYii_Validators::multiLanguageCodeFilter

Return values
string

A space-separated string of sanitized language codes containing only alphanumeric characters and hyphens.

sanitize_signedint()

sanitize_signedint(mixed $integer[, mixed $min = '' ][, mixed $max = '' ]) : mixed
Parameters
$integer : mixed
$min : mixed = ''
$max : mixed = ''

check_ip_address()

Checks the validity of IP address $ip

check_ip_address(string $ip) : bool
Parameters
$ip : string

to check

Return values
bool

true if the $ip is a valid IP address

check_absolute_url()

Returns true if the argument is an absolute URL (either starting with schema+domain or just "/").

check_absolute_url(string $string) : bool
Parameters
$string : string
Return values
bool

sanitize_alphanumeric()

Remove all chars from $value that are not alphanumeric or dash or underscore

sanitize_alphanumeric(string $value) : string
Parameters
$value : string
Return values
string

validate_path_component()

Validate that a value is safe to use as a single filesystem path component.

validate_path_component(string $string) : bool

This rejects empty values, leading-dot names, path separators and ASCII control characters so callers can safely append the value to a trusted base path without worrying about directory traversal or hidden directories.

Parameters
$string : string
Return values
bool

        
On this page

Search results