aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/File_upload.php38
-rw-r--r--Zotlabs/Storage/Browser.php21
2 files changed, 58 insertions, 1 deletions
diff --git a/Zotlabs/Module/File_upload.php b/Zotlabs/Module/File_upload.php
new file mode 100644
index 000000000..45f820b7c
--- /dev/null
+++ b/Zotlabs/Module/File_upload.php
@@ -0,0 +1,38 @@
+<?php
+namespace Zotlabs\Module;
+
+require_once('include/attach.php');
+require_once('include/channel.php');
+require_once('include/photos.php');
+
+
+class File_upload extends \Zotlabs\Web\Controller {
+
+ function post() {
+
+ $channel = (($_REQUEST['channick']) ? get_channel_by_nick($_REQUEST['channick']) : null);
+
+ if(! $channel) {
+ logger('channel not found');
+ killme();
+ }
+
+ $_REQUEST['source'] = 'file_upload';
+
+ if($channel['channel_id'] != local_channel()) {
+ $_REQUEST['contact_allow'] = expand_acl($channel['channel_allow_cid']);
+ $_REQUEST['group_allow'] = expand_acl($channel['channel_allow_gid']);
+ $_REQUEST['contact_deny'] = expand_acl($channel['channel_deny_cid']);
+ $_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']);
+ }
+
+ if($_REQUEST['directory_name'])
+ $r = attach_mkdir($channel,get_observer_hash(),$_REQUEST);
+ else
+ $r = attach_store($channel,get_observer_hash(), '', $_REQUEST);
+
+ goaway(z_root() . '/' . $_REQUEST['return_url']);
+
+ }
+
+}
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index e719530b5..93c55bd4c 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -274,6 +274,22 @@ class Browser extends DAV\Browser\Plugin {
// SimpleCollection, we won't need to show the panel either.
if (get_class($node) === 'Sabre\\DAV\\SimpleCollection')
return;
+ require_once('include/acl_selectors.php');
+
+ $aclselect = null;
+ $lockstate = '';
+
+ if($this->auth-owner_id) {
+ $channel = channelx_by_n($this->auth->owner_id);
+ if($channel) {
+ $acl = new \Zotlabs\Access\AccessList($channel);
+ $channel_acl = $acl->get();
+ $lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
+
+ $aclselect = ((local_channel() == $this->auth->owner_id) ? populate_acl($channel_acl,false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_storage')) : '');
+
+ }
+ }
// Storage and quota for the account (all channels of the owner of this directory)!
$limit = engr_units_to_bytes(service_class_fetch($owner, 'attach_upload_limit'));
@@ -293,7 +309,6 @@ class Browser extends DAV\Browser\Plugin {
userReadableSize($limit),
round($used / $limit, 1) * 100);
}
-
// prepare quota for template
$quota = array();
$quota['used'] = $used;
@@ -307,6 +322,10 @@ class Browser extends DAV\Browser\Plugin {
'$upload_header' => t('Upload file'),
'$upload_submit' => t('Upload'),
'$quota' => $quota,
+ '$channick' => $this->auth->owner_nick,
+ '$aclselect' => $aclselect,
+ '$lockstate' => $lockstate,
+ '$return_url' => \App::$cmd,
'$dragdroptext' => t('Drop files here to immediately upload')
));
}