9797$ favicon_path = '' ;
9898
9999// Files and folders to excluded from listing
100- // e.g. array('myfile.html', 'personal-folder', '*.php', ...)
100+ // e.g. array('myfile.html', 'personal-folder', '*.php', '/path/to/folder', ...)
101101$ exclude_items = array ();
102102
103103// Online office Docs Viewer
@@ -1334,7 +1334,7 @@ function get_file_path()
13341334$ folders = array ();
13351335$ files = array ();
13361336$ current_path = array_slice (explode ("/ " , $ path ), -1 )[0 ];
1337- if (is_array ($ objects ) && fm_is_exclude_items ($ current_path )) {
1337+ if (is_array ($ objects ) && fm_is_exclude_items ($ current_path, $ path )) {
13381338 foreach ($ objects as $ file ) {
13391339 if ($ file == '. ' || $ file == '.. ' ) {
13401340 continue ;
@@ -1343,9 +1343,9 @@ function get_file_path()
13431343 continue ;
13441344 }
13451345 $ new_path = $ path . '/ ' . $ file ;
1346- if (@is_file ($ new_path ) && fm_is_exclude_items ($ file )) {
1346+ if (@is_file ($ new_path ) && fm_is_exclude_items ($ file, $ new_path )) {
13471347 $ files [] = $ file ;
1348- } elseif (@is_dir ($ new_path ) && $ file != '. ' && $ file != '.. ' && fm_is_exclude_items ($ file )) {
1348+ } elseif (@is_dir ($ new_path ) && $ file != '. ' && $ file != '.. ' && fm_is_exclude_items ($ file, $ new_path )) {
13491349 $ folders [] = $ file ;
13501350 }
13511351 }
@@ -1712,7 +1712,7 @@ function getSelected($l)
17121712 $ file = $ _GET ['view ' ];
17131713 $ file = fm_clean_path ($ file , false );
17141714 $ file = str_replace ('/ ' , '' , $ file );
1715- if ($ file == '' || !is_file ($ path . '/ ' . $ file ) || !fm_is_exclude_items ($ file )) {
1715+ if ($ file == '' || !is_file ($ path . '/ ' . $ file ) || !fm_is_exclude_items ($ file, $ path . ' / ' . $ file )) {
17161716 fm_set_msg (lng ('File not found ' ), 'error ' );
17171717 $ FM_PATH = FM_PATH ;
17181718 fm_redirect (FM_SELF_URL . '?p= ' . urlencode ($ FM_PATH ));
@@ -1917,7 +1917,7 @@ class="edit-file"><i class="fa fa-pencil-square"></i> <?php echo lng('AdvancedEd
19171917 $ file = $ _GET ['edit ' ];
19181918 $ file = fm_clean_path ($ file , false );
19191919 $ file = str_replace ('/ ' , '' , $ file );
1920- if ($ file == '' || !is_file ($ path . '/ ' . $ file ) || !fm_is_exclude_items ($ file )) {
1920+ if ($ file == '' || !is_file ($ path . '/ ' . $ file ) || !fm_is_exclude_items ($ file, $ path . ' / ' . $ file )) {
19211921 fm_set_msg (lng ('File not found ' ), 'error ' );
19221922 $ FM_PATH = FM_PATH ;
19231923 fm_redirect (FM_SELF_URL . '?p= ' . urlencode ($ FM_PATH ));
@@ -2664,12 +2664,13 @@ function fm_get_display_path($file_path)
26642664
26652665/**
26662666 * Check file is in exclude list
2667- * @param string $file
2667+ * @param string $name The name of the file/folder
2668+ * @param string $path The full path of the file/folder
26682669 * @return bool
26692670 */
2670- function fm_is_exclude_items ($ file )
2671+ function fm_is_exclude_items ($ name , $ path )
26712672{
2672- $ ext = strtolower (pathinfo ($ file , PATHINFO_EXTENSION ));
2673+ $ ext = strtolower (pathinfo ($ name , PATHINFO_EXTENSION ));
26732674 if (isset ($ exclude_items ) and sizeof ($ exclude_items )) {
26742675 unset($ exclude_items );
26752676 }
@@ -2678,7 +2679,7 @@ function fm_is_exclude_items($file)
26782679 if (version_compare (PHP_VERSION , '7.0.0 ' , '< ' )) {
26792680 $ exclude_items = unserialize ($ exclude_items );
26802681 }
2681- if (!in_array ($ file , $ exclude_items ) && !in_array ("*. $ ext " , $ exclude_items )) {
2682+ if (!in_array ($ name , $ exclude_items ) && !in_array ("*. $ ext " , $ exclude_items ) && ! in_array ( $ path , $ exclude_items )) {
26822683 return true ;
26832684 }
26842685 return false ;
0 commit comments