check code rights on cloud files
This commit is contained in:
parent
7dc99cb4a4
commit
2cce599fd7
@ -31,7 +31,7 @@ class Attach extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$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) && (! channel_codeallowed($r['data']['uid']))) {
|
||||||
header('Content-type: text/plain');
|
header('Content-type: text/plain');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -108,7 +108,7 @@ class Getfile extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$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) && (! channel_codeallowed($channel['channel_id']))) {
|
||||||
header('Content-type: text/plain');
|
header('Content-type: text/plain');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -254,7 +254,7 @@ class File extends DAV\Node implements DAV\IFile {
|
|||||||
// @todo this should be a global definition
|
// @todo this should be a global definition
|
||||||
$unsafe_types = array('text/html', 'text/css', 'application/javascript');
|
$unsafe_types = array('text/html', 'text/css', 'application/javascript');
|
||||||
|
|
||||||
if (in_array($r[0]['filetype'], $unsafe_types)) {
|
if (in_array($r[0]['filetype'], $unsafe_types) && (! channel_codeallowed($this->data['uid']))) {
|
||||||
header('Content-disposition: attachment; filename="' . $r[0]['filename'] . '"');
|
header('Content-disposition: attachment; filename="' . $r[0]['filename'] . '"');
|
||||||
header('Content-type: text/plain');
|
header('Content-type: text/plain');
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ class File extends DAV\Node implements DAV\IFile {
|
|||||||
public function getContentType() {
|
public function getContentType() {
|
||||||
// @todo this should be a global definition.
|
// @todo this should be a global definition.
|
||||||
$unsafe_types = array('text/html', 'text/css', 'application/javascript');
|
$unsafe_types = array('text/html', 'text/css', 'application/javascript');
|
||||||
if (in_array($this->data['filetype'], $unsafe_types)) {
|
if (in_array($this->data['filetype'], $unsafe_types) && (! channel_codeallowed($this->data['uid']))) {
|
||||||
return 'text/plain';
|
return 'text/plain';
|
||||||
}
|
}
|
||||||
return $this->data['filetype'];
|
return $this->data['filetype'];
|
||||||
|
Reference in New Issue
Block a user