You are here

function webfm_get_root_dirs in Web File Manager 5

2 calls to webfm_get_root_dirs()
webfm_ajax in ./webfm.module
Ajax post requests
webfm_path_access in ./webfm.module
Helper function to determine if a path is accessible by a user with 'access webfm'

File

./webfm.module, line 1962

Code

function webfm_get_root_dirs($flush = FALSE) {
  global $user;
  static $webfm_roots = array();
  $webfm_access_roles = webfm_get_access_roles($flush);
  $webfm_roots = array();
  foreach ($user->roles as $rid => $role) {
    if (array_key_exists($rid, $webfm_access_roles)) {

      // Roles with 'access webfm' perm that user possesses
      $path = variable_get("root_dir_" . $rid, '');
      if (!empty($path)) {

        // Prevent redundant trees for roles with common root dir
        if (!in_array($path, $webfm_roots)) {
          $webfm_roots[$rid] = "/" . $path;
        }
      }
    }
  }

  //If anonymous role has webfm access...
  if (array_key_exists(1, $webfm_access_roles)) {
    $path = variable_get("root_dir_1", '');
    if (!empty($path)) {
      $webfm_roots[1] = "/" . $path;
    }
  }
  return $webfm_roots;
}