You are here

function imce_subdirectories_accessible in IMCE 7

Same name and namespace in other branches
  1. 6.2 inc/imce.page.inc \imce_subdirectories_accessible()
  2. 6 inc/page.inc \imce_subdirectories_accessible()

Detect if the subdirectories are accessible.

Detect if the subdirectories are accessible through any directory(not just the current one) in the list.

1 call to imce_subdirectories_accessible()
imce_process_profile in inc/imce.page.inc
Get files and folders of the actve directory. Do custom processing.

File

inc/imce.page.inc, line 1066
Implements the file browser.

Code

function imce_subdirectories_accessible(&$imce) {
  if (!empty($imce['subdirectories'])) {
    if (!empty($imce['perm']['subnav'])) {
      return TRUE;
    }

    // Checking only the first one is sufficient.
    $dirname = reset($imce['subdirectories']);
    if ($imce['dir'] !== '.') {
      $dirname = $imce['dir'] . '/' . $dirname;
    }

    // Check if any setting is applicable for this subdirectory through
    // any directory in the list.
    foreach ($imce['directories'] as $name => $info) {
      $name = (string) $name;
      if ($info['subnav'] && $dirname != $name && ($name == '.' || strpos($dirname . '/', $name . '/') === 0)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}