From 02cb0d71294e7d1762b76b14134b7ba4314e161b Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 26 Nov 2020 10:37:46 -0500 Subject: [PATCH] Documents: Use show_system_folders to show/hide default folders #3621 --- main/inc/lib/document.lib.php | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 1d62901b37..6d3249ee04 100644 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -4202,16 +4202,6 @@ class DocumentManager */ public static function is_folder_to_avoid($path, $is_certificate_mode = false) { - $foldersToAvoid = [ - '/HotPotatoes_files', - '/certificates', - ]; - $systemFolder = api_get_course_setting('show_system_folders'); - - if ($systemFolder == 1) { - $foldersToAvoid = []; - } - if (basename($path) == 'css') { return true; } @@ -4223,6 +4213,23 @@ class DocumentManager } } + $foldersToAvoid = [ + '/HotPotatoes_files', + '/certificates', + ]; + $showSystemFolder = api_get_course_setting('show_system_folders'); + + // Admin setting for Hide/Show Default folders to all users + if (api_get_setting('show_default_folders') == 'false' + || 2 == $showSystemFolder + ) { + $foldersToAvoid[] = '/images'; + $foldersToAvoid[] = '/flash'; + $foldersToAvoid[] = '/audio'; + $foldersToAvoid[] = '/video'; + $foldersToAvoid[] = '/learning_path'; + } + // Admin setting for Hide/Show the folders of all users if (api_get_setting('show_users_folders') == 'false') { $foldersToAvoid[] = '/shared_folder'; @@ -4232,14 +4239,6 @@ class DocumentManager } } - // Admin setting for Hide/Show Default folders to all users - if (api_get_setting('show_default_folders') == 'false') { - $foldersToAvoid[] = '/images'; - $foldersToAvoid[] = '/flash'; - $foldersToAvoid[] = '/audio'; - $foldersToAvoid[] = '/video'; - } - // Admin setting for Hide/Show chat history folder if (api_get_setting('show_chat_folder') == 'false') { $foldersToAvoid[] = '/chat_files';