Merge pull request #346 from solstag/fixattachperms
correctly fix attachment permissions from private mentions
This commit is contained in:
commit
52ddbd1add
44
mod/item.php
44
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
|
// BBCODE end alert
|
||||||
|
Reference in New Issue
Block a user