mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Get Sharing + Collabora into latest 17.1 version
This commit is contained in:
parent
097d123a3b
commit
045436609d
@ -912,6 +912,11 @@ class Vfs
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if we check writable and have a readonly mount --> return false, as backends dont know about r/o url parameter
|
||||||
|
if ($check == self::WRITABLE && Vfs\StreamWrapper::url_is_readonly($stat['url']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// check backend for extended acls (only if path given)
|
// check backend for extended acls (only if path given)
|
||||||
$ret = $path && self::_call_on_backend('check_extended_acl',array(isset($stat['url'])?$stat['url']:$path,$check),true); // true = fail silent if backend does not support
|
$ret = $path && self::_call_on_backend('check_extended_acl',array(isset($stat['url'])?$stat['url']:$path,$check),true); // true = fail silent if backend does not support
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ class Sharing
|
|||||||
}
|
}
|
||||||
$share['resolve_url'] = Vfs::resolve_url($share['share_path'], true, true, true, true); // true = fix evtl. contained url parameter
|
$share['resolve_url'] = Vfs::resolve_url($share['share_path'], true, true, true, true); // true = fix evtl. contained url parameter
|
||||||
// if share not writable append ro=1 to mount url to make it readonly
|
// if share not writable append ro=1 to mount url to make it readonly
|
||||||
if (!self::$db->from_bool($share['share_writable']))
|
if (!($share['share_writable'] & 1))
|
||||||
{
|
{
|
||||||
$share['resolve_url'] .= (strpos($share['resolve_url'], '?') ? '&' : '?').'ro=1';
|
$share['resolve_url'] .= (strpos($share['resolve_url'], '?') ? '&' : '?').'ro=1';
|
||||||
}
|
}
|
||||||
@ -305,17 +305,6 @@ class Sharing
|
|||||||
// --> we dont need session and close it, to not modifiy it
|
// --> we dont need session and close it, to not modifiy it
|
||||||
elseif ($keep_session === false)
|
elseif ($keep_session === false)
|
||||||
{
|
{
|
||||||
if ($GLOBALS['egw']->sharing->use_collabora())
|
|
||||||
{
|
|
||||||
// check if sharee has Collabora run rights --> give is to share too
|
|
||||||
// we need to have collabora app to avoid CSP error since redirect share-link
|
|
||||||
// in collabora should get frame-src. e.g:(Collabora/Src/Ui.php:redirect(Sharing::share2link))
|
|
||||||
$apps = $GLOBALS['egw']->acl->get_user_applications($share['share_owner']);
|
|
||||||
if (!empty($apps['collabora']))
|
|
||||||
{
|
|
||||||
$GLOBALS['egw_info']['user']['apps']['collabora'] = $GLOBALS['egw_info']['apps']['collabora'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$GLOBALS['egw']->session->commit_session();
|
$GLOBALS['egw']->session->commit_session();
|
||||||
}
|
}
|
||||||
// need to store new fstab and vfs_user in session to allow GET requests / downloads via WebDAV
|
// need to store new fstab and vfs_user in session to allow GET requests / downloads via WebDAV
|
||||||
@ -350,19 +339,6 @@ class Sharing
|
|||||||
!file_exists(__DIR__.'/../../../filemanager/inc/class.filemanager_ui.inc.php'));
|
!file_exists(__DIR__.'/../../../filemanager/inc/class.filemanager_ui.inc.php'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if we should use Collabora UI
|
|
||||||
*
|
|
||||||
* Only for files, if URL says so, and Collabora & Stylite apps are installed
|
|
||||||
*/
|
|
||||||
public function use_collabora()
|
|
||||||
{
|
|
||||||
return !Vfs::is_dir($this->share['share_root']) &&
|
|
||||||
array_key_exists('edit', $_REQUEST) &&
|
|
||||||
array_key_exists('collabora', $GLOBALS['egw_info']['apps']) &&
|
|
||||||
array_key_exists('stylite', $GLOBALS['egw_info']['apps']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server a request on a share specified in REQUEST_URI
|
* Server a request on a share specified in REQUEST_URI
|
||||||
*/
|
*/
|
||||||
@ -384,13 +360,8 @@ class Sharing
|
|||||||
$this->share['share_path'] => 1
|
$this->share['share_path'] => 1
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if($this->use_collabora())
|
|
||||||
{
|
|
||||||
$ui = new \EGroupware\Collabora\Ui();
|
|
||||||
return $ui->editor($this->share['share_path']);
|
|
||||||
}
|
|
||||||
// use pure WebDAV for everything but GET requests to directories
|
// use pure WebDAV for everything but GET requests to directories
|
||||||
else if (!$this->use_filemanager())
|
if (!$this->use_filemanager())
|
||||||
{
|
{
|
||||||
// send a content-disposition header, so browser knows how to name downloaded file
|
// send a content-disposition header, so browser knows how to name downloaded file
|
||||||
if (!Vfs::is_dir($this->share['share_root']))
|
if (!Vfs::is_dir($this->share['share_root']))
|
||||||
@ -460,8 +431,15 @@ class Sharing
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$vfs_path = static::resolve_path($path);
|
if(parse_url($path, PHP_URL_SCHEME) !== 'vfs')
|
||||||
$exists = !!($vfs_path);
|
{
|
||||||
|
$path = 'vfs://default'.($path[0] == '/' ? '' : '/').$path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($exists = ($stat = Vfs::stat($path)) && Vfs::check_access($path, Vfs::READABLE, $stat)))
|
||||||
|
{
|
||||||
|
$vfs_path = Vfs::parse_url($stat['url'], PHP_URL_PATH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// check if file exists and is readable
|
// check if file exists and is readable
|
||||||
if (!$exists)
|
if (!$exists)
|
||||||
@ -566,36 +544,6 @@ class Sharing
|
|||||||
return $share;
|
return $share;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the actual VFS path for the given path
|
|
||||||
*
|
|
||||||
* We follow links & resolve whatever is possible so that when the share is
|
|
||||||
* mounted later (possibly by anonymous) the file can be found.
|
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function resolve_path($path)
|
|
||||||
{
|
|
||||||
$vfs_path = $path;
|
|
||||||
if(parse_url($path, PHP_URL_SCHEME) !== 'vfs')
|
|
||||||
{
|
|
||||||
$path = 'vfs://default'.($path[0] == '/' ? '' : '/').$path;
|
|
||||||
}
|
|
||||||
if (($exists = ($stat = Vfs::stat($path)) && Vfs::check_access($path, Vfs::READABLE, $stat)))
|
|
||||||
{
|
|
||||||
if (!preg_match("/^(sqlfs|vfs|stylite\.versioning|stylite\.merge)/", $stat['url']))
|
|
||||||
{
|
|
||||||
$vfs_path = Vfs::parse_url($path, PHP_URL_PATH);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$vfs_path = Vfs::parse_url($stat['url'], PHP_URL_PATH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $vfs_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api\Storage\Base instance for egw_sharing table
|
* Api\Storage\Base instance for egw_sharing table
|
||||||
*
|
*
|
||||||
|
@ -79,7 +79,8 @@ class filemanager_shares extends filemanager_ui
|
|||||||
|
|
||||||
if (class_exists('EGroupware\\Collabora\\Wopi'))
|
if (class_exists('EGroupware\\Collabora\\Wopi'))
|
||||||
{
|
{
|
||||||
$query['col_filter'][] = 'share_writable != '.(int)EGroupware\Collabora\Wopi::WOPI_SHARE;
|
$query['col_filter'][] = 'share_writable NOT IN ('.
|
||||||
|
EGroupware\Collabora\Wopi::WOPI_WRITABLE.','.EGroupware\Collabora\Wopi::WOPI_READONLY.')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((string)$query['col_filter']['share_passwd'] !== '')
|
if ((string)$query['col_filter']['share_passwd'] !== '')
|
||||||
|
Loading…
Reference in New Issue
Block a user