From 8dc22c564aee0a6edf590a9a47021ea1ceb4aecf Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 6 Jan 2014 16:49:07 -0800 Subject: provide ability to change attachment/file permissions --- mod/filestorage.php | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/filestorage.php b/mod/filestorage.php index 3d63e6da3..152b449c2 100644 --- a/mod/filestorage.php +++ b/mod/filestorage.php @@ -1,5 +1,37 @@ 1) @@ -40,7 +72,7 @@ function filestorage_content(&$a) { if(argc() > 3 && argv(3) === 'delete') { if(! $perms['write_storage']) { - notice( t('Permission denied. VS.') . EOL); + notice( t('Permission denied.') . EOL); return; } @@ -53,6 +85,45 @@ function filestorage_content(&$a) { } + if(argc() > 3 && argv(3) === 'edit') { + require_once('include/acl_selectors.php'); + if(! $perms['write_storage']) { + notice( t('Permission denied.') . EOL); + return; + } + $file = intval(argv(2)); + + $r = q("select id, folder, filename, flags, hash, allow_cid, allow_gid, deny_cid, deny_gid from attach where id = %d and uid = %d limit 1", + intval($file), + intval($owner) + ); + + $f = $r[0]; + + $channel = $a->get_channel(); + + + $aclselect_e = populate_acl($f); + $is_a_dir = (($f['flags'] & ATTACH_FLAG_DIR) ? true : false); + + + $o = replace_macros(get_markup_template('attach_edit.tpl'), array( + '$header' => t('Edit file permissions'), + '$file' => $f, + '$uid' => $channel['channel_id'], + '$channelnick' => $channel['channel_address'], + '$permissions' => t('Permissions'), + '$aclselect' => $aclselect_e, + '$recurse' => t('Include all files and sub folders'), + '$backlink' => t('Return to file list'), + '$isadir' => $is_a_dir, + '$submit' => t('Submit') + + )); + + return $o; + } + $r = q("select * from attach where uid = %d order by edited desc", intval($owner) ); @@ -83,6 +154,7 @@ function filestorage_content(&$a) { '$download' => t('Download'), '$files' => $files, '$channel' => $which, + '$edit' => t('Edit Permissions'), '$delete' => t('Delete'), '$used' => $used, '$usedlabel' => t('Used: '), -- cgit v1.2.3