# The Red Matrix: include/attach.php File Reference

All Classes Namespaces Files Functions Variables Pages
attach.php File Reference

## Functions

| z_mime_content_type ($filename)
| attach_count_files ($channel_id, $observer, $hash= '', $filename= '', $filetype= '')
| attach_list_files ($channel_id, $observer, $hash= '', $filename= '', $filetype= '', $orderby= 'created desc', $start=0, $entries=0)
| attach_by_hash ($hash, $rev=0)
| attach_by_hash_nodata ($hash, $rev=0)
| attach_store ($channel, $observer_hash, $options= '', $arr=null)
| z_readdir ($channel_id, $observer_hash, $pathname, $parent_hash= '')
| attach_mkdir ($channel, $observer_hash, $arr=null)
| attach_change_permissions ($channel_id, $resource, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $recurse=false)
| attach_delete ($channel_id, $resource)
| get_cloudpath ($arr)
| pipe_streams ($in, $out)

## Function Documentation

attach_by_hash | ( |  | $hash,
|  |  | $rev = `0`
| ) |  |

Referenced by attach_init().

attach_by_hash_nodata | ( |  | $hash,
|  |  | $rev = `0`
| ) |  |

Referenced by item_post(), and send_message().

attach_change_permissions | ( |  | $channel_id,
|  |  | $resource,
|  |  | $allow_cid,
|  |  | $allow_gid,
|  |  | $deny_cid,
|  |  | $deny_gid,
|  |  | $recurse = `false`
| ) |  |

Referenced by filestorage_post().

attach_count_files | ( |  | $channel_id,
|  |  | $observer,
|  |  | $hash = `''`,
|  |  | $filename = `''`,
|  |  | $filetype = `''`
| ) |  |

attach_delete | ( |  | $channel_id,
|  |  | $resource
| ) |  |

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`
| ) |  |

attach_mkdir | ( |  | $channel,
|  |  | $observer_hash,
|  |  | $arr = `null`
| ) |  |

attach_mkdir($channel,$observer_hash,$arr);

Create directory

Parameters

  $channel | channel array of owner
  $observer_hash | hash of current observer
  $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`
| ) |  |

Referenced by fix_attached_file_permissions(), send_message(), and wall_attach_post().

get_cloudpath | ( |  | $arr | ) |

Referenced by filestorage_content().

pipe_streams | ( |  | $in,
|  |  | $out
| ) |  |

Referenced by attach_init().

z_mime_content_type | ( |  | $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

Parameters

  integer | $channel_id |
  string | $observer_hash |
  string | $pathname |
  string | $parent_hash | (optional)

Returns
  array $ret $ret['success'] = boolean true or false $ret['message'] = error message if success is false $ret['data'] = array of attach DB entries without data component