diff options
author | friendica <info@friendica.com> | 2014-01-11 12:58:00 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-01-11 12:58:00 -0800 |
commit | cff7056f8ff809251448de269bbc5e13780f35de (patch) | |
tree | 75886f1e6f00138b5839acca2f0c9fe375c64420 | |
parent | f125be846c4e0b68bf687eecf12e64512dd40df0 (diff) | |
download | volse-hubzilla-cff7056f8ff809251448de269bbc5e13780f35de.tar.gz volse-hubzilla-cff7056f8ff809251448de269bbc5e13780f35de.tar.bz2 volse-hubzilla-cff7056f8ff809251448de269bbc5e13780f35de.zip |
mod_attach: output stream wasn't working
-rw-r--r-- | include/attach.php | 3 | ||||
-rw-r--r-- | include/reddav.php | 2 | ||||
-rw-r--r-- | include/security.php | 3 | ||||
-rw-r--r-- | mod/attach.php | 10 | ||||
-rw-r--r-- | version.inc | 2 |
5 files changed, 14 insertions, 6 deletions
diff --git a/include/attach.php b/include/attach.php index a621d2fc4..dbc489a2d 100644 --- a/include/attach.php +++ b/include/attach.php @@ -329,6 +329,7 @@ function attach_store($channel,$observer_hash,$options = '',$arr = null) { } $limit = service_class_fetch($channel_id,'attach_upload_limit'); + if($limit !== false) { $r = q("select sum(filesize) as total from attach where aid = %d ", intval($channel['channel_account_id']) @@ -623,7 +624,7 @@ function attach_mkdir($channel,$observer_hash,$arr = null) { ); if($r) { - if(mkdir($path,STORAGE_DEFAULT_PERMISSIONS)) { + if(mkdir($path,STORAGE_DEFAULT_PERMISSIONS,true)) { $ret['success'] = true; $ret['data'] = $arr; } diff --git a/include/reddav.php b/include/reddav.php index d80bcedde..d00980011 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -163,6 +163,7 @@ class RedDirectory extends DAV\Node implements DAV\ICollection { intval($c[0]['channel_account_id']) ); if(($x) && ($x[0]['total'] + $size > $limit)) { + logger('reddav: service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . $limit); attach_delete($c[0]['channel_id'],$hash); return; } @@ -372,6 +373,7 @@ class RedFile extends DAV\Node implements DAV\IFile { intval($c[0]['channel_account_id']) ); if(($x) && ($x[0]['total'] + $size > $limit)) { + logger('reddav: service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . $limit); attach_delete($c[0]['channel_id'],$this->data['hash']); return; } diff --git a/include/security.php b/include/security.php index 138efe3ab..a87442d42 100644 --- a/include/security.php +++ b/include/security.php @@ -163,6 +163,9 @@ function change_channel($change_channel) { get_app()->set_observer($x[0]); get_app()->set_perms(get_all_perms(local_user(),$hash)); } + if(! is_dir('store/' . $r[0]['channel_address'])) + @mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS,true); + } return $ret; diff --git a/mod/attach.php b/mod/attach.php index 7371f0367..c52966ce0 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -27,10 +27,12 @@ function attach_init(&$a) { header('Content-type: ' . $r['data']['filetype']); header('Content-disposition: attachment; filename=' . $r['data']['filename']); if($r['data']['flags'] & ATTACH_FLAG_OS ) { - $stream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb'); - if($stream) { - pipe_stream($stream,STDOUT); - fclose($stream); + $istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb'); + $ostream = fopen('php://output','wb'); + if($istream && $ostream) { + pipe_streams($istream,$ostream); + fclose($istream); + fclose($ostream); } } else diff --git a/version.inc b/version.inc index bc73672b3..6f37c44ab 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-01-10.553 +2014-01-11.554 |