diff --git a/tinyfilemanager.php b/tinyfilemanager.php index ca73f9d7..f5d4db67 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -100,6 +100,12 @@ // e.g. array('myfile.html', 'personal-folder', '*.php', ...) $exclude_items = array(); +// Users excluded from listing excluded files and folders +// e.g. 'username' => array('myfile.html', 'personal-folder', '*.php', ...) +$exclude_items_users = array( + 'username' => array(), +); + // Online office Docs Viewer // Availabe rules are 'google', 'microsoft' or false // Google => View documents using Google Docs Viewer @@ -423,6 +429,7 @@ function getClientIP() { defined('FM_FILE_EXTENSION') || define('FM_FILE_EXTENSION', $allowed_file_extensions); defined('FM_UPLOAD_EXTENSION') || define('FM_UPLOAD_EXTENSION', $allowed_upload_extensions); defined('FM_EXCLUDE_ITEMS') || define('FM_EXCLUDE_ITEMS', (version_compare(PHP_VERSION, '7.0.0', '<') ? serialize($exclude_items) : $exclude_items)); +defined('FM_EXCLUDE_ITEMS_USERS') || define('FM_EXCLUDE_ITEMS_USERS', (version_compare(PHP_VERSION, '7.0.0', '<') ? serialize($exclude_items_users) : $exclude_items_users)); defined('FM_DOC_VIEWER') || define('FM_DOC_VIEWER', $online_viewer); define('FM_READONLY', $global_readonly || ($use_auth && !empty($readonly_users) && isset($_SESSION[FM_SESSION_ID]['logged']) && in_array($_SESSION[FM_SESSION_ID]['logged'], $readonly_users))); define('FM_IS_WIN', DIRECTORY_SEPARATOR == '\\'); @@ -1647,7 +1654,10 @@ function getSelected($l) { $file = $_GET['view']; $file = fm_clean_path($file, false); $file = str_replace('/', '', $file); - if ($file == '' || !is_file($path . '/' . $file) || in_array($file, $GLOBALS['exclude_items'])) { + if ($file == '' || !is_file($path . '/' . $file) || in_array($file, $GLOBALS['exclude_items']) || ( + isset($exclude_items_users[$_SESSION[FM_SESSION_ID]['logged']]) && + in_array($file, $exclude_items_users[$_SESSION[FM_SESSION_ID]['logged']])) + ){ fm_set_msg(lng('File not found'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } @@ -1846,7 +1856,10 @@ class="edit-file">