From e10c237386c95a180a1b6951304b98ce1d953551 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 5 Jan 2014 18:44:32 -0800 Subject: make directory hierarchy work --- include/reddav.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'include/reddav.php') diff --git a/include/reddav.php b/include/reddav.php index b8604978f..fc4a53b17 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -184,12 +184,13 @@ class RedDirectory extends DAV\Node implements DAV\ICollection { dbg(1); - $r = q("INSERT INTO attach ( aid, uid, hash, filename, filetype, filesize, revision, data, created, edited, allow_cid, allow_gid, deny_cid, deny_gid ) - VALUES ( %d, %d, '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ", + $r = q("INSERT INTO attach ( aid, uid, hash, filename, folder, filetype, filesize, revision, data, created, edited, allow_cid, allow_gid, deny_cid, deny_gid ) + VALUES ( %d, %d, '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ", intval($c[0]['channel_account_id']), intval($c[0]['channel_id']), dbesc($hash), dbesc($name), + dbesc($this->folder_hash), dbesc($mimetype), intval($filesize), intval(0), @@ -264,8 +265,10 @@ dbg(0); function getDir() { logger('getDir: ' . $this->ext_path); + $file = $this->ext_path; - $x = strpos($this->ext_path,'/cloud'); + + $x = strpos($file,'/cloud'); if($x === false) return; if($x === 0) { @@ -282,6 +285,9 @@ dbg(0); if(! $path_arr) return; + + logger('getDir(): path: ' . print_r($path_arr,true)); + $channel_name = $path_arr[0]; $r = q("select channel_id from channel where channel_address = '%s' limit 1", @@ -300,8 +306,9 @@ dbg(0); for($x = 1; $x < count($path_arr); $x ++) { dbg(1); - $r = q("select id, hash, filename, flags from attach where folder = '%s' and (flags & %d)", + $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and (flags & %d)", dbesc($folder), + dbesc($path_arr[$x]), intval($channel_id), intval(ATTACH_FLAG_DIR) ); -- cgit v1.2.3