Exemple #1
0
 /**
  * Displays the files in a speicfic folder.
  *
  * @param mixed $dir_id Directory entry id of the folder (default to root)
  */
 public function index_action($dir_id = null, $page = 1)
 {
     $dir_id = $dir_id ?: $this->context_id;
     try {
         $directory = new DirectoryEntry($dir_id);
         $this->directory = $directory->file;
         $this->parent_id = FileHelper::getParentId($directory->id) ?: $this->context_id;
         $this->folder_id = $directory->parent_id;
         $parent_index = $directory->indexInParent();
     } catch (Exception $e) {
         $this->directory = new RootDirectory($GLOBALS['perm']->have_perm('root') ? $dir_id : $this->context_id);
         $this->parent_id = null;
         $this->folder_id = $this->context_id;
         $parent_index = false;
     }
     $this->directory->checkAccess();
     $this->filecount = $this->directory->countFiles();
     $this->maxpages = ceil($this->filecount / $this->limit);
     $this->page = min($page, $this->maxpages);
     $this->parent_page = $this->getPageForIndex($parent_index);
     $this->files = $this->directory->listFiles(($this->page - 1) * $this->limit, $this->limit);
     $this->dir_id = $dir_id;
     $this->marked = $this->flash['marked-ids'] ?: array();
     $this->breadcrumbs = FileHelper::getBreadCrumbs($dir_id);
     $config = DocUsergroupConfig::getUserConfig($this->context_id);
     $this->space_used = DiskFileStorage::getQuotaUsage($this->context_id);
     $this->space_total = $config['quota'];
     $this->setupSidebar($dir_id, $this->directory->id, $this->page);
 }
Exemple #2
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Lock context to user id
     $this->owner = $GLOBALS['user'];
     $this->context_id = $this->owner->id;
     $this->full_access = true;
     if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS) {
         $username = Request::username('username', $GLOBALS['user']->username);
         $user = User::findByUsername($username);
         if ($user && $user->id !== $GLOBALS['user']->id) {
             $this->owner = $user;
             $this->context_id = $user->id;
             $this->full_access = Config::get()->PERSONALDOCUMENT_OPEN_ACCESS_ROOT_PRIVILEDGED && $GLOBALS['user']->perms === 'root';
             URLHelper::bindLinkParam('username', $username);
         }
     }
     $this->limit = $GLOBALS['user']->cfg->PERSONAL_FILES_ENTRIES_PER_PAGE ?: Config::get()->ENTRIES_PER_PAGE;
     $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
     if ($this->userConfig['area_close'] == 1) {
         $this->redirect('document/closed/index');
     }
     if (Request::isPost()) {
         CSRFProtection::verifySecurityToken();
     }
     if (($ticket = Request::get('studip-ticket')) && !check_ticket($ticket)) {
         $message = _('Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.') . "\n" . _('Bitte versuchen Sie es erneut.');
         PageLayout::postMessage(MessageBox::error($message));
         $this->redirect('document/files/index');
     }
 }
Exemple #3
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     //Configurations for the Documentarea for this user
     $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
     PageLayout::setTitle(_('Dateiverwaltung'));
     PageLayout::setHelpKeyword('Basis.Dateien');
     Navigation::activateItem('/document/files');
 }