aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-07-30 17:11:16 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-07-30 17:11:16 -0700
commitd5a40cac25e1bcc936a4010ec0038f8e5143c0a0 (patch)
treeb071675ce7137dd5fc74b4ee47776dad68424796
parentdf41ce9536ad72cdc2d1edb1983a48519223da77 (diff)
parent1097cd25830bc11d9aacf24f0e43322d6f397ca3 (diff)
downloadvolse-hubzilla-d5a40cac25e1bcc936a4010ec0038f8e5143c0a0.tar.gz
volse-hubzilla-d5a40cac25e1bcc936a4010ec0038f8e5143c0a0.tar.bz2
volse-hubzilla-d5a40cac25e1bcc936a4010ec0038f8e5143c0a0.zip
Merge branch 'master' of https://github.com/redmatrix/redmatrix
several dav fixes Conflicts: include/items.php
-rw-r--r--include/RedDAV/RedDirectory.php7
-rw-r--r--include/RedDAV/RedFile.php2
-rw-r--r--include/attach.php47
-rw-r--r--include/conversation.php2
-rw-r--r--include/event.php112
-rwxr-xr-xinclude/items.php1
-rw-r--r--include/reddav.php41
-rw-r--r--mod/filestorage.php6
-rw-r--r--version.inc2
9 files changed, 129 insertions, 91 deletions
diff --git a/include/RedDAV/RedDirectory.php b/include/RedDAV/RedDirectory.php
index 1f7ba8927..ee01d4a17 100644
--- a/include/RedDAV/RedDirectory.php
+++ b/include/RedDAV/RedDirectory.php
@@ -414,14 +414,13 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
$os_path = '';
for ($x = 1; $x < count($path_arr); $x++) {
- $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d)>0",
+ $r = q("select id, hash, filename, flags, is_dir from attach where folder = '%s' and filename = '%s' and uid = %d and is_dir != 0",
dbesc($folder),
dbesc($path_arr[$x]),
- intval($channel_id),
- intval(ATTACH_FLAG_DIR)
+ intval($channel_id)
);
- if ($r && ( $r[0]['flags'] & ATTACH_FLAG_DIR)) {
+ if ($r && intval($r[0]['is_dir'])) {
$folder = $r[0]['hash'];
if (strlen($os_path))
$os_path .= '/';
diff --git a/include/RedDAV/RedFile.php b/include/RedDAV/RedFile.php
index e4f9c21b9..b33b30832 100644
--- a/include/RedDAV/RedFile.php
+++ b/include/RedDAV/RedFile.php
@@ -300,7 +300,7 @@ class RedFile extends DAV\Node implements DAV\IFile {
}
if ($this->auth->owner_id !== $this->auth->channel_id) {
- if (($this->auth->observer !== $this->data['creator']) || ($this->data['flags'] & ATTACH_FLAG_DIR)) {
+ if (($this->auth->observer !== $this->data['creator']) || intval($this->data['is_dir'])) {
throw new DAV\Exception\Forbidden('Permission denied.');
}
}
diff --git a/include/attach.php b/include/attach.php
index e89ca7cb2..70c8f42f3 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -733,10 +733,9 @@ function z_readdir($channel_id, $observer_hash, $pathname, $parent_hash = '') {
if(count($paths) > 1) {
$curpath = array_shift($paths);
- $r = q("select hash, id from attach where uid = %d and filename = '%s' and (flags & %d )>0 " . permissions_sql($channel_id) . " limit 1",
+ $r = q("select hash, id, is_dir from attach where uid = %d and filename = '%s' and is_dir != 0 " . permissions_sql($channel_id) . " limit 1",
intval($channel_id),
- dbesc($curpath),
- intval(ATTACH_FLAG_DIR)
+ dbesc($curpath)
);
if(! $r) {
$ret['message'] = t('Path not available.');
@@ -749,11 +748,10 @@ function z_readdir($channel_id, $observer_hash, $pathname, $parent_hash = '') {
else
$paths = array($pathname);
- $r = q("select id, aid, uid, hash, creator, filename, filetype, filesize, revision, folder, is_photo, flags, created, edited, allow_cid, allow_gid, deny_cid, deny_gid from attach where id = %d and folder = '%s' and filename = '%s' and (flags & %d )>0 " . permissions_sql($channel_id),
+ $r = q("select id, aid, uid, hash, creator, filename, filetype, filesize, revision, folder, is_photo, is_dir, os_storage, flags, created, edited, allow_cid, allow_gid, deny_cid, deny_gid from attach where id = %d and folder = '%s' and filename = '%s' and is_dir != 0 " . permissions_sql($channel_id),
intval($channel_id),
dbesc($parent_hash),
- dbesc($paths[0]),
- intval(ATTACH_FLAG_DIR)
+ dbesc($paths[0])
);
if(! $r) {
$ret['message'] = t('Path not available.');
@@ -839,11 +837,10 @@ function attach_mkdir($channel, $observer_hash, $arr = null) {
$sql_options = permissions_sql($channel['channel_id']);
do {
- $r = q("select filename, hash, flags, folder from attach where uid = %d and hash = '%s' and ( flags & %d )>0
+ $r = q("select filename, hash, flags, is_dir, folder from attach where uid = %d and hash = '%s' and is_dir != 0
$sql_options limit 1",
intval($channel['channel_id']),
- dbesc($lfile),
- intval(ATTACH_FLAG_DIR)
+ dbesc($lfile)
);
if(! $r) {
@@ -854,7 +851,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null) {
if($lfile)
$lpath = $r[0]['hash'] . '/' . $lpath;
$lfile = $r[0]['folder'];
- } while ( ($r[0]['folder']) && ($r[0]['flags'] & ATTACH_FLAG_DIR)) ;
+ } while ( ($r[0]['folder']) && intval($r[0]['is_dir'])) ;
$path = $basepath . '/' . $lpath;
}
else
@@ -864,7 +861,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null) {
$created = datetime_convert();
- $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, filetype, filesize, revision, folder, os_storage, flags, data, created, edited, allow_cid, allow_gid, deny_cid, deny_gid )
+ $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, filetype, filesize, revision, folder, os_storage, is_dir, data, created, edited, allow_cid, allow_gid, deny_cid, deny_gid )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($channel['channel_account_id']),
intval($channel_id),
@@ -876,7 +873,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null) {
intval(0),
dbesc($arr['folder']),
intval(1),
- intval(ATTACH_FLAG_DIR),
+ intval(1),
dbesc($path),
dbesc($created),
dbesc($created),
@@ -1012,7 +1009,7 @@ function attach_mkdirp($channel, $observer_hash, $arr = null) {
*/
function attach_change_permissions($channel_id, $resource, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $recurse = false) {
- $r = q("select hash, flags from attach where hash = '%s' and uid = %d limit 1",
+ $r = q("select hash, flags, is_dir from attach where hash = '%s' and uid = %d limit 1",
dbesc($resource),
intval($channel_id)
);
@@ -1020,9 +1017,9 @@ function attach_change_permissions($channel_id, $resource, $allow_cid, $allow_gi
if(! $r)
return;
- if($r[0]['flags'] & ATTACH_FLAG_DIR) {
+ if(intval($r[0]['is_dir'])) {
if($recurse) {
- $r = q("select hash, flags from attach where folder = '%s' and uid = %d",
+ $r = q("select hash, flags, is_dir from attach where folder = '%s' and uid = %d",
dbesc($resource),
intval($channel_id)
);
@@ -1065,7 +1062,7 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
$channel_address = (($c) ? $c[0]['channel_address'] : 'notfound');
$photo_sql = (($is_photo) ? " and is_photo = 1 " : '');
- $r = q("SELECT hash, flags, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1",
+ $r = q("SELECT hash, flags, is_dir, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1",
dbesc($resource),
intval($channel_id)
);
@@ -1077,8 +1074,8 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
$object = get_file_activity_object($channel_id, $resource, $cloudpath);
// If resource is a directory delete everything in the directory recursive
- if($r[0]['flags'] & ATTACH_FLAG_DIR) {
- $x = q("SELECT hash, os_storage, flags FROM attach WHERE folder = '%s' AND uid = %d",
+ if(intval($r[0]['is_dir'])) {
+ $x = q("SELECT hash, os_storage, is_dir, flags FROM attach WHERE folder = '%s' AND uid = %d",
dbesc($resource),
intval($channel_id)
);
@@ -1152,11 +1149,10 @@ function get_cloudpath($arr) {
$lfile = $arr['folder'];
do {
- $r = q("select filename, hash, flags, folder from attach where uid = %d and hash = '%s' and ( flags & %d )>0
+ $r = q("select filename, hash, flags, is_dir, folder from attach where uid = %d and hash = '%s' and is_dir != 0
limit 1",
intval($arr['uid']),
- dbesc($lfile),
- intval(ATTACH_FLAG_DIR)
+ dbesc($lfile)
);
if(! $r)
@@ -1166,7 +1162,7 @@ function get_cloudpath($arr) {
$lpath = $r[0]['filename'] . '/' . $lpath;
$lfile = $r[0]['folder'];
- } while ( ($r[0]['folder']) && ($r[0]['flags'] & ATTACH_FLAG_DIR));
+ } while ( ($r[0]['folder']) && intval($r[0]['is_dir']));
$path .= $lpath;
}
@@ -1295,7 +1291,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
//filter out receivers which do not have permission to view filestorage
$arr_allow_cid = check_list_permissions($channel_id, $arr_allow_cid, 'view_storage');
- $is_dir = (($object['flags'] & ATTACH_FLAG_DIR) ? true : false);
+ $is_dir = (intval($object['is_dir']) ? true : false);
//do not send activity for folders for now
if($is_dir)
@@ -1451,7 +1447,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
*/
function get_file_activity_object($channel_id, $hash, $cloudpath) {
- $x = q("SELECT creator, filename, filetype, filesize, revision, folder, os_storage, is_photo, flags, created, edited, allow_cid, allow_gid, deny_cid, deny_gid FROM attach WHERE uid = %d AND hash = '%s' LIMIT 1",
+ $x = q("SELECT creator, filename, filetype, filesize, revision, folder, os_storage, is_photo, is_dir, flags, created, edited, allow_cid, allow_gid, deny_cid, deny_gid FROM attach WHERE uid = %d AND hash = '%s' LIMIT 1",
intval($channel_id),
dbesc($hash)
);
@@ -1479,8 +1475,9 @@ function get_file_activity_object($channel_id, $hash, $cloudpath) {
'revision' => $x[0]['revision'],
'folder' => $x[0]['folder'],
'flags' => $x[0]['flags'],
- 'flags' => $x[0]['os_storage'],
+ 'os_storage' => $x[0]['os_storage'],
'is_photo' => $x[0]['is_photo'],
+ 'is_dir' => $x[0]['is_dir'],
'created' => $x[0]['created'],
'edited' => $x[0]['edited'],
'allow_cid' => $x[0]['allow_cid'],
diff --git a/include/conversation.php b/include/conversation.php
index d14d7ba84..645994035 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -588,7 +588,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
if($arr_blocked) {
$blocked = false;
foreach($arr_blocked as $b) {
- if(($b) && ($item['author_xchan'] == $b)) {
+ if(($b) && (($item['author_xchan'] == $b) || ($item['owner_xchan'] == $b))) {
$blocked = true;
break;
}
diff --git a/include/event.php b/include/event.php
index 659b7e6cc..2796ea712 100644
--- a/include/event.php
+++ b/include/event.php
@@ -1,4 +1,6 @@
<?php
+use Sabre\VObject;
+
/**
* @file include/event.php
*/
@@ -281,7 +283,7 @@ function event_store_event($arr) {
if(array_key_exists('external_id',$arr))
$hash = $arr['external_id'];
else
- $hash = random_string();
+ $hash = random_string() . '@' . get_app()->get_hostname();
$r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary,description,location,type,
adjust,nofinish,allow_cid,allow_gid,deny_cid,deny_gid)
@@ -371,18 +373,30 @@ function event_addtocal($item_id, $uid) {
function parse_ical_file($f,$uid) {
- require_once('library/ical.php');
- $ical = new ICal($f);
+require_once('vendor/autoload.php');
+
+ $s = @file_get_contents($f);
+
+ // Change the current timezone to something besides UTC.
+ // Doesn't matter what it is, as long as it isn't UTC.
+ // Save the current timezone so we can reset it when we're done processing.
+
+ $saved_timezone = date_default_timezone_get();
+ date_default_timezone_set('Australia/Sydney');
+
+ $ical = VObject\Reader::read($s);
+
if($ical) {
- $events = $ical->events();
- if($events) {
- foreach($events as $ev) {
- logger('event parsed: ' . print_r($ev,true), LOGGER_ALL);
- event_import_ical($ev,$uid);
- }
+ foreach($ical->VEVENT as $event) {
+ event_import_ical($event,$uid);
+
}
- return true;
}
+
+ date_default_timezone_set($saved_timezone);
+
+ if($ical)
+ return true;
return false;
}
@@ -400,42 +414,76 @@ function event_import_ical($ical, $uid) {
$channel = $c[0];
$ev = array();
- if($ical['CREATED'])
- $ev['created'] = datetime_convert('UTC','UTC',$ical['CREATED']);
- if($ical['LAST-MODIFIED'])
- $ev['edited'] = datetime_convert('UTC','UTC',$ical['LAST-MODIFIED']);
- if($ical['LOCATION'])
- $ev['location'] = $ical['LOCATION'];
- if($ical['DESCRIPTION'])
- $ev['description'] = $ical['DESCRIPTION'];
- if($ical['SUMMARY'])
- $ev['summary'] = $ical['SUMMARY'];
- if($ical['DTEND'])
- $ev['finish'] = datetime_convert('UTC','UTC', $ical['DTEND']);
+
+ if(! isset($ical->DTSTART)) {
+ logger('no event start');
+ return false;
+ }
+
+ $dtstart = $ical->DTSTART->getDateTime();
+
+// logger('dtstart: ' . var_export($dtstart,true));
+
+ if(($dtstart->timezone_type == 2) || (($dtstart->timezone_type == 3) && ($dtstart->timezone === 'UTC'))) {
+ $ev['adjust'] = 1;
+ }
+ else {
+ $ev['adjust'] = 0;
+ }
+
+ $ev['start'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
+ $dtstart->format(\DateTime::W3C));
+
+
+ if(isset($ical->DTEND)) {
+ $dtend = $ical->DTEND->getDateTime();
+ $ev['finish'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC',
+ $dtend->format(\DateTime::W3C));
+ }
else
$ev['nofinish'] = 1;
- $ev['start'] = datetime_convert('UTC','UTC',$ical['DTSTART']);
- if(substr($ical['DTSTART'],-1) === 'Z')
- $ev['adjust'] = 1;
- if($ical['UID']) {
+
+ if($ev['start'] === $ev['finish'])
+ $ev['nofinish'] = 1;
+
+ if(isset($ical->CREATED)) {
+ $created = $ical->CREATED->getDateTime();
+ $ev['created'] = datetime_convert('UTC','UTC',$created->format(\DateTime::W3C));
+ }
+
+ if(isset($ical->{'LAST-MODIFIED'})) {
+ $edited = $ical->{'LAST-MODIFIED'}->getDateTime();
+ $ev['edited'] = datetime_convert('UTC','UTC',$edited->format(\DateTime::W3C));
+ }
+
+ if(isset($ical->LOCATION))
+ $ev['location'] = (string) $ical->LOCATION;
+ if(isset($ical->DESCRIPTION))
+ $ev['description'] = (string) $ical->DESCRIPTION;
+ if(isset($ical->SUMMARY))
+ $ev['summary'] = (string) $ical->SUMMARY;
+
+ if(isset($ical->UID)) {
+ $evuid = (string) $ical->UID;
$r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1",
- dbesc($ical['UID']),
- intval($arr['uid'])
+ dbesc($evuid),
+ intval($uid)
);
if($r)
- $ev['event_hash'] = $ical['UID'];
+ $ev['event_hash'] = $evuid;
else
- $ev['external_id'] = $ical['UID'];
+ $ev['external_id'] = $evuid;
}
- if($ical['SUMMARY'] && $ical['DTSTART']) {
+ if($ev['summary'] && $ev['start']) {
$ev['event_xchan'] = $channel['channel_hash'];
$ev['uid'] = $channel['channel_id'];
$ev['account'] = $channel['channel_account_id'];
$ev['private'] = 1;
+ $ev['allow_cid'] = '<' . $channel['channel_hash'] . '>';
- logger('storing event: ' . print_r($ev,true), LOGGER_ALL);
+// logger('storing event: ' . print_r($ev,true), LOGGER_ALL);
$event = event_store_event($ev);
if($event) {
$item_id = event_store_item($ev,$event);
diff --git a/include/items.php b/include/items.php
index 7ac5591f8..755ea0767 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3768,7 +3768,6 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
if(! post_is_importable($datarray,$contact))
continue;
-
logger('consume_feed: author ' . print_r($author,true),LOGGER_DEBUG);
logger('consume_feed: ' . print_r($datarray,true),LOGGER_DATA);
diff --git a/include/reddav.php b/include/reddav.php
index 5ecb10fb4..76b475ffd 100644
--- a/include/reddav.php
+++ b/include/reddav.php
@@ -114,20 +114,18 @@ function RedCollectionData($file, &$auth) {
$permission_error = false;
for ($x = 1; $x < count($path_arr); $x++) {
- $r = q("SELECT id, hash, filename, flags FROM attach WHERE folder = '%s' AND filename = '%s' AND uid = %d AND (flags & %d)>0 $perms LIMIT 1",
+ $r = q("SELECT id, hash, filename, flags, is_dir FROM attach WHERE folder = '%s' AND filename = '%s' AND uid = %d AND is_dir != 0 $perms LIMIT 1",
dbesc($folder),
dbesc($path_arr[$x]),
- intval($channel_id),
- intval(ATTACH_FLAG_DIR)
+ intval($channel_id)
);
if (! $r) {
// path wasn't found. Try without permissions to see if it was the result of permissions.
$errors = true;
- $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d)>0 limit 1",
+ $r = q("select id, hash, filename, flags, is_dir from attach where folder = '%s' and filename = '%s' and uid = %d and is_dir != 0 limit 1",
dbesc($folder),
basename($path_arr[$x]),
- intval($channel_id),
- intval(ATTACH_FLAG_DIR)
+ intval($channel_id)
);
if ($r) {
$permission_error = true;
@@ -135,7 +133,7 @@ function RedCollectionData($file, &$auth) {
break;
}
- if ($r && ($r[0]['flags'] & ATTACH_FLAG_DIR)) {
+ if ($r && intval($r[0]['is_dir'])) {
$folder = $r[0]['hash'];
$path = $path . '/' . $r[0]['filename'];
}
@@ -161,18 +159,17 @@ function RedCollectionData($file, &$auth) {
$prefix = '';
$suffix = 'GROUP BY filename';
}
- $r = q("select $prefix id, uid, hash, filename, filetype, filesize, revision, folder, flags, created, edited from attach where folder = '%s' and uid = %d $perms $suffix",
+ $r = q("select $prefix id, uid, hash, filename, filetype, filesize, revision, folder, flags, is_dir, created, edited from attach where folder = '%s' and uid = %d $perms $suffix",
dbesc($folder),
intval($channel_id)
);
foreach ($r as $rr) {
//logger('filename: ' . $rr['filename'], LOGGER_DEBUG);
- if ($rr['flags'] & ATTACH_FLAG_DIR) {
- // @todo can't we drop '/cloud'? it gets stripped off anyway in RedDirectory
- $ret[] = new RedDAV\RedDirectory('/cloud' . $path . '/' . $rr['filename'], $auth);
+ if (intval($rr['is_dir'])) {
+ $ret[] = new RedDAV\RedDirectory($path . '/' . $rr['filename'], $auth);
} else {
- $ret[] = new RedDAV\RedFile('/cloud' . $path . '/' . $rr['filename'], $rr, $auth);
+ $ret[] = new RedDAV\RedFile($path . '/' . $rr['filename'], $rr, $auth);
}
}
@@ -236,19 +233,18 @@ function RedFileData($file, &$auth, $test = false) {
$errors = false;
for ($x = 1; $x < count($path_arr); $x++) {
- $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d)>0 $perms",
+ $r = q("select id, hash, filename, flags, is_dir from attach where folder = '%s' and filename = '%s' and uid = %d and is_dir != 0 $perms",
dbesc($folder),
dbesc($path_arr[$x]),
- intval($channel_id),
- intval(ATTACH_FLAG_DIR)
+ intval($channel_id)
);
- if ($r && ( $r[0]['flags'] & ATTACH_FLAG_DIR)) {
+ if ($r && intval($r[0]['is_dir'])) {
$folder = $r[0]['hash'];
$path = $path . '/' . $r[0]['filename'];
}
if (! $r) {
- $r = q("select id, uid, hash, filename, filetype, filesize, revision, folder, flags, created, edited from attach
+ $r = q("select id, uid, hash, filename, filetype, filesize, revision, folder, flags, is_dir, created, edited from attach
where folder = '%s' and filename = '%s' and uid = %d $perms order by filename limit 1",
dbesc($folder),
dbesc(basename($file)),
@@ -257,7 +253,7 @@ function RedFileData($file, &$auth, $test = false) {
}
if (! $r) {
$errors = true;
- $r = q("select id, uid, hash, filename, filetype, filesize, revision, folder, flags, created, edited from attach
+ $r = q("select id, uid, hash, filename, filetype, filesize, revision, folder, flags, is_dir, created, edited from attach
where folder = '%s' and filename = '%s' and uid = %d order by filename limit 1",
dbesc($folder),
dbesc(basename($file)),
@@ -272,7 +268,7 @@ function RedFileData($file, &$auth, $test = false) {
if ($test)
return true;
// final component was a directory.
- return new RedDAV\RedDirectory('/cloud/' . $file, $auth);
+ return new RedDAV\RedDirectory($file, $auth);
}
if ($errors) {
@@ -290,11 +286,10 @@ function RedFileData($file, &$auth, $test = false) {
if ($test)
return true;
- if ($r[0]['flags'] & ATTACH_FLAG_DIR) {
- // @todo can't we drop '/cloud'? it gets stripped off anyway in RedDirectory
- return new RedDAV\RedDirectory('/cloud' . $path . '/' . $r[0]['filename'], $auth);
+ if (intval($r[0]['is_dir'])) {
+ return new RedDAV\RedDirectory($path . '/' . $r[0]['filename'], $auth);
} else {
- return new RedDAV\RedFile('/cloud' . $path . '/' . $r[0]['filename'], $r[0], $auth);
+ return new RedDAV\RedFile($path . '/' . $r[0]['filename'], $r[0], $auth);
}
}
return false;
diff --git a/mod/filestorage.php b/mod/filestorage.php
index 8b52c086b..9787c0380 100644
--- a/mod/filestorage.php
+++ b/mod/filestorage.php
@@ -117,7 +117,7 @@ function filestorage_content(&$a) {
}
$file = intval(argv(2));
- $r = q("select id, uid, folder, filename, revision, flags, hash, allow_cid, allow_gid, deny_cid, deny_gid from attach where id = %d and uid = %d limit 1",
+ $r = q("select id, uid, folder, filename, revision, flags, is_dir, os_storage, hash, allow_cid, allow_gid, deny_cid, deny_gid from attach where id = %d and uid = %d limit 1",
intval($file),
intval($owner)
);
@@ -125,11 +125,11 @@ function filestorage_content(&$a) {
$f = $r[0];
$channel = $a->get_channel();
- $cloudpath = get_cloudpath($f) . (($f['flags'] & ATTACH_FLAG_DIR) ? '?f=&davguest=1' : '');
+ $cloudpath = get_cloudpath($f) . (intval($f['is_dir']) ? '?f=&davguest=1' : '');
$parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']);
$aclselect_e = populate_acl($f, false);
- $is_a_dir = (($f['flags'] & ATTACH_FLAG_DIR) ? true : false);
+ $is_a_dir = (intval($f['is_dir']) ? true : false);
$lockstate = (($f['allow_cid'] || $f['allow_gid'] || $f['deny_cid'] || $f['deny_gid']) ? 'lock' : 'unlock');
diff --git a/version.inc b/version.inc
index 928fb3ee9..3a20d2696 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-07-27.1106
+2015-07-29.1108