diff options
author | friendica <info@friendica.com> | 2014-01-09 21:01:53 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-01-09 21:01:53 -0800 |
commit | ee2bea37e9a46e8dcd6b7df655fc56c1feb8132e (patch) | |
tree | 45a5e250f06f1eda3c0249c1784754721fed81a0 /include | |
parent | a309bc0d478f5335853ed0cb7a0f0bfe41110643 (diff) | |
download | volse-hubzilla-ee2bea37e9a46e8dcd6b7df655fc56c1feb8132e.tar.gz volse-hubzilla-ee2bea37e9a46e8dcd6b7df655fc56c1feb8132e.tar.bz2 volse-hubzilla-ee2bea37e9a46e8dcd6b7df655fc56c1feb8132e.zip |
mod_filestorage: provide a URL for linking to webpages and other websites
Diffstat (limited to 'include')
-rw-r--r-- | include/attach.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/attach.php b/include/attach.php index 3524193a6..f14a2c61a 100644 --- a/include/attach.php +++ b/include/attach.php @@ -733,6 +733,51 @@ function attach_delete($channel_id,$resource) { +function get_cloudpath($arr) { + + $basepath = 'store/'; + if($arr['uid']) { + $r = q("select channel_address from channel where channel_id = %d limit 1", + intval($arr['uid']) + ); + if($r) + $basepath .= $r[0]['channel_address'] . '/'; + } + + + $path = $basepath; + + if($arr['folder']) { + + $lpath = ''; + $lfile = $arr['folder']; + + do { + $r = q("select filename, hash, flags, folder from attach where uid = %d and hash = '%s' and ( flags & %d ) + limit 1", + intval($arr['uid']), + dbesc($lfile), + intval(ATTACH_FLAG_DIR) + ); + + if(! $r) + break; + + if($lfile) + $lpath = $r[0]['filename'] . '/' . $lpath; + $lfile = $r[0]['folder']; + + } while ( ($r[0]['folder']) && ($r[0]['flags'] & ATTACH_FLAG_DIR)) ; + + $path .= $lpath; + + } + + $path .= $arr['filename']; + return $path; + +} + |