Commit 8a5cb18b authored by Mario's avatar Mario
Browse files

add missing file

parent 73488e21
<?php
namespace Zotlabs\Module;
/**
* @file Zotlabs/Module/Attach_edit.php
*
*/
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libsync;
use Zotlabs\Access\AccessList;
class Attach_edit extends Controller {
function post() {
if (! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
$attach_id = ((x($_POST, 'attach_id')) ? intval($_POST['attach_id']) : '');
$resource = ((x($_POST, 'resource')) ? notags($_POST['resource']) : '');
$folder = ((x($_POST, 'folder')) ? notags($_POST['folder']) : '');
$newfolder = ((x($_POST, 'newfolder_' . $attach_id)) ? notags($_POST['newfolder_' . $attach_id]) : '');
$filename = ((x($_POST, 'filename')) ? notags($_POST['filename']) : '');
$newfilename = ((x($_POST, 'newfilename_' . $attach_id)) ? notags($_POST['newfilename_' . $attach_id]) : '');
$recurse = ((x($_POST, 'recurse_' . $attach_id)) ? intval($_POST['recurse_' . $attach_id]) : 0);
$notify = ((x($_POST, 'notify_edit_' . $attach_id)) ? intval($_POST['notify_edit_' . $attach_id]) : 0);
$copy = ((x($_POST, 'copy_' . $attach_id)) ? intval($_POST['copy_' . $attach_id]) : 0);
$channel = App::get_channel();
if ($copy) {
attach_copy($channel['channel_id'], $resource, $newfolder, $newfilename);
}
elseif ($folder !== $newfolder || $filename !== $newfilename) {
attach_move($channel['channel_id'], $resource, $newfolder, $newfilename);
}
$acl = new AccessList($channel);
$acl->set_from_array($_POST);
$x = $acl->get();
$url = get_cloud_url($channel['channel_id'], $channel['channel_address'], $resource);
attach_change_permissions($channel['channel_id'], $resource, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], $recurse, true);
$sync = attach_export_data($channel, $resource, false);
if ($sync) {
Libsync::build_sync_packet($channel['channel_id'], ['file' => [$sync]]);
}
if ($notify) {
$observer = App::get_observer();
attach_store_item($channel, $observer, $resource);
}
goaway(dirname($url));
}
}
......@@ -732,33 +732,24 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
* @return array Directory[]
*/
function ChannelList(&$auth) {
$ret = [];
$sql_extra = '';
$restricted = false;
if (intval(get_config('system','cloud_disable_siteroot'))) {
if (! local_channel())
return $ret;
$restricted = true;
$sql_extra = sprintf(" and channel_id = %d ", intval(local_channel()));
return $ret;
}
$r = q("SELECT channel_id, channel_address, profile.publish FROM channel join profile on profile.uid = channel.channel_id WHERE profile.is_default = 1 and channel_removed = 0 AND channel_system = 0 AND (channel_pageflags & %d) = 0 $sql_extra",
$r = q("SELECT channel_id, channel_address, profile.publish FROM channel left join profile on profile.uid = channel.channel_id WHERE channel_removed = 0 AND channel_system = 0 AND (channel_pageflags & %d) = 0",
intval(PAGE_HIDDEN)
);
if ($r) {
foreach ($r as $rr) {
$publish = (($restricted) ? 1 : $rr['publish']);
if (perm_is_allowed($rr['channel_id'], $auth->observer, 'view_storage') && $publish) {
if (perm_is_allowed($rr['channel_id'], $auth->observer, 'view_storage') && $rr['publish']) {
logger('found channel: /cloud/' . $rr['channel_address'], LOGGER_DATA);
$ret[] = new Directory($rr['channel_address'], $auth);
}
}
}
return $ret;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment