The Red Matrix
|
File/attach API with the potential for revision control. More...
Functions | |
z_mime_content_type ($filename) | |
Guess the mimetype from file ending. More... | |
attach_count_files ($channel_id, $observer, $hash= '', $filename= '', $filetype= '') | |
Count files/attachments. More... | |
attach_list_files ($channel_id, $observer, $hash= '', $filename= '', $filetype= '', $orderby= 'created desc', $start=0, $entries=0) | |
Returns a list of files/attachments. More... | |
attach_by_hash ($hash, $rev=0) | |
Find an attachment by hash and revision. More... | |
attach_by_hash_nodata ($hash, $rev=0) | |
Find an attachment by hash and revision. More... | |
attach_store ($channel, $observer_hash, $options= '', $arr=null) | |
z_readdir ($channel_id, $observer_hash, $pathname, $parent_hash= '') | |
attach_mkdir ($channel, $observer_hash, $arr=null) | |
Create directory. More... | |
attach_change_permissions ($channel_id, $resource, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $recurse=false) | |
Changes permissions of a file. More... | |
attach_delete ($channel_id, $resource) | |
Delete a file/directory. More... | |
get_cloudpath ($arr) | |
Returns path to file in cloud/. More... | |
get_parent_cloudpath ($channel_id, $channel_name, $attachHash) | |
Returns path to parent folder in cloud/. More... | |
find_folder_hash_by_attach_hash ($channel_id, $attachHash) | |
find_filename_by_hash ($channel_id, $attachHash) | |
pipe_streams ($in, $out) | |
File/attach API with the potential for revision control.
TODO: a filesystem storage abstraction which maintains security (and 'data' contains a system filename which is inaccessible from the web). This could get around PHP storage limits and store videos and larger items, using fread or OS methods or native code to read/write or chunk it through. Also an 'append' option to the storage function might be a useful addition.
attach_by_hash | ( | $hash, | |
$rev = 0 |
|||
) |
Find an attachment by hash and revision.
Returns the entire attach structure including data.
This could exhaust memory so most useful only when immediately sending the data.
$hash | |
$rev |
Referenced by attach_init().
attach_by_hash_nodata | ( | $hash, | |
$rev = 0 |
|||
) |
Find an attachment by hash and revision.
Returns the entire attach structure excluding data.
$hash | |
$ref |
Referenced by item_post(), and send_message().
attach_change_permissions | ( | $channel_id, | |
$resource, | |||
$allow_cid, | |||
$allow_gid, | |||
$deny_cid, | |||
$deny_gid, | |||
$recurse = false |
|||
) |
Changes permissions of a file.
$channel_id | |
$resource | |
$allow_cid | |
$allow_gid | |
$deny_cid | |
$deny_gid | |
$recurse |
Referenced by filestorage_post().
attach_count_files | ( | $channel_id, | |
$observer, | |||
$hash = '' , |
|||
$filename = '' , |
|||
$filetype = '' |
|||
) |
Count files/attachments.
$channel_id | |
$observer | |
$hash | (optional) |
$filename | (optional) |
$filetype | (optional) |
attach_delete | ( | $channel_id, | |
$resource | |||
) |
Delete a file/directory.
int | $channel_id | |
string | $resource | a hash to delete |
Referenced by RedDirectory\createFile(), RedFile\delete(), filestorage_content(), and RedFile\put().
attach_list_files | ( | $channel_id, | |
$observer, | |||
$hash = '' , |
|||
$filename = '' , |
|||
$filetype = '' , |
|||
$orderby = 'created desc' , |
|||
$start = 0 , |
|||
$entries = 0 |
|||
) |
Returns a list of files/attachments.
$channel_id | |
$observer | |
$hash | (optional) |
$filename | (optional) |
$filetype | (optional) |
$orderby | |
$start | |
$entries |
attach_mkdir | ( | $channel, | |
$observer_hash, | |||
$arr = null |
|||
) |
Create directory.
attach_mkdir($channel,$observer_hash,$arr);
array | $channel | channel array of owner |
string | $observer_hash | hash of current observer |
array | $arr | parameter array to fulfil request Required: $arr['filename'] $arr['folder'] // hash of parent directory, empty string for root directory Optional: $arr['hash'] // precumputed hash for this node $arr['allow_cid'] $arr['allow_gid'] $arr['deny_cid'] $arr['deny_gid'] |
Referenced by RedDirectory\createDirectory().
attach_store | ( | $channel, | |
$observer_hash, | |||
$options = '' , |
|||
$arr = null |
|||
) |
$channel | channel array of owner |
$observer_hash | hash of current observer |
$options | (optional) |
$arr | (optional) |
Referenced by fix_attached_file_permissions(), importelm_post(), send_message(), and wall_attach_post().
find_filename_by_hash | ( | $channel_id, | |
$attachHash | |||
) |
Referenced by get_parent_cloudpath().
find_folder_hash_by_attach_hash | ( | $channel_id, | |
$attachHash | |||
) |
Referenced by get_parent_cloudpath().
get_cloudpath | ( | $arr | ) |
Returns path to file in cloud/.
$arr |
Referenced by filestorage_content().
get_parent_cloudpath | ( | $channel_id, | |
$channel_name, | |||
$attachHash | |||
) |
Returns path to parent folder in cloud/.
$arr |
Referenced by filestorage_content(), and filestorage_post().
pipe_streams | ( | $in, | |
$out | |||
) |
$in | |
$out |
Referenced by attach_init().
z_mime_content_type | ( | $filename | ) |
Guess the mimetype from file ending.
This function takes a file name and guess the mimetype from the filename extension.
$filename | a string filename |
Referenced by attach_store(), and RedDirectory\createFile().
z_readdir | ( | $channel_id, | |
$observer_hash, | |||
$pathname, | |||
$parent_hash = '' |
|||
) |
Read a virtual directory and return contents, checking permissions of all parent components. z_readdir
integer | $channel_id | |
string | $observer_hash | hash of current observer |
string | $pathname | |
string | $parent_hash | (optional) |