prepare for OS file storage, and add bbcode attachment link to mod/filestorage. This isn't beautiful, but it's a start.

This commit is contained in:
friendica
2014-01-06 18:13:02 -08:00
parent 41df51a815
commit 5a5466346c
5 changed files with 29 additions and 11 deletions

View File

@@ -188,13 +188,13 @@ function attach_by_hash($hash,$rev = 0) {
$sql_extra = permissions_sql($r[0]['uid']);
// Now we'll see if we can access the attachment
dbg(1);
$r = q("SELECT * FROM attach WHERE hash = '%s' and uid = %d $sql_extra LIMIT 1",
dbesc($hash),
intval($r[0]['uid'])
);
dbg(0);
if(! $r) {
$ret['message'] = t('Permission denied.');
return $ret;
@@ -672,3 +672,9 @@ function attach_change_permissions($channel_id,$resource,$allow_cid,$allow_gid,$
}
function pipe_streams($in, $out) {
$size = 0;
while (!feof($in))
$size += fwrite($out,fread($in,8192));
return $size;
}