/** * Sends the requested file to the browser * @return string */ public function actionDownload() { //Load filedetails if (validateSystemid($this->getSystemid())) { /** @var $objFile class_module_mediamanager_file */ $objFile = class_objectfactory::getInstance()->getObject($this->getSystemid()); //Succeeded? if ($objFile instanceof class_module_mediamanager_file && $objFile->getIntRecordStatus() == "1" && $objFile->getIntType() == class_module_mediamanager_file::$INT_TYPE_FILE) { //Check rights if ($objFile->rightRight2()) { //Log the download class_module_mediamanager_logbook::generateDlLog($objFile); //Send the data to the browser $strBrowser = getServer("HTTP_USER_AGENT"); //Check the current browsertype if (uniStrpos($strBrowser, "IE") !== false) { //Internet Explorer class_response_object::getInstance()->addHeader("Content-type: application/x-ms-download"); class_response_object::getInstance()->addHeader("Content-type: x-type/subtype\n"); class_response_object::getInstance()->addHeader("Content-type: application/force-download"); class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . preg_replace('/\\./', '%2e', saveUrlEncode(trim(basename($objFile->getStrFilename()))), substr_count(basename($objFile->getStrFilename()), '.') - 1)); } else { //Good: another browser vendor class_response_object::getInstance()->addHeader("Content-Type: application/octet-stream"); class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . saveUrlEncode(trim(basename($objFile->getStrFilename())))); } //Common headers class_response_object::getInstance()->addHeader("Expires: Mon, 01 Jan 1995 00:00:00 GMT"); class_response_object::getInstance()->addHeader("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); class_response_object::getInstance()->addHeader("Pragma: no-cache"); class_response_object::getInstance()->addHeader("Content-description: JustThum-Generated Data\n"); class_response_object::getInstance()->addHeader("Content-Length: " . filesize(_realpath_ . $objFile->getStrFilename())); //End Session $this->objSession->sessionClose(); class_response_object::getInstance()->sendHeaders(); //Loop the file $ptrFile = @fopen(_realpath_ . $objFile->getStrFilename(), 'rb'); fpassthru($ptrFile); @fclose($ptrFile); ob_flush(); flush(); return ""; } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_FORBIDDEN); } } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND); } } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND); } //if we reach up here, something gone wrong :/ class_response_object::getInstance()->setStrRedirectUrl(str_replace(array("_indexpath_", "&"), array(_indexpath_, "&"), class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_")))); class_response_object::getInstance()->sendHeaders(); class_response_object::getInstance()->sendContent(); return ""; }
/** * Shows a form or deltes a timeintervall from the logs * * @throws class_exception * @return string "" in case of success * @permissions edit * @autoTestable */ protected function actionLogbookFlush() { $strReturn = ""; if ($this->getParam("flush") == "") { $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "logbookFlush", "flush=1")); $strReturn .= $this->objToolkit->formTextRow($this->getLang("logbook_hint_date")); $strReturn .= $this->objToolkit->formDateSingle("date", $this->getLang("commons_date"), new class_date()); $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("commons_save")); $strReturn .= $this->objToolkit->formClose(); } elseif ($this->getParam("flush") == "1") { //Build the date $objDate = new class_date(); $objDate->generateDateFromParams("date", $this->getAllParams()); if (!class_module_mediamanager_logbook::deleteFromLogs($objDate->getTimeInOldStyle())) { throw new class_exception("Error deleting log-rows", class_exception::$level_ERROR); } $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "logbook")); } return $strReturn; }