/** * Gets a specific file version. * * @param int $version_id The version id to get. * @return array The specific version or false if the version was not found. */ public function getSpecificVersion($version_id) { include_once "./Services/History/classes/class.ilHistory.php"; $version = ilHistory::_getEntryByHistoryID($version_id); if ($version === false) { return false; } // ilHistory returns different keys in _getEntryByHistoryID and _getEntriesForObject // so this makes it the same $version["hist_entry_id"] = $version["id"]; $version["user_id"] = $version["usr_id"]; $version["date"] = $version["hdate"]; unset($version["id"], $version["usr_id"], $version["hdate"]); // parse params $params = $this->parseInfoParams($version); return array_merge($version, $params); }
function sendFile($a_hist_entry_id = null) { if (is_null($a_hist_entry_id)) { $file = $this->getDirectory($this->getVersion()) . "/" . $this->getFileName(); // if not found lookup for file in file object's main directory for downward c ompability if (@(!is_file($file))) { $file = $this->getDirectory() . "/" . $this->getFileName(); } } else { require_once "./Services/History/classes/class.ilHistory.php"; $entry = ilHistory::_getEntryByHistoryID($a_hist_entry_id); if ($entry === false) { echo "3"; return false; } $data = explode(",", $entry["info_params"]); // bugfix: first created file had no version number // this is a workaround for all files created before the bug was fixed if (empty($data[1])) { $data[1] = "1"; } $file = $this->getDirectory($data[1]) . "/" . $data[0]; // if not found lookup for file in file object's main directory for downward compability if (@(!is_file($file))) { $file = $this->getDirectory() . "/" . $data[0]; } // BEGIN WebDAV removed duplicated code // END WebDAV removed duplicated code } if (@is_file($file)) { global $ilClientIniFile; if ($ilClientIniFile->readVariable('file_access', 'download_with_uploaded_filename') != '1') { ilUtil::deliverFile($file, $this->getTitle(), $this->guessFileType($file), $this->isInline()); } else { ilUtil::deliverFile($file, basename($file), $this->guessFileType($file), $this->isInline()); } return true; } return false; }