diff options
author | redmatrix <mike@macgirvin.com> | 2016-09-22 16:58:29 -0700 |
---|---|---|
committer | redmatrix <mike@macgirvin.com> | 2016-09-22 16:58:29 -0700 |
commit | 9981cbb72c223873987b75e890a3e6297e5983dc (patch) | |
tree | ce629efae777f7677e7941017454b37377e61369 /include/attach.php | |
parent | be6c4019f6f6cbc76e06a88401dca95bc158a825 (diff) | |
download | volse-hubzilla-9981cbb72c223873987b75e890a3e6297e5983dc.tar.gz volse-hubzilla-9981cbb72c223873987b75e890a3e6297e5983dc.tar.bz2 volse-hubzilla-9981cbb72c223873987b75e890a3e6297e5983dc.zip |
issue #519 continued
Diffstat (limited to 'include/attach.php')
-rw-r--r-- | include/attach.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/attach.php b/include/attach.php index 237b06217..9d993a330 100644 --- a/include/attach.php +++ b/include/attach.php @@ -709,6 +709,9 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $os_relpath .= $hash; + // not yet used + $os_path = ''; + if($src) @file_put_contents($os_basepath . $os_relpath,@file_get_contents($src)); @@ -723,7 +726,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $edited = $created; if($options === 'replace') { - $r = q("update attach set filename = '%s', filetype = '%s', folder = '%s', filesize = %d, os_storage = %d, is_photo = %d, content = '%s', edited = '%s' where id = %d and uid = %d", + $r = q("update attach set filename = '%s', filetype = '%s', folder = '%s', filesize = %d, os_storage = %d, is_photo = %d, content = '%s', edited = '%s', os_path = '%s' where id = %d and uid = %d", dbesc($filename), dbesc($mimetype), dbesc($folder_hash), @@ -732,13 +735,14 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { intval($is_photo), dbesc($os_basepath . $os_relpath), dbesc($created), + dbesc($os_path), intval($existing_id), intval($channel_id) ); } elseif($options === 'revise') { - $r = q("insert into attach ( aid, uid, hash, creator, filename, filetype, folder, filesize, revision, os_storage, is_photo, content, created, edited, allow_cid, allow_gid, deny_cid, deny_gid ) - VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ", + $r = q("insert into attach ( aid, uid, hash, creator, filename, filetype, folder, filesize, revision, os_storage, is_photo, content, created, edited, os_path, allow_cid, allow_gid, deny_cid, deny_gid ) + VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ", intval($x[0]['aid']), intval($channel_id), dbesc($x[0]['hash']), @@ -753,6 +757,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { dbesc($os_basepath . $os_relpath), dbesc($created), dbesc($created), + dbesc($os_path), dbesc($x[0]['allow_cid']), dbesc($x[0]['allow_gid']), dbesc($x[0]['deny_cid']), @@ -760,7 +765,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { ); } elseif($options === 'update') { - $r = q("update attach set filename = '%s', filetype = '%s', folder = '%s', edited = '%s', os_storage = %d, is_photo = %d, + $r = q("update attach set filename = '%s', filetype = '%s', folder = '%s', edited = '%s', os_storage = %d, is_photo = %d, os_path = '%s', allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s' where id = %d and uid = %d", dbesc((array_key_exists('filename',$arr)) ? $arr['filename'] : $x[0]['filename']), dbesc((array_key_exists('filetype',$arr)) ? $arr['filetype'] : $x[0]['filetype']), @@ -768,6 +773,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { dbesc($created), dbesc((array_key_exists('os_storage',$arr)) ? $arr['os_storage'] : $x[0]['os_storage']), dbesc((array_key_exists('is_photo',$arr)) ? $arr['is_photo'] : $x[0]['is_photo']), + dbesc((array_key_exists('os_path',$arr)) ? $arr['os_path'] : $x[0]['os_path']), dbesc((array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : $x[0]['allow_cid']), dbesc((array_key_exists('allow_gid',$arr)) ? $arr['allow_gid'] : $x[0]['allow_gid']), dbesc((array_key_exists('deny_cid',$arr)) ? $arr['deny_cid'] : $x[0]['deny_cid']), @@ -778,7 +784,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { } else { - $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, filetype, folder, filesize, revision, os_storage, is_photo, content, created, edited, allow_cid, allow_gid,deny_cid, deny_gid ) + $r = q("INSERT INTO attach ( aid, uid, hash, creator, filename, filetype, folder, filesize, revision, os_storage, is_photo, content, created, edited, os_path, allow_cid, allow_gid,deny_cid, deny_gid ) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ", intval($channel['channel_account_id']), intval($channel_id), @@ -794,6 +800,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { dbesc($os_basepath . $os_relpath), dbesc($created), dbesc($created), + dbesc($os_path), dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : $str_contact_allow), dbesc(($arr && array_key_exists('allow_gid',$arr)) ? $arr['allow_gid'] : $str_group_allow), dbesc(($arr && array_key_exists('deny_cid',$arr)) ? $arr['deny_cid'] : $str_contact_deny), |