PHP 클래스 Toolbox, glpi

저자: Anis BEREJEB Toolbox class
파일 보기 프로젝트 열기: glpi-project/glpi 1 사용 예제들

공개 메소드들

메소드 설명
addslashes_deep ( $value ) : addslashes Add slash for variable & array
append_params ( $array, $separator = '&', $parent = '' ) : string Converts an array of parameters into a query string to be appended to a URL.
backtrace ( $log = 'php-errors', $hide = '', array $skip = [] ) : string Generate a Backtrace
canUseImapPop ( ) : boolean Determine if Imap/Pop is usable checking extension existence
canUseLdap ( ) : boolean Determine if Ldap is usable checking ldap extension existence
checkMemoryLimit ( ) Check is current memory_limit is enough for GLPI
checkNewVersionAvailable ( $auto = true, $messageafterredirect = false ) : string Check if new version is available
checkSELinux ( $fordebug = false ) : integer Check SELinux configuration
checkValidReferer ( ) : nothing Check valid referer accessing GLPI
cleanDecimal ( $decimal ) : clean Clean decimal value (strip all chars not - and spaces )
cleanInteger ( $integer ) : clean Clean integer value (strip all chars not - and spaces )
cleanNewLines ( $string ) : clean Clean new lines of a string
clean_cross_side_scripting_deep ( $value ) : clean Prevent from XSS Clean code
commonCheckForUseGLPI ( ) : 2 Common Checks needed to use GLPI
constructMailServerConfig ( $input )
createSchema ( $lang = 'en_GB' ) : nothing Create the GLPI default schema
decodeArrayFromInput ( $value ) : string Decode array passed on an input form
decodeFromUtf8 ( $string, $to_charset = "ISO-8859-1" ) : converted Decode string from UTF-8 to specified charset
decrypt ( $string, $key ) : decrypted Decrypt a string
deleteDir ( $dir ) Delete a directory and file contains in it
encodeInUtf8 ( $string, $from_charset = "ISO-8859-1" ) : utf8 Encode string to UTF-8
encrypt ( $string, $key ) : encrypted Encrypt a string
filesizeDirectory ( $path ) : size Get the filesize of a complete directory (from php.net)
getDaysOfWeekArray ( )
getItemTypeFormURL ( $itemtype, $full = true ) Get form URL for itemtype
getItemTypeSearchURL ( $itemtype, $full = true ) Get search URL for itemtype
getItemTypeTabsURL ( $itemtype, $full = true ) Get ajax tabs url for itemtype
getMemoryLimit ( $ininame = 'memory_limit' ) : memory Compute PHP memory_limit
getMime ( $file, $type = false ) : string Retrieve the mime type of a file
getMonthsOfYearArray ( )
getRandomString ( integer $length, boolean $high = false ) : random Get a random string
getSize ( $size ) : formatted Format a size passing a size in octet
getTimestampTimeUnits ( $time ) : string Split timestamp in time units
getURLContent ( $url, &$msgerr = NULL, $rec ) : content Get a web page. Use proxy if configured
get_magic_quotes_gpc ( ) : boolean Wrapper for get_magic_quotes_gpc - deprecated
get_magic_quotes_runtime ( ) : boolean Wrapper for get_magic_quotes_runtime - deprecated
get_max_input_vars ( ) : integer Wrapper for max_input_vars
inArrayCaseCompare ( $string, $datas = [] ) : boolean Do a in_array search comparing string using strcasecmp
in_array_recursive ( mixed $needle, array $haystack, $strict = false ) : boolean Summary of in_array_recursive
is_a ( $object, $class_name ) : true Check if the given object is of the type $class_name. Can be identical or a subclass.
key_exists_deep ( $need, $tab )
logDebug ( ) Log in 'php-errors' all args
logInFile ( $name, $text, $force = false ) Log a message in log file
manageBeginAndEndPlanDates ( &$data ) : processed Manage planning posted datas (must have begin + duration or end) Compute end if duration is set
manageRedirect ( $where ) Manage login redirection
parseMailServerConnectString ( $value, $forceport = false ) : array Parse imap open connect string
prepareArrayForInput ( array $value ) : string Prepare array passed on an input form
removeHtmlSpecialChars ( string $string ) : string Remove accentued characters and return lower case string
resizePicture ( $source_path, $dest_path, $new_width = 71, $new_height = 71, $img_y, $img_x, $img_width, $img_height, $max_size = 500 ) : boolean Resize a picture to the new size
return_bytes_from_ini_vars ( $val ) Convert a value in byte, kbyte, megabyte etc.
sanitize ( array $array ) : array Sanitize received values
seems_utf8 ( $str ) : boolean Is a string seems to be UTF-8 one ?
sendFile ( $file, $filename, $mime = null ) : nothing Send a file (not a document) to the navigator See Document->send();
setDebugMode ( $mode = NULL, $debug_sql = NULL, $debug_vars = NULL, $log_in_files = NULL ) Switch error mode for GLPI
shortcut ( $str, $shortcut ) : string to underline shortcut letter
showMailServerConfig ( $value ) : String Display a mail server configuration form
slugify ( string $string ) : string Slugify
str_pad ( $input, $pad_length, $pad_string = " ", $pad_type = STR_PAD_RIGHT ) : string Replace str_pad() who bug with utf8
stripslashes_deep ( $value ) : stripslashes Strip slash for variable & array
strlen ( $str ) : length strlen function for utf8 string
strpos ( $str, $tofound, $offset ) : substring substr function for utf8 string
strtolower ( $str ) : lower strtolower function for utf8 string
strtoupper ( $str ) : upper strtoupper function for utf8 string
substr ( $str, $start, $length ) : substring substr function for utf8 string
testWriteAccessToDirectory ( $dir ) : 2 Check Write Access to a directory
ucfirst ( $str ) : string Convert first caracter in upper
unclean_cross_side_scripting_deep ( $value ) : unclean Invert fonction from clean_cross_side_scripting_deep
unclean_html_cross_side_scripting_deep ( $value ) : unclean Invert fonction from clean_cross_side_scripting_deep to display HTML striping XSS code
userErrorHandlerDebug ( $errno, $errmsg, $filename, $linenum, $vars ) Specific error handler in Debug mode
userErrorHandlerNormal ( $errno, $errmsg, $filename, $linenum, $vars ) Specific error handler in Normal mode
writeConfig ( $name, $content ) : boolean Save a configuration file

메소드 상세

addslashes_deep() 정적인 공개 메소드

Add slash for variable & array
static public addslashes_deep ( $value ) : addslashes
$value array or string: value to add slashes (array or string)
리턴 addslashes value

append_params() 정적인 공개 메소드

Converts an array of parameters into a query string to be appended to a URL.
static public append_params ( $array, $separator = '&', $parent = '' ) : string
$array array parameters to append to the query string.
$separator separator may be defined as & to display purpose (default '&')
$parent This should be left blank (it is used internally by the function). (default '')
리턴 string : Query string to append to a URL.

backtrace() 정적인 공개 메소드

Generate a Backtrace
static public backtrace ( $log = 'php-errors', $hide = '', array $skip = [] ) : string
$log String log file name (default php-errors) if false, return the strung
$hide String call to hide (but display script/line) (default '')
$skip array Array of call to not display at all
리턴 string if $log is false

canUseImapPop() 정적인 공개 메소드

Determine if Imap/Pop is usable checking extension existence
static public canUseImapPop ( ) : boolean
리턴 boolean

canUseLdap() 정적인 공개 메소드

Determine if Ldap is usable checking ldap extension existence
static public canUseLdap ( ) : boolean
리턴 boolean

checkMemoryLimit() 정적인 공개 메소드

Check is current memory_limit is enough for GLPI
static public checkMemoryLimit ( )

checkNewVersionAvailable() 정적인 공개 메소드

Check if new version is available
static public checkNewVersionAvailable ( $auto = true, $messageafterredirect = false ) : string
$auto boolean: check done autically ? (if not display result) (true by default)
$messageafterredirect boolean: use message after redirect instead of display (false by default)
리턴 string explaining the result

checkSELinux() 정적인 공개 메소드

Check SELinux configuration
static public checkSELinux ( $fordebug = false ) : integer
$fordebug Boolean true is displayed in system information @return integer 0: OK, 1:Warning, 2:Error
리턴 integer

checkValidReferer() 정적인 공개 메소드

Check valid referer accessing GLPI
static public checkValidReferer ( ) : nothing
리턴 nothing : display error if not permit

cleanDecimal() 정적인 공개 메소드

Clean decimal value (strip all chars not - and spaces )
static public cleanDecimal ( $decimal ) : clean
$decimal string float string
리턴 clean integer

cleanInteger() 정적인 공개 메소드

Clean integer value (strip all chars not - and spaces )
static public cleanInteger ( $integer ) : clean
$integer string integer string
리턴 clean integer

cleanNewLines() 정적인 공개 메소드

Clean new lines of a string
static public cleanNewLines ( $string ) : clean
$string string string to clean
리턴 clean string

clean_cross_side_scripting_deep() 정적인 공개 메소드

Prevent from XSS Clean code
static public clean_cross_side_scripting_deep ( $value ) : clean
$value array or string: item to prevent (array or string)
리턴 clean item

commonCheckForUseGLPI() 정적인 공개 메소드

Common Checks needed to use GLPI
static public commonCheckForUseGLPI ( ) : 2
리턴 2

constructMailServerConfig() 정적인 공개 메소드

static public constructMailServerConfig ( $input )
$input

createSchema() 정적인 공개 메소드

Create the GLPI default schema
부터: 9.1
static public createSchema ( $lang = 'en_GB' ) : nothing
$lang
리턴 nothing

decodeArrayFromInput() 정적인 공개 메소드

Decode array passed on an input form
static public decodeArrayFromInput ( $value ) : string
$value string encoded value
리턴 string decoded array

decodeFromUtf8() 정적인 공개 메소드

Decode string from UTF-8 to specified charset
static public decodeFromUtf8 ( $string, $to_charset = "ISO-8859-1" ) : converted
$string string string to convert
$to_charset string destination charset (default "ISO-8859-1")
리턴 converted string

decrypt() 정적인 공개 메소드

Decrypt a string
static public decrypt ( $string, $key ) : decrypted
$string string to decrypt
$key string key used to decrypt
리턴 decrypted string

deleteDir() 정적인 공개 메소드

Delete a directory and file contains in it
static public deleteDir ( $dir )
$dir string: directory to delete

encodeInUtf8() 정적인 공개 메소드

Encode string to UTF-8
static public encodeInUtf8 ( $string, $from_charset = "ISO-8859-1" ) : utf8
$string string string to convert
$from_charset string original charset (if 'auto' try to autodetect) (default "ISO-8859-1")
리턴 utf8 string

encrypt() 정적인 공개 메소드

Encrypt a string
static public encrypt ( $string, $key ) : encrypted
$string string to encrypt
$key string key used to encrypt
리턴 encrypted string

filesizeDirectory() 정적인 공개 메소드

Get the filesize of a complete directory (from php.net)
static public filesizeDirectory ( $path ) : size
$path string: directory or file to get size
리턴 size of the $path

getDaysOfWeekArray() 정적인 공개 메소드

static public getDaysOfWeekArray ( )

getItemTypeFormURL() 정적인 공개 메소드

Get form URL for itemtype
static public getItemTypeFormURL ( $itemtype, $full = true )
$itemtype string item type
$full path or relative one (true by default) return string itemtype Form URL

getItemTypeSearchURL() 정적인 공개 메소드

Get search URL for itemtype
static public getItemTypeSearchURL ( $itemtype, $full = true )
$itemtype string item type
$full path or relative one (true by default) return string itemtype search URL

getItemTypeTabsURL() 정적인 공개 메소드

Get ajax tabs url for itemtype
static public getItemTypeTabsURL ( $itemtype, $full = true )
$itemtype string item type
$full path or relative one (true by default) return string itemtype tabs URL

getMemoryLimit() 정적인 공개 메소드

Compute PHP memory_limit
static public getMemoryLimit ( $ininame = 'memory_limit' ) : memory
$ininame String name of the ini ooption to retrieve (since 9.1)
리턴 memory limit

getMime() 정적인 공개 메소드

Retrieve the mime type of a file
static public getMime ( $file, $type = false ) : string
$file string path of the file
$type string check if $file is the correct type (false by default)
리턴 string (if $type not given) else boolean

getMonthsOfYearArray() 정적인 공개 메소드

static public getMonthsOfYearArray ( )

getRandomString() 정적인 공개 메소드

Get a random string
static public getRandomString ( integer $length, boolean $high = false ) : random
$length integer of the random string
$high boolean strength of the random source (since 9.2)
리턴 random string

getSize() 정적인 공개 메소드

Format a size passing a size in octet
static public getSize ( $size ) : formatted
$size integer: Size in octet
리턴 formatted size

getTimestampTimeUnits() 정적인 공개 메소드

Split timestamp in time units
static public getTimestampTimeUnits ( $time ) : string
$time integer: timestamp
리턴 string

getURLContent() 정적인 공개 메소드

Get a web page. Use proxy if configured
static public getURLContent ( $url, &$msgerr = NULL, $rec ) : content
$url string to retrieve
$msgerr string set if problem encountered (default NULL)
$rec integer internal use only Must be 0 (default 0)
리턴 content of the page (or empty)

get_magic_quotes_gpc() 정적인 공개 메소드

Wrapper for get_magic_quotes_gpc - deprecated
사용 중단: in 0.90.1
static public get_magic_quotes_gpc ( ) : boolean
리턴 boolean

get_magic_quotes_runtime() 정적인 공개 메소드

Wrapper for get_magic_quotes_runtime - deprecated
사용 중단: in 0.90.1
static public get_magic_quotes_runtime ( ) : boolean
리턴 boolean

get_max_input_vars() 정적인 공개 메소드

Wrapper for max_input_vars
static public get_max_input_vars ( ) : integer
리턴 integer

inArrayCaseCompare() 정적인 공개 메소드

Do a in_array search comparing string using strcasecmp
static public inArrayCaseCompare ( $string, $datas = [] ) : boolean
$string string to search
$datas array to search to search
리턴 boolean : string founded ?

in_array_recursive() 정적인 공개 메소드

Summary of in_array_recursive
static public in_array_recursive ( mixed $needle, array $haystack, $strict = false ) : boolean
$needle mixed
$haystack array
리턴 boolean

is_a() 정적인 공개 메소드

This method emulates PHP 5.3.9: is_a with allow_string == true
static public is_a ( $object, $class_name ) : true
$object can be an object or a string contining the class name
$class_name the name of the class to compare
리턴 true if $object is an instance of $class_name

key_exists_deep() 정적인 공개 메소드

static public key_exists_deep ( $need, $tab )
$need
$tab

logDebug() 정적인 공개 메소드

Log in 'php-errors' all args
static public logDebug ( )

logInFile() 정적인 공개 메소드

Log a message in log file
static public logInFile ( $name, $text, $force = false )
$name string name of the log file
$text string text to log
$force boolean force log in file not seeing use_log_in_files config (false by default)

manageBeginAndEndPlanDates() 정적인 공개 메소드

Manage planning posted datas (must have begin + duration or end) Compute end if duration is set
static public manageBeginAndEndPlanDates ( &$data ) : processed
$data array data to process
리턴 processed datas

manageRedirect() 정적인 공개 메소드

Manage login redirection
static public manageRedirect ( $where )
$where string: where to redirect ?

parseMailServerConnectString() 정적인 공개 메소드

Parse imap open connect string
static public parseMailServerConnectString ( $value, $forceport = false ) : array
$value string: connect string
$forceport boolean: force compute port if not set (false by default)
리턴 array of parsed arguments (address, port, mailbox, type, ssl, tls, validate-cert norsh, secure and debug) : options are empty if not set and options have boolean values if set

prepareArrayForInput() 정적인 공개 메소드

Prepare array passed on an input form
static public prepareArrayForInput ( array $value ) : string
$value array array passed array
리턴 string encoded array

removeHtmlSpecialChars() 공개 정적인 메소드

Remove accentued characters and return lower case string
public static removeHtmlSpecialChars ( string $string ) : string
$string string String to handle
리턴 string

resizePicture() 정적인 공개 메소드

Resize a picture to the new size
static public resizePicture ( $source_path, $dest_path, $new_width = 71, $new_height = 71, $img_y, $img_x, $img_width, $img_height, $max_size = 500 ) : boolean
$source_path string path of the picture to be resized
$dest_path string path of the new resized picture
$new_width string new width after resized (default 71)
$new_height string new height after resized (default 71)
$img_y string y axis of picture (default 0)
$img_x string x axis of picture (default 0)
$img_width string width of picture (default 0)
$img_height string height of picture (default 0)
$max_size integer max size of the picture (default 500, is set to 0 no resize)
리턴 boolean : true or false

return_bytes_from_ini_vars() 정적인 공개 메소드

..
static public return_bytes_from_ini_vars ( $val )
$val string: config value (like 10k, 5M)

sanitize() 공개 정적인 메소드

Sanitize received values
public static sanitize ( array $array ) : array
$array array
리턴 array

seems_utf8() 정적인 공개 메소드

Is a string seems to be UTF-8 one ?
static public seems_utf8 ( $str ) : boolean
$str string string to analyze
리턴 boolean

sendFile() 정적인 공개 메소드

Send a file (not a document) to the navigator See Document->send();
static public sendFile ( $file, $filename, $mime = null ) : nothing
$file string: storage filename
$filename string: file title
$mime string: file mime type
리턴 nothing

setDebugMode() 정적인 공개 메소드

Switch error mode for GLPI
static public setDebugMode ( $mode = NULL, $debug_sql = NULL, $debug_vars = NULL, $log_in_files = NULL )
$mode Integer from Session::*_MODE (default NULL)
$debug_sql Boolean (default NULL)
$debug_vars Boolean (default NULL)
$log_in_files Boolean (default NULL)

shortcut() 정적인 공개 메소드

to underline shortcut letter
static public shortcut ( $str, $shortcut ) : string
$str string from dico
$shortcut letter of shortcut
리턴 string

showMailServerConfig() 정적인 공개 메소드

Display a mail server configuration form
static public showMailServerConfig ( $value ) : String
$value String host connect string ex {localhost:993/imap/ssl}INBOX
리턴 String type of the server (imap/pop)

slugify() 공개 정적인 메소드

Slugify
public static slugify ( string $string ) : string
$string string String to slugify
리턴 string

str_pad() 정적인 공개 메소드

Replace str_pad() who bug with utf8
static public str_pad ( $input, $pad_length, $pad_string = " ", $pad_type = STR_PAD_RIGHT ) : string
$input string input string
$pad_length integer padding length
$pad_string string padding string (default '')
$pad_type integer padding type (default STR_PAD_RIGHT)
리턴 string

stripslashes_deep() 정적인 공개 메소드

Strip slash for variable & array
static public stripslashes_deep ( $value ) : stripslashes
$value array or string: item to stripslashes (array or string)
리턴 stripslashes item

strlen() 정적인 공개 메소드

strlen function for utf8 string
static public strlen ( $str ) : length
$str string
리턴 length of the string

strpos() 정적인 공개 메소드

substr function for utf8 string
static public strpos ( $str, $tofound, $offset ) : substring
$str string string
$tofound string string to found
$offset integer The search offset. If it is not specified, 0 is used. (default 0)
리턴 substring

strtolower() 정적인 공개 메소드

strtolower function for utf8 string
static public strtolower ( $str ) : lower
$str string
리턴 lower case string

strtoupper() 정적인 공개 메소드

strtoupper function for utf8 string
static public strtoupper ( $str ) : upper
$str string
리턴 upper case string

substr() 정적인 공개 메소드

substr function for utf8 string
static public substr ( $str, $start, $length ) : substring
$str string
$start integer start of the result substring
$length integer The maximum length of the returned string if > 0 (default -1)
리턴 substring

testWriteAccessToDirectory() 정적인 공개 메소드

Check Write Access to a directory
static public testWriteAccessToDirectory ( $dir ) : 2
$dir string: directory to check
리턴 2

ucfirst() 정적인 공개 메소드

Convert first caracter in upper
static public ucfirst ( $str ) : string
$str string to change
리턴 string changed

unclean_cross_side_scripting_deep() 정적인 공개 메소드

Invert fonction from clean_cross_side_scripting_deep
또한 보기: clean_cross_side_scripting_deep
static public unclean_cross_side_scripting_deep ( $value ) : unclean
$value array or string item to unclean from clean_cross_side_scripting_deep
리턴 unclean item

unclean_html_cross_side_scripting_deep() 정적인 공개 메소드

Invert fonction from clean_cross_side_scripting_deep to display HTML striping XSS code
또한 보기: clean_cross_side_scripting_deep
static public unclean_html_cross_side_scripting_deep ( $value ) : unclean
$value array or string: item to unclean from clean_cross_side_scripting_deep
리턴 unclean item

userErrorHandlerDebug() 정적인 공개 메소드

Specific error handler in Debug mode
static public userErrorHandlerDebug ( $errno, $errmsg, $filename, $linenum, $vars )
$errno integer level of the error raised.
$errmsg string error message.
$filename string filename that the error was raised in.
$linenum integer line number the error was raised at.
$vars array that points to the active symbol table at the point the error occurred.

userErrorHandlerNormal() 정적인 공개 메소드

Specific error handler in Normal mode
static public userErrorHandlerNormal ( $errno, $errmsg, $filename, $linenum, $vars )
$errno integer level of the error raised.
$errmsg string error message.
$filename string filename that the error was raised in.
$linenum integer line number the error was raised at.
$vars array that points to the active symbol table at the point the error occurred.

writeConfig() 정적인 공개 메소드

Save a configuration file
static public writeConfig ( $name, $content ) : boolean
$name string config file name
$content string config file content
리턴 boolean