Merge pull request #323 from dawnbreak/docu

Add some more documentation to attach_store()
This commit is contained in:
redmatrix 2015-05-18 09:41:32 +10:00
commit 1cca24dfdc

View File

@ -4,10 +4,11 @@
*
* @brief 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.
* @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.
* @todo Also an 'append' option to the storage function might be a useful addition.
*/
require_once('include/permissions.php');
@ -123,7 +124,7 @@ function z_mime_content_type($filename) {
* @param string $hash (optional)
* @param string $filename (optional)
* @param string $filetype (optional)
* @return assoziative array with:
* @return associative array with:
* * \e boolean \b success
* * \e int|boolean \b results amount of found results, or false
* * \e string \b message with error messages if any
@ -170,10 +171,10 @@ function attach_count_files($channel_id, $observer, $hash = '', $filename = '',
* @param $orderby
* @param $start
* @param $entries
* @return array
* $ret['success'] boolean
* $ret['results'] array with results, or false
* $ret['message'] string with error messages if any
* @return associative array with:
* * \e boolean \b success
* * \e array|boolean \b results array with results, or false
* * \e string \b message with error messages if any
*/
function attach_list_files($channel_id, $observer, $hash = '', $filename = '', $filetype = '', $orderby = 'created desc', $start = 0, $entries = 0) {
@ -275,7 +276,7 @@ function attach_by_hash($hash, $rev = 0) {
* @see attach_by_hash()
* @param $hash
* @param $rev revision default 0
* @return array Everything except data.
* @return associative array with everything except data
* * \e boolean \b success boolean true or false
* * \e string \b message (optional) only when success is false
* * \e array \b data array of attach DB entry without data component
@ -326,12 +327,18 @@ function attach_by_hash_nodata($hash, $rev = 0) {
}
/**
* @brief
* @brief Stores an attachment from a POST file upload.
*
* @param $channel channel array of owner
* @param $observer_hash hash of current observer
* @param $options (optional)
* @param $arr (optional)
* This function stores an attachment. It can be a new one, a replacement or a
* new revision depending on value set in \e $options.
*
* @note Requires an input field \e userfile and does not accept multiple files
* in one request.
*
* @param array $channel channel array of owner
* @param string $observer_hash hash of current observer
* @param string $options (optional) one of update, replace, revision
* @param array $arr (optional) associative array
*/
function attach_store($channel, $observer_hash, $options = '', $arr = null) {
@ -841,7 +848,7 @@ function attach_delete($channel_id, $resource) {
* @warning This function cannot be used with mod/dav as it always returns a
* path valid under mod/cloud.
*
* @param array $arr assoziative array with:
* @param array $arr associative array with:
* * \e int \b uid the channel's uid
* * \e string \b folder
* * \e string \b filename
@ -1210,6 +1217,7 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
$ret = array();
$parent_arr = array();
$count_values = array();
$poster = get_app()->get_observer();
//turn allow_gid into allow_cid's
@ -1317,11 +1325,10 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
return $ret;
}
/**
* @brief Returns members of a group
* @brief Returns members of a group.
*
* @param $group_id
* @param int $group_id id of the group to look up
*/
function in_group($group_id) {
$group_members = array();