protected function execute() { $storage = new binarypool_storage($this->bucket); $path = $this->getPath(); if (preg_match('#index\\.xml$#', $path) && $this->clientxsl) { ob_start(); $storage->sendFile($path); $content = ob_get_contents(); ob_end_clean(); $pi = '<?xml version="1.0" encoding="UTF-8"?>'; $pi .= '<?xml-stylesheet type="text/xsl" href="/static/xsl/index.xsl"?>'; $content = preg_replace('#<\\?xml version="1.0" encoding="UTF-8"\\?>#', $pi, $content); $this->sendHeaders('text/xml; charset=utf-8'); print $content; } else { $mime = binarypool_mime::getMimeType($storage->absolutize($path)); $this->sendHeaders($mime); $storage->sendFile($path); } $this->ignoreView = true; }
protected function execute() { $hash = $this->route['hash']; $uri = $this->request->getPath(); $storage = new binarypool_storage($this->bucket); $asset = $storage->getAssetBySha1($hash); if (!$storage->fileExists($asset)) { throw new binarypool_exception(115, 404, "File does not exist: {$uri}"); } $this->setResponseCode(302); $this->response->setHeader('X-Asset', $asset); $this->response->setHeader('Content-Type', 'text/xml'); $this->response->setContentLengthOutput(false); $storage->sendFile($asset); $this->response->send(); $this->ignoreView = true; }