file clone sync issue, 1. channel permission import had no uid, 2. mod_getfile was sending attach['data'] instead of attach['content']
This commit is contained in:
parent
ffee413d2d
commit
095e2bf0b3
@ -27,6 +27,8 @@ require_once('include/attach.php');
|
|||||||
class Getfile extends \Zotlabs\Web\Controller {
|
class Getfile extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
function post() {
|
function post() {
|
||||||
|
|
||||||
|
logger('post: ' . print_r($_POST,true),LOGGER_DEBUG,LOG_INFO);
|
||||||
|
|
||||||
$hash = $_POST['hash'];
|
$hash = $_POST['hash'];
|
||||||
$time = $_POST['time'];
|
$time = $_POST['time'];
|
||||||
@ -38,9 +40,11 @@ class Getfile extends \Zotlabs\Web\Controller {
|
|||||||
killme();
|
killme();
|
||||||
|
|
||||||
$channel = channelx_by_hash($hash);
|
$channel = channelx_by_hash($hash);
|
||||||
|
|
||||||
if((! $channel) || (! $time) || (! $sig))
|
if((! $channel) || (! $time) || (! $sig)) {
|
||||||
|
logger('error: missing info');
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
$slop = intval(get_pconfig($channel['channel_id'],'system','getfile_time_slop'));
|
$slop = intval(get_pconfig($channel['channel_id'],'system','getfile_time_slop'));
|
||||||
if($slop < 1)
|
if($slop < 1)
|
||||||
@ -58,16 +62,15 @@ class Getfile extends \Zotlabs\Web\Controller {
|
|||||||
logger('verify failed.');
|
logger('verify failed.');
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$r = attach_by_hash($resource,$revision);
|
$r = attach_by_hash($resource,$revision);
|
||||||
|
|
||||||
if(! $r['success']) {
|
if(! $r['success']) {
|
||||||
|
logger('attach_by_hash failed: ' . $r['message']);
|
||||||
notice( $r['message'] . EOL);
|
notice( $r['message'] . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$unsafe_types = array('text/html','text/css','application/javascript');
|
$unsafe_types = array('text/html','text/css','application/javascript');
|
||||||
|
|
||||||
if(in_array($r['data']['filetype'],$unsafe_types)) {
|
if(in_array($r['data']['filetype'],$unsafe_types)) {
|
||||||
@ -76,10 +79,10 @@ class Getfile extends \Zotlabs\Web\Controller {
|
|||||||
else {
|
else {
|
||||||
header('Content-type: ' . $r['data']['filetype']);
|
header('Content-type: ' . $r['data']['filetype']);
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
|
header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
|
||||||
if(intval($r['data']['os_storage'])) {
|
if(intval($r['data']['os_storage'])) {
|
||||||
$fname = dbunescbin($r['data']['data']);
|
$fname = dbunescbin($r['data']['content']);
|
||||||
if(strpos($fname,'store') !== false)
|
if(strpos($fname,'store') !== false)
|
||||||
$istream = fopen($fname,'rb');
|
$istream = fopen($fname,'rb');
|
||||||
else
|
else
|
||||||
@ -91,11 +94,9 @@ class Getfile extends \Zotlabs\Web\Controller {
|
|||||||
fclose($ostream);
|
fclose($ostream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
echo dbunescbin($r['data']['data']);
|
echo dbunescbin($r['data']['content']);
|
||||||
|
}
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3164,7 +3164,10 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
|
|||||||
|
|
||||||
if(array_key_exists('channel',$arr) && is_array($arr['channel']) && count($arr['channel'])) {
|
if(array_key_exists('channel',$arr) && is_array($arr['channel']) && count($arr['channel'])) {
|
||||||
|
|
||||||
translate_channel_perms_inbound($arr['channel']);
|
$remote_channel = $arr['channel'];
|
||||||
|
$remote_channel['channel_id'] = $channel['channel_id'];
|
||||||
|
translate_channel_perms_inbound($remote_channel);
|
||||||
|
|
||||||
|
|
||||||
if(array_key_exists('channel_pageflags',$arr['channel']) && intval($arr['channel']['channel_pageflags'])) {
|
if(array_key_exists('channel_pageflags',$arr['channel']) && intval($arr['channel']['channel_pageflags'])) {
|
||||||
// These flags cannot be sync'd.
|
// These flags cannot be sync'd.
|
||||||
|
Reference in New Issue
Block a user