From 649486b2f6cafaac9215452558a713ce1aacb73a Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Fri, 17 Feb 2023 13:13:16 +0000 Subject: [PATCH] ensure variable from_plugin is set, fixes #2185 Closes #2185 Merge request studip/studip!1411 --- app/controllers/file.php | 8 ++++---- app/views/file/file_details.php | 13 +++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/controllers/file.php b/app/controllers/file.php index c53a2197b48..e7378aab2cd 100644 --- a/app/controllers/file.php +++ b/app/controllers/file.php @@ -253,17 +253,17 @@ class FileController extends AuthenticatedController { $this->include_navigation = Request::get('file_navigation', false); //check if the file area object is a FileRef: - if (Request::get("from_plugin")) { + $this->from_plugin = Request::get("from_plugin"); + if ($this->from_plugin) { $file_id = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], "dispatch.php/file/details/") + strlen("dispatch.php/file/details/")); if (strpos($file_id, "?") !== false) { $file_id = substr($file_id, 0, strpos($file_id, "?")); } - $plugin = PluginManager::getInstance()->getPlugin(Request::get("from_plugin")); + $plugin = PluginManager::getInstance()->getPlugin($this->from_plugin); if (!$plugin) { throw new Trails_Exception(404, _('Plugin existiert nicht.')); } $this->file = $plugin->getPreparedFile($file_id); - $this->from_plugin = Request::get("from_plugin"); } else { $file_ref = FileRef::find($file_area_object_id); if ($file_ref) { @@ -320,7 +320,7 @@ class FileController extends AuthenticatedController $this->render_action('file_details'); } else { //file area object is not a FileRef: maybe it's a folder: - if (Request::get("from_plugin")) { + if ($this->from_plugin) { $this->folder = $plugin->getFolder($file_id); } else { $this->folder = FileManager::getTypedFolder($file_area_object_id); diff --git a/app/views/file/file_details.php b/app/views/file/file_details.php index 356043f3f83..76f996a7bfe 100644 --- a/app/views/file/file_details.php +++ b/app/views/file/file_details.php @@ -1,3 +1,16 @@ +<?php +/** + * @var Flexi_Template $this + * @var FileController $controller + * @var Flexi_Template|null $file_info_template + * @var array $fullpath + * @var FileType $file + * @var string|null $previous_file_ref_id + * @var string|null $next_file_ref_id + * @var string|null $from_plugin + * @var bool $include_navigation + */ +?> <div id="file_details_window"> <?= $this->render_partial('file/_file_aside.php') ?> -- GitLab