ZenphotoCMS 1.6.2

common

Table of Contents

Functions

zpErrorHandler()  : void|bool
Traps errors and insures thy are logged.
filesystemToInternal()  : string
Converts a file system filename to UTF-8 for zenphoto internal storage
internalToFilesystem()  : string
Converts a Zenphoto Internal filename string to one compatible with the file system
sanitize_path()  : string
Takes user input meant to be used within a path to a file or folder and removes anything that could be insecure or malicious, or result in duplicate representations for the same physical file.
sanitize_numeric()  : int
Checks if the input is numeric, rounds if so, otherwise returns false.
sanitize_script()  : string
removes script tags
sanitize()  : string
Make strings generally clean. Takes an input string and cleans out null-bytes, and optionally use KSES library to prevent XSS attacks and other malicious user input.
ksesProcess()  : string
Internal "helper" function to apply the tag removal
getBare()  : type
Cleans tags and some content.
sanitize_string()  : string
returns a sanitized string for the sanitize function
zp_error()  : mixed
triggers an error
html_decode()  : mixed
html_encode()  : string
encodes a pre-sanitized string to be used in an HTML text-only field (value, alt, title, etc.)
html_encodeTagged()  : string
HTML encodes the non-metatag part of the string.
html_pathurlencode()  : string
Convenience wrapper of html_encode(pathurlencode($url)) Primarily intended for use with img src URLs
mkdir_recursive()  : bool
Makes directory recursively, returns TRUE if exists or was created sucessfuly.
debugLogBacktrace()  : mixed
Logs the calling stack
debugLogVar()  : mixed
Records a Var to the debug log
zp_getCookie()  : mixed
Returns the value of a cookie from either the cookies or from $_SESSION[]
zp_cookieEncode()  : mixed
Encodes a cookie value tying it to the user IP
zp_setCookie()  : mixed
Sets a cookie both in the browser cookies and in $_SESSION[]
zp_clearCookie()  : mixed
Clears a cookie
getSerializedArray()  : array<string|int, mixed>
if $string is an serialzied array it is unserialized otherwise an appropriate array is returned

Functions

zpErrorHandler()

Traps errors and insures thy are logged.

zpErrorHandler(int $errno[, string $errstr = '' ][, string $errfile = '' ][, string $errline = '' ]) : void|bool
Parameters
$errno : int
$errstr : string = ''
$errfile : string = ''
$errline : string = ''
Return values
void|bool

filesystemToInternal()

Converts a file system filename to UTF-8 for zenphoto internal storage

filesystemToInternal(string $filename) : string
Parameters
$filename : string

the file name to convert

Return values
string

internalToFilesystem()

Converts a Zenphoto Internal filename string to one compatible with the file system

internalToFilesystem(string $filename) : string
Parameters
$filename : string

the file name to convert

Return values
string

sanitize_path()

Takes user input meant to be used within a path to a file or folder and removes anything that could be insecure or malicious, or result in duplicate representations for the same physical file.

sanitize_path(string $filename) : string

This function is used primarily for album names. NOTE: The initial and trailing slashes are removed!!!

Returns the sanitized path

Parameters
$filename : string

is the path text to filter.

Return values
string

sanitize_numeric()

Checks if the input is numeric, rounds if so, otherwise returns false.

sanitize_numeric(mixed $num) : int
Parameters
$num : mixed

the number to be sanitized

Return values
int

sanitize_script()

removes script tags

sanitize_script(string $text) : string
Parameters
$text : string
Return values
string

sanitize()

Make strings generally clean. Takes an input string and cleans out null-bytes, and optionally use KSES library to prevent XSS attacks and other malicious user input.

sanitize(string $input_string[, string $sanitize_level = 3 ]) : string
Parameters
$input_string : string

is a string that needs cleaning.

$sanitize_level : string = 3

is a number between 0 and 3 that describes the type of sanitizing to perform on $input_string. 0 - Basic sanitation. Only strips null bytes. Not recommended for submitted form data. 1 - User specified. (User defined code is allowed. Used for descriptions and comments.) 2 - Text style/formatting. (Text style codes allowed. Used for titles.) 3 - Full sanitation. (Default. No code allowed. Used for text only fields)

Return values
string

the sanitized string.

ksesProcess()

Internal "helper" function to apply the tag removal

ksesProcess(string $input_string, array<string|int, mixed> $allowed_tags) : string
Parameters
$input_string : string
$allowed_tags : array<string|int, mixed>
Return values
string

getBare()

Cleans tags and some content.

getBare(type $content) : type
Parameters
$content : type
Return values
type

sanitize_string()

returns a sanitized string for the sanitize function

sanitize_string(mixed $input, string $sanitize_level) : string
Parameters
$input : mixed
$sanitize_level : string

See sanitize()

Return values
string

the sanitized string.

zp_error()

triggers an error

zp_error(string $message[, mixed $fatal = E_USER_ERROR ]) : mixed
Parameters
$message : string
$fatal : mixed = E_USER_ERROR

html_decode()

html_decode(mixed $string) : mixed
Parameters
$string : mixed

html_encode()

encodes a pre-sanitized string to be used in an HTML text-only field (value, alt, title, etc.)

html_encode(string $str) : string
Parameters
$str : string
Return values
string

html_encodeTagged()

HTML encodes the non-metatag part of the string.

html_encodeTagged(string $original[, bool $allowScript = true ]) : string
Parameters
$original : string

string to be encoded

$allowScript : bool = true

set to false to prevent pass-through of script tags.

Return values
string

html_pathurlencode()

Convenience wrapper of html_encode(pathurlencode($url)) Primarily intended for use with img src URLs

html_pathurlencode(string $url) : string
Parameters
$url : string
Tags
since
1.5.8
Return values
string

mkdir_recursive()

Makes directory recursively, returns TRUE if exists or was created sucessfuly.

mkdir_recursive(string $pathname, mixed $mode) : bool

Note: PHP5 includes a recursive parameter to mkdir, but it apparently does not does not traverse symlinks!

Parameters
$pathname : string

The directory path to be created.

$mode : mixed
Return values
bool

TRUE if exists or made or FALSE on failure.

debugLogBacktrace()

Logs the calling stack

debugLogBacktrace(string $message[, int $omit = 0 ][, string $logname = 'debug' ]) : mixed
Parameters
$message : string

Message to prefix the backtrace

$omit : int = 0
$logname : string = 'debug'

Optional custom log name to log to, default "debug"

debugLogVar()

Records a Var to the debug log

debugLogVar(string $message[, mixed $var = '' ][, string $logname = 'debug' ]) : mixed
Parameters
$message : string

message to insert in log [optional]

$var : mixed = ''

the variable to record

$logname : string = 'debug'

Optional custom log name to log to, default "debug"

zp_getCookie()

Returns the value of a cookie from either the cookies or from $_SESSION[]

zp_getCookie(string $name) : mixed
Parameters
$name : string

the name of the cookie

zp_cookieEncode()

Encodes a cookie value tying it to the user IP

zp_cookieEncode( $value) : mixed
Parameters
$value :

zp_setCookie()

Sets a cookie both in the browser cookies and in $_SESSION[]

zp_setCookie(string $name, string $value[, timestamp $time = NULL ][, string $path = NULL ][, bool $secure = false ][, bool $httponly = false ]) : mixed
Parameters
$name : string

The 'cookie' name

$value : string

The value to be stored

$time : timestamp = NULL

The time delta until the cookie expires

$path : string = NULL

The path on the server in which the cookie will be available on

$secure : bool = false

true if secure cookie

$httponly : bool = false

true if access to this cookie should only be allowed via http (e.g. no access to JS etc.). Requires browser support though.

zp_clearCookie()

Clears a cookie

zp_clearCookie(string $name[, string $path = NULl ][, bool $secure = false ][, bool $httponly = false ]) : mixed
Parameters
$name : string

The 'cookie' name

$path : string = NULl

The path on the server in which the cookie will be available on

$secure : bool = false

true if secure cookie

$httponly : bool = false

true if access to this cookie should only be allowed via http (e.g. no access to JS etc.). Requires browser support though.

getSerializedArray()

if $string is an serialzied array it is unserialized otherwise an appropriate array is returned

getSerializedArray(string $string[, bool $disallow_classes = false ]) : array<string|int, mixed>
Parameters
$string : string
$disallow_classes : bool = false

Default false, if set to true the unserializing disallows classes. Set to true if using this on user submitted $_GET/$_POST/$_REQUEST data

Return values
array<string|int, mixed>

        
On this page

Search results