From 8778be01ffb7d413f73b4169f33f8aee4a0f0228 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 8 Jun 2020 10:18:15 -0600 Subject: [PATCH] * Filemanager: When user tries to access a directory with no permission, redirect to previous directory instead of home --- filemanager/inc/class.filemanager_ui.inc.php | 26 ++++++++++++++------ filemanager/templates/default/file.xet | 8 ++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index b8e1372ace..9d7b8b727a 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -905,6 +905,8 @@ class filemanager_ui */ function get_rows(&$query, &$rows) { + $old_session = Api\Cache::getSession('filemanager','index'); + // do NOT store query, if hierarchical data / children are requested if (!$query['csv_export']) { @@ -933,15 +935,19 @@ class filemanager_ui if (!Vfs::stat($query['path'],true) || !Vfs::is_dir($query['path']) || !Vfs::check_access($query['path'],Vfs::READABLE)) { // only redirect, if it would be to some other location, gives redirect-loop otherwise - if ($query['path'] != ($path = static::get_home_dir())) + foreach([$old_session['path'], static::get_home_dir()] as $new_path) { - // we will leave here, since we are not allowed, or the location does not exist. Index must handle that, and give - // an appropriate message - Egw::redirect_link('/index.php',array('menuaction'=>'filemanager.filemanager_ui.index', - 'path' => $path, - 'msg' => lang('The requested path %1 is not available.',Vfs::decodePath($query['path'])), - 'ajax' => 'true' - )); + if ($new_path && Vfs::stat($new_path) && $query['path'] != $new_path) + { + // we will leave here, since we are not allowed, or the location does not exist. Index must handle that, and give + // an appropriate message + Egw::redirect_link('/index.php', array('menuaction' => 'filemanager.filemanager_ui.index', + 'path' => $new_path, + 'msg' => lang('The requested path %1 is not available.', Vfs::decodePath($query['path'])), + 'ajax' => 'true' + )); + break; + } } $rows = array(); return 0; @@ -971,6 +977,10 @@ class filemanager_ui { $row['class'] .= 'noEdit '; } + if(!Vfs::is_executable($path)) + { + $row['class'] .= 'noExecute'; + } } elseif (!$dir_is_writable[Vfs::dirname($path)]) { diff --git a/filemanager/templates/default/file.xet b/filemanager/templates/default/file.xet index e49098dba8..d12d211860 100644 --- a/filemanager/templates/default/file.xet +++ b/filemanager/templates/default/file.xet @@ -103,15 +103,11 @@ - - - + - - - +