public function index() { $path = isset($_GET['path']) ? $_GET['path'] : ''; $this->filebrowser->set_path($path); if ($this->filebrowser->exists()) { $this->access->load_access($this->filebrowser->get_folder()); if ($this->access->is_restricted()) { // if user is not logged in redirect to login screen if (!$this->auth->logged_in()) { $this->session->set('return_path', $path); $this->session->keep_flash(); url::redirect("/login"); exit; } } if ($this->access->check_access($this->auth->get_user())) { $is_folder = false; $single = $this->filebrowser->is_file(); $folder = $this->filebrowser->get_folder(); if (!$single) { $fkind = $this->filekind->get_kind_by_file($folder); $kind = isset($fkind['kind']) ? $fkind['kind'] : ''; if ($kind == "site") { $single = true; $is_folder = true; } else { if ($kind == "slide") { $slide_files = $this->filebrowser->get_file_list(); $slide_files = $this->filebrowser->sort($slide_files); if (sizeof($slide_files) > 0) { $url = Subfolio::$filebrowser->get_link($slide_files[0]->name); url::redirect($url); exit; } } } } $replace_dash_space = view::get_option('replace_dash_space', true); $replace_underscore_space = view::get_option('replace_underscore_space', true); $display_file_extensions = view::get_option('display_file_extensions', true); if ($single) { $file = $this->filebrowser->get_file(); if ($is_folder) { } else { $fkind = $this->filekind->get_kind_by_file($file->name); $kind = isset($fkind['kind']) ? $fkind['kind'] : ''; } if (View::view_exists('pages/filekinds/' . $kind)) { $content = View::factory('pages/filekinds/' . $kind); $content->file = $file; if (isset($folder)) { $content->folder = $folder; } } else { $content = View::factory('pages/filekinds/default'); $content->file = $file; } if ($folder != '.') { $title_path = $folder . "/" . $file->name; } else { $title_path = $file->name; } $this->template->page_title = FileFolder::make_title_display($title_path, $replace_dash_space, $replace_underscore_space, $display_file_extensions); $this->template->content = $content; } else { $folder = $this->filebrowser->get_folder(); $content = View::factory('pages/listing'); $this->template->content = $content; if ($folder != "") { $this->template->page_title = $folder; $this->template->page_title = FileFolder::make_title_display($folder, $replace_dash_space, $replace_underscore_space, $display_file_extensions); } } } else { $content = View::factory('pages/denied'); $this->template->content = $content; } } else { $content = View::factory('pages/notfound'); $this->template->content = $content; } }