/**
  * getsingleeditformAction
  * @author Thomas Schedler <*****@*****.**>
  */
 public function getsingleeditformAction()
 {
     $this->core->logger->debug('media->controllers->FileController->getsingleeditformAction()');
     if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
         $this->getModelFiles();
         $objRequest = $this->getRequest();
         $intFileId = $objRequest->getParam('fileId');
         $objFile = $this->objModelFiles->loadFileById($intFileId);
         $this->view->assign('strEditFormAction', '/zoolu/media/file/edit');
         $this->view->assign('intFileId', $intFileId);
         $this->view->assign('objFile', $objFile);
         if (count($objFile) == 1 && $objFile->current()->version > 1) {
             $objFileVersions = $this->objModelFiles->loadFileVersions($intFileId);
             $this->view->assign('objFileVersions', $objFileVersions);
         }
         $this->view->assign('imagesSizes', $this->core->sysConfig->upload->images->default_sizes->default_size->toArray());
         $this->view->assign('destinationOptions', HtmlOutput::getOptionsOfSQL($this->core, 'SELECT categories.id AS VALUE, categoryTitles.title  AS DISPLAY FROM categories INNER JOIN categoryTitles ON categoryTitles.idCategories = categories.id AND categoryTitles.idLanguages = ' . $this->core->intZooluLanguageId . ' WHERE categories.idParentCategory = 466 ORDER BY categoryTitles.title', $objFile->current()->idDestination));
         $this->view->assign('groupOptions', HtmlOutput::getOptionsOfSQL($this->core, 'SELECT groups.id AS VALUE, groups.title  AS DISPLAY FROM groups LEFT JOIN groupGroupTypes ON groupGroupTypes.idGroups = groups.id WHERE groupGroupTypes.idGroupTypes = ' . $this->core->sysConfig->group_types->frontend . ' ORDER BY groups.title', $objFile->current()->idGroup));
         $this->view->assign('languageOptions', HtmlOutput::getOptionsOfSQL($this->core, 'SELECT id AS VALUE, languageCode AS DISPLAY FROM languages ORDER BY sortOrder, languageCode', $this->intLanguageId));
     }
     $this->assignSecurityOptions();
     $this->renderScript('file/singleform.phtml');
 }
 /**
  * downloadAction
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public function downloadAction()
 {
     $this->core->logger->debug('website->controllers->MediaController->downloadAction()');
     $this->getModelFiles();
     $intMediaId = $this->_getParam('id', 0);
     $intMediaVersion = $this->_getParam('v', 0);
     if ($intMediaId > 0) {
         $objFile = $this->objModelFiles->loadFileById($intMediaId, $intMediaVersion);
         if (count($objFile) > 0) {
             $objFileData = $objFile->current();
             if ($intMediaVersion > 0 && $objFileData->version != $objFileData->archiveVersion) {
                 $strFileName = $objFileData->fileId . '.v' . $objFileData->archiveVersion . '.' . $objFileData->archiveExtension;
                 $dblFileSize = $objFileData->archiveSize;
             } else {
                 $strFileName = $objFileData->filename;
                 $dblFileSize = $objFileData->size;
             }
             if ($objFileData->isImage) {
                 $strFilePath = GLOBAL_ROOT_PATH . $this->core->sysConfig->upload->images->path->local->private . $objFileData->path . $strFileName;
             } else {
                 $strFilePath = GLOBAL_ROOT_PATH . $this->core->sysConfig->upload->documents->path->local->private . $objFileData->path . $strFileName;
             }
             if (file_exists($strFilePath)) {
                 $this->objModelFiles->increaseDownloadCounter($objFileData->id);
                 if ($intMediaVersion > 0 && $objFileData->version != $objFileData->archiveVersion) {
                     if ($objFileData->title != '') {
                         $strFileName = urlencode(str_replace('.', '-', $objFileData->title)) . '.v' . $objFileData->archiveVersion . '.' . $objFileData->archiveExtension;
                     } else {
                         if ($objFileData->fallbackTitle != '') {
                             $strFileName = urlencode(str_replace('.', '-', $objFileData->fallbackTitle)) . '.v' . $objFileData->archiveVersion . '.' . $objFileData->archiveExtension;
                         } else {
                             $strFileName = $objFileData->fileId . '.v' . $objFileData->archiveVersion . '.' . $objFileData->archiveExtension;
                         }
                     }
                 } else {
                     if ($objFileData->title != '') {
                         $strFileName = urlencode(str_replace('.', '-', $objFileData->title)) . '.' . $objFileData->extension;
                     } else {
                         if ($objFileData->fallbackTitle != '') {
                             $strFileName = urlencode(str_replace('.', '-', $objFileData->fallbackTitle)) . '.' . $objFileData->extension;
                         } else {
                             $strFileName = $objFileData->filename;
                         }
                     }
                 }
                 // fix for IE catching or PHP bug issue
                 header("Pragma: public");
                 header("Expires: 0");
                 // set expiration time
                 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                 // browser must download file from server instead of cache
                 // force download dialog
                 header("Content-Type: application/force-download");
                 header("Content-Type: application/octet-stream");
                 header("Content-Type: application/download");
                 // Passenden Dateinamen im Download-Requester vorgeben,
                 header("Content-Disposition: attachment; filename=\"" . $strFileName . "\"");
                 header("Content-Transfer-Encoding: binary");
                 header("Content-Length: " . $dblFileSize);
                 // Datei ausgeben.
                 readfile($strFilePath);
             } else {
                 // file doesn't exist
             }
         }
     }
 }