From ba84d3170dd92d45bc2d963924632382cceaf78f Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 11 Mar 2021 09:50:12 -0700 Subject: [PATCH] Api: Improve handling of accessing multiple shares (Collabora or directory) in new tabs while logged in --- api/src/Sharing.php | 1 + filemanager/src/Sharing/AnonymousList.php | 8 ++++++-- share.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/src/Sharing.php b/api/src/Sharing.php index b6e801156d..320d51cdde 100644 --- a/api/src/Sharing.php +++ b/api/src/Sharing.php @@ -526,6 +526,7 @@ class Sharing }*/ if($this->use_collabora()) { + unset($GLOBALS['egw']->sharing); $ui = new \EGroupware\Collabora\Ui(); return $ui->editor($this->share['share_path']); } diff --git a/filemanager/src/Sharing/AnonymousList.php b/filemanager/src/Sharing/AnonymousList.php index c4a1bc17be..c952be401e 100644 --- a/filemanager/src/Sharing/AnonymousList.php +++ b/filemanager/src/Sharing/AnonymousList.php @@ -65,7 +65,11 @@ class AnonymousList extends filemanager_ui */ static function get_home_dir() { - return $GLOBALS['egw']->sharing->get_root(); + if(isset($GLOBALS['egw']->sharing)) + { + return $GLOBALS['egw']->sharing->get_root(); + } + return '/'; } /** @@ -79,7 +83,7 @@ class AnonymousList extends filemanager_ui $group = 1; // do not add edit setting action when we are in sharing unset($actions['edit']); - if (Vfs::is_writable($GLOBALS['egw']->sharing->get_root())) + if (isset($GLOBALS['egw']->sharing) && Vfs::is_writable($GLOBALS['egw']->sharing->get_root())) { return $actions; } diff --git a/share.php b/share.php index 40c9b65364..8ac5d2c04a 100644 --- a/share.php +++ b/share.php @@ -27,7 +27,7 @@ $GLOBALS['egw_info'] = array( include('./header.inc.php'); -if (!isset($GLOBALS['egw']->sharing)) +if (!isset($GLOBALS['egw']->sharing) || \EGroupware\Api\Sharing::get_token() !== $GLOBALS['egw']->sharing->get_token()) { Sharing::create_session(true); // true = mount into existing session }