public function related() { $related = array(); $listing_mode = Kohana::config('filebrowser.listing_mode'); $listing_mode = view::get_option('listing_mode', $listing_mode); $list = Subfolio::$filebrowser->get_file_list("cut", null, true); $restricted = false; foreach ($list as $item) { $link = Subfolio::$filebrowser->get_item_property($item->name, 'url'); if ($link == "") { $link = Subfolio::$filebrowser->get_item_property($item->name, 'directory'); $parent = Subfolio::$filebrowser->get_folder(); $folder_name = $link; if (substr($folder_name, 0, 1) == "/") { $pos = strrpos($link, "/"); $parent = substr($link, 1, strlen($link) - ($pos - 1)); $folder_name = substr($link, $pos + 1, strlen($link) - ($pos - 1)); } $folder = new FileFolder($folder_name, $parent, 'folder', '', NULL); if ($folder->contains_access_file()) { $restricted = true; if ($folder->have_access($this->auth->get_user())) { $have_access = true; } else { $have_access = false; } } else { if ($folder->have_access($this->auth->get_user())) { $restricted = false; $have_access = true; } else { $have_access = false; $restricted = true; } } } $name = Subfolio::$filebrowser->get_item_property($item->name, 'name'); $file_kind = Subfolio::$filekind->get_kind_by_file($item->name); $icon_file = ""; $icon_file = Subfolio::$filekind->get_icon_by_file($file_kind); $icon_set = view::get_option('icon_set_list', "list"); $icon_set_grid = view::get_option('icon_set_grid', "grid"); $icon = view::get_view_url() . "/images/icons/" . $icon_set . "/" . $icon_file . ".png"; $icon_grid = view::get_view_url() . "/images/icons/" . $icon_set_grid . "/" . $icon_file . ".png"; $rel = array(); $rel['link'] = $link; $rel['filename'] = $name; $rel['icon'] = $icon; $rel['icon_grid'] = $icon_grid; if ($restricted) { $rel['restricted'] = true; $rel['have_access'] = $have_access; } else { $rel['restricted'] = false; } $related[] = $rel; } return $related; }