This function reference is periodically auto-generated from the inline comments in phpgwapi/inc/class.vfs.inc.php. For the most up-to-date (and nicer looking) reference, see class.vfs.inc.php. This reference is created as a separate DocBook document (using the inline2lyx.pl script), so it might look a bit out of place.
abstract: virtual file system
description: Authors: Zone, Seek3r
abstract: helper class for path_parts
abstract: constructor, sets up variables
function vfs ()
abstract: Set path relativity
param: $mask Relative bitmask (see RELATIVE_ defines)
function set_relative ($mask)
abstract: Return relativity bitmask
discussion: Returns relativity bitmask, or the default of "completely relative" if unset
function get_relative ()
abstract: Removes leading .'s from $string
discussion: You should not pass all filenames through sanitize () unless you plan on rejecting
.files. Instead, pass the name through securitycheck () first, and if it fails,
pass it through sanitize
param: $string string to sanitize
result: $string without it's leading .'s
function sanitize ($string)
abstract: Security check function
discussion: Checks for basic violations such as ..
If securitycheck () fails, run your string through vfs->sanitize ()
param: $string string to check security of
result: Boolean True/False. True means secure, False means insecure
function securitycheck ($string)
abstract: Clean $string for use in database queries
param: $string String to clean
result: Cleaned version of $string
function db_clean ($string)
abstract: take a real or fake pathname and return an array of its component parts
param: $string full real or fake path
param: $relatives Relativity array
param: $object True returns an object instead of an array
result: $rarray/$robject Array or object containing the fake and real component parts of the path
discussion: Returned values are:
mask
outside
fake_full_path
fake_leading_dirs
fake_extra_path
fake_name
real_full_path
real_leading_dirs
real_extra_path
real_name
fake_full_path_clean
fake_leading_dirs_clean
fake_extra_path_clean
fake_name_clean
real_full_path_clean
real_leading_dirs_clean
real_extra_path_clean
real_name_clean
"clean" values are run through vfs->db_clean () and
are safe for use in SQL queries that use key='value'
They should be used ONLY for SQL queries, so are used
mostly internally
mask is either RELATIVE_NONE or RELATIVE_NONE|VFS_REAL,
and is used internally
outside is boolean, True if $relatives contains VFS_REAL
function path_parts ($string, $relatives = array (RELATIVE_CURRENT), $object = True)
abstract: get the absolute path
param: $target defaults to False, directory/file to get path of, relative to $relatives[0]
param: $mask Relativity bitmask (see RELATIVE_ defines). RELATIVE_CURRENT means use $this->relative
param: $fake Returns the "fake" path, ie /home/user/dir/file (not always possible. use path_parts () instead)
result: $basedir Full fake or real path
function getabsolutepath ($target = False, $relatives = array (RELATIVE_CURRENT), $fake = True)
abstract: Change directory
discussion: To cd to the files root "/", use cd ("/", False, array (RELATIVE_NONE));
param: $target default "/". directory to cd into. if "/" and $relative is True, uses "/home/<working_lid>";
param: $relative default True/relative means add target to current path, else pass $relative as mask to getabsolutepath()
function cd ($target = "/", $relative = True, $relatives = array (RELATIVE_CURRENT))
abstract: current working dir
param: $full default True returns full fake path, else just the extra dirs (false strips the leading /)
result: $currentdir currentdir
function pwd ($full = True)
abstract: return file contents
param: $file filename
param: $relatives Relativity array
result: $contents Contents of $file, or False if file cannot be read
function read ($file, $relatives = array (RELATIVE_CURRENT))
abstract: write to a file
param: $file file name
param: $relatives Relativity array
param: $contents contents
result: Boolean True/False
function write ($file, $relatives = array (RELATIVE_CURRENT), $contents)
abstract: Create blank file $file or set the modification time and modified by of $file to current time and user
param: $file File to touch or set modifies
param: $relatives Relativity array
result: Boolean True/False
function touch ($file, $relatives = array (RELATIVE_CURRENT))
abstract: copy file
param: $from from file/directory
param: $to to file/directory
param: $relatives Relativity array
result: boolean True/False
function cp ($from, $to, $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT))
abstract: move file/directory
param: $from from file/directory
param: $to to file/directory
param: $relatives Relativity array
result: boolean True/False
function mv ($from, $to, $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT))
abstract: shortcut to mv
function move ($from, $to, $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT))
abstract: delete file/directory
param: $string file/directory to delete
param: $relatives Relativity array
result: boolean True/False
function rm ($string, $relatives = array (RELATIVE_CURRENT))
abstract: shortcut to rm
function delete ($string, $relatives = array (RELATIVE_CURRENT))
abstract: make a new directory
param: $dir Directory name
param: $relatives Relativity array
result: boolean True on success
function mkdir ($dir, $relatives = array (RELATIVE_CURRENT))
abstract: Update database entry for $file with the attributes in $attributes
param: $file file/directory to update
param: $relatives Relativity array
param: $attributes keyed array of attributes. key is attribute name, value is attribute value
result: Boolean True/False
discussion: Valid attributes are:
owner_id
createdby_id
modifiedby_id
created
modified
size
mime_type
deleteable
comment
app
function set_attributes ($file, $relatives = array (RELATIVE_CURRENT), $attributes = array ())
abstract: Set the correct attributes for $string (e.g. owner)
param: $string File/directory to correct attributes of
param: $relatives Relativity array
result: Boolean True/False
function correct_attributes ($string, $relatives = array (RELATIVE_CURRENT))
abstract: return file/dir type (MIME or other)
param: $file File or directory path (/home/user/dir/dir2/dir3, /home/user/dir/dir2/file)
param: $relatives Relativity array
result: MIME type, "Directory", or nothing if MIME type is not known
function file_type ($file, $relatives = array (RELATIVE_CURRENT))
abstract: check if file/directory exists
param: $string file/directory to check existance of
param: $relatives Relativity array
result: Boolean True/False
function file_exists ($string, $relatives = array (RELATIVE_CURRENT))
abstract: Check if you have write access to create files in $dir
discussion: This isn't perfect, because vfs->touch () returns True even
if only the database entry worked. ACLs need to be
implemented for better permission checking. It's
also pretty slow, so I wouldn't recommend using it
often
param: $dir Directory to check access of
param: $relatives Relativity array
result: Boolean True/False
function checkperms ($dir, $relatives = array (RELATIVE_CURRENT))
abstract: get directory listing
discussion: Note: the entries are not guaranteed to be returned in any logical order
param: $dir Directory
param: $relatives Relativity array
param: $checksubdirs Boolean, recursively list all sub directories as well?
param: $mime_type Only return entries matching MIME-type $mime_type. Can be "Directory" or "\" for those without MIME types
param: $nofiles Boolean. True means you want to return just the information about the directory $dir. If $dir is a file, $nofiles is implied. This is the equivalent of 'ls -ld $dir'
result: array of arrays. Subarrays contain full info for each file/dir.
function ls ($dir = False, $relatives = array (RELATIVE_CURRENT), $checksubdirs = True, $mime_type = False, $nofiles = False)
abstract: shortcut to ls
function dir ($dir = False, $relatives = array (RELATIVE_CURRENT), $checksubdirs = True, $mime_type = False, $nofiles = False)