aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-11 06:27:24 +1000
committerredmatrix <redmatrix@redmatrix.me>2015-06-11 06:27:24 +1000
commit52ddbd1adda88690a19aafc35e455b01d059852f (patch)
tree5c036830ea1c94fd24094ad7135d6adb17c28495 /mod/item.php
parentedd2d1e8d47be1ef4fe38edf624335472a2e73bd (diff)
parenta31fdd3fbb0d068f91cc56daa052282f91adf2a2 (diff)
downloadvolse-hubzilla-52ddbd1adda88690a19aafc35e455b01d059852f.tar.gz
volse-hubzilla-52ddbd1adda88690a19aafc35e455b01d059852f.tar.bz2
volse-hubzilla-52ddbd1adda88690a19aafc35e455b01d059852f.zip
Merge pull request #346 from solstag/fixattachperms
correctly fix attachment permissions from private mentions
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php44
1 files changed, 23 insertions, 21 deletions
diff --git a/mod/item.php b/mod/item.php
index a9c6ea65b..3ff286268 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -586,27 +586,6 @@ function item_post(&$a) {
}
}
- $attachments = '';
- $match = false;
-
- if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
- $attachments = array();
- foreach($match[2] as $mtch) {
- $hash = substr($mtch,0,strpos($mtch,','));
- $rev = intval(substr($mtch,strpos($mtch,',')));
- $r = attach_by_hash_nodata($hash,$rev);
- if($r['success']) {
- $attachments[] = array(
- 'href' => $a->get_baseurl() . '/attach/' . $r['data']['hash'],
- 'length' => $r['data']['filesize'],
- 'type' => $r['data']['filetype'],
- 'title' => urlencode($r['data']['filename']),
- 'revision' => $r['data']['revision']
- );
- }
- $body = str_replace($match[1],'',$body);
- }
- }
/**
*
@@ -643,6 +622,29 @@ function item_post(&$a) {
}
+
+ $attachments = '';
+ $match = false;
+
+ if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) {
+ $attachments = array();
+ foreach($match[2] as $mtch) {
+ $hash = substr($mtch,0,strpos($mtch,','));
+ $rev = intval(substr($mtch,strpos($mtch,',')));
+ $r = attach_by_hash_nodata($hash,$rev);
+ if($r['success']) {
+ $attachments[] = array(
+ 'href' => $a->get_baseurl() . '/attach/' . $r['data']['hash'],
+ 'length' => $r['data']['filesize'],
+ 'type' => $r['data']['filetype'],
+ 'title' => urlencode($r['data']['filename']),
+ 'revision' => $r['data']['revision']
+ );
+ }
+ $body = str_replace($match[1],'',$body);
+ }
+ }
+
}
// BBCODE end alert