$patterns
$patterns : array
A list of random patterns to use for overwriting purposes.
See http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html. We save the random overwrites for efficiency reasons.
The Horde_Util:: class provides generally useful methods.
Copyright 1999-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
$patterns : array
A list of random patterns to use for overwriting purposes.
See http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html. We save the random overwrites for efficiency reasons.
nonInputVar(string $varname, mixed $default = null) : mixed
Checks to see if a value has been set by the script and not by GET, POST, or cookie input. The value being checked MUST be in the global scope.
string | $varname | The variable name to check. |
mixed | $default | Default value if the variable isn't present or was specified by the user. Defaults to null. |
$default if the var is in user input or not present, the variable value otherwise.
getFormData(string $var, string $default = null) : string
Gets a form variable from GET or POST data, stripped of magic quotes if necessary. If the variable is somehow set in both the GET data and the POST data, the value from the POST data will be returned and the GET value will be ignored.
string | $var | The name of the form variable to look for. |
string | $default | The value to return if the variable is not there. |
The cleaned form variable, or $default.
getGet(string $var, string $default = null) : string
Gets a form variable from GET data, stripped of magic quotes if necessary. This function will NOT return a POST variable.
string | $var | The name of the form variable to look for. |
string | $default | The value to return if the variable is not there. |
The cleaned form variable, or $default.
getPost(string $var, string $default = null) : string
Gets a form variable from POST data, stripped of magic quotes if necessary. This function will NOT return a GET variable.
string | $var | The name of the form variable to look for. |
string | $default | The value to return if the variable is not there. |
The cleaned form variable, or $default.
getTempFile(string $prefix = '', boolean $delete = true, string $dir = '', boolean $secure = false) : string
Creates a temporary filename for the lifetime of the script, and (optionally) registers it to be deleted at request shutdown.
string | $prefix | Prefix to make the temporary name more recognizable. |
boolean | $delete | Delete the file at the end of the request? |
string | $dir | Directory to create the temporary file in. |
boolean | $secure | If deleting the file, should we securely delete the file by overwriting it with random data? |
Returns the full path-name to the temporary file. Returns false if a temp file could not be created.
getTempFileWithExtension(string $extension = '.tmp', string $prefix = '', boolean $delete = true, string $dir = '', boolean $secure = false) : string
Creates a temporary filename with a specific extension for the lifetime of the script, and (optionally) registers it to be deleted at request shutdown.
string | $extension | The file extension to use. |
string | $prefix | Prefix to make the temporary name more recognizable. |
boolean | $delete | Delete the file at the end of the request? |
string | $dir | Directory to create the temporary file in. |
boolean | $secure | If deleting file, should we securely delete the file by overwriting it with random data? |
Returns the full path-name to the temporary file. Returns false if a temporary file could not be created.
createTempDir(boolean $delete = true, string $temp_dir = null) : string
Creates a temporary directory in the system's temporary directory.
boolean | $delete | Delete the temporary directory at the end of the request? |
string | $temp_dir | Use this temporary directory as the directory where the temporary directory will be created. |
The pathname to the new temporary directory. Returns false if directory not created.
realPath(string $path) : string
Returns the canonical path of the string. Like PHP's built-in realpath() except the directory need not exist on the local server.
Algorithim loosely based on code from the Perl File::Spec::Unix module (version 1.5).
string | $path | A file path. |
The canonicalized file path.
deleteAtShutdown(string $filename, boolean $register = true, boolean $secure = false)
Removes given elements at request shutdown.
If called with a filename will delete that file at request shutdown; if called with a directory will remove that directory and all files in that directory at request shutdown.
If called with no arguments, return all elements to be deleted (this should only be done by Horde_Util::_deleteAtShutdown()).
The first time it is called, it initializes the array and registers Horde_Util::_deleteAtShutdown() as a shutdown function - no need to do so manually.
The second parameter allows the unregistering of previously registered elements.
string | $filename | The filename to be deleted at the end of the request. |
boolean | $register | If true, then register the element for deletion, otherwise, unregister it. |
boolean | $secure | If deleting file, should we securely delete the file? |
shutdown()
Deletes registered files at request shutdown.
This function should never be called manually; it is registered as a shutdown function by Horde_Util::deleteAtShutdown() and called automatically at the end of the request.
Contains code from gpg_functions.php. Copyright 2002-2003 Braverock Ventures
loadExtension(string $ext) : boolean
Tries to load a PHP extension, behaving correctly for all operating systems.
string | $ext | The extension to load. |
True if the extension is now loaded, false if not. True can mean that the extension was already loaded, OR was loaded dynamically.