public function AssetAction () {
		$ext = '';
		$path = $this->GetParam('path', 'a-zA-Z0-9_\-\/\.');
		$path = '/' . ltrim(str_replace('..', '', $path), '/');
		if (
			strpos($path, static::$staticPath) !== 0 &&
			strpos($path, static::$tmpPath) !== 0
		) {
			throw new \ErrorException("[".get_class($this)."] File path: '$path' is not allowed.", 500);
		}
		$path = $this->request->GetAppRoot() . $path;
		if (!file_exists($path)) {
			throw new \ErrorException("[".get_class($this)."] File not found: '$path'.", 404);
		}
		$lastDotPos = strrpos($path, '.');
		if ($lastDotPos !== FALSE) {
			$ext = substr($path, $lastDotPos + 1);
		}
		if (isset(self::$_assetsMimeTypes[$ext])) {
			header('Content-Type: ' . self::$_assetsMimeTypes[$ext]);
		}
		header_remove('X-Powered-By');
		header('Vary: Accept-Encoding');
		$assetMTime = @filemtime($path);
		if ($assetMTime) header('Last-Modified: ' . gmdate('D, d M Y H:i:s T', $assetMTime));
		readfile($path);
		exit;
	}
public function AssetAction () {
		$ext = '';
		$path = $this->GetParam('path', 'a-zA-Z0-9_\-\/\.');
		$path = '/' . ltrim(str_replace('..', '', $path), '/');
		if (
			strpos($path, static::$staticPath) !== 0 &&
			strpos($path, static::$tmpPath) !== 0
		) {
			throw new \ErrorException("[".get_class($this)."] File path: '$path' is not allowed.", 500);
		}
		$path = $this->request->GetAppRoot() . $path;
		if (!file_exists($path)) {
			throw new \ErrorException("[".get_class($this)."] File not found: '$path'.", 404);
		}
		$lastDotPos = strrpos($path, '.');
		if ($lastDotPos !== FALSE) {
			$ext = substr($path, $lastDotPos + 1);
		}
		if (isset(self::$_assetsMimeTypes[$ext])) {
			header('Content-Type: ' . self::$_assetsMimeTypes[$ext]);
		}
		header_remove('X-Powered-By');
		header('Vary: Accept-Encoding');
		$assetMTime = @filemtime($path);
		if ($assetMTime) header('Last-Modified: ' . gmdate('D, d M Y H:i:s T', $assetMTime));
		readfile($path);
		exit;
	}
public function AssetAction ( ) { $ ext = '' ; $ path = $ this -> GetParam ( 'path' , 'a-zA-Z0-9_\-\/\.' ) ; $ path = '/' . ltrim ( str_replace ( '..' , '' , $ path ) , '/' ) ; if ( strpos ( $ path , static :: $ staticPath ) !== 0 && strpos ( $ path , static :: $ tmpPath ) !== 0 ) { throw new \ ErrorException ( "[" . get_class ( $ this ) . "] File path: '$path' is not allowed." , 500 ) ; } $ path = $ this -> request -> GetAppRoot ( ) . $ path ; if ( ! file_exists ( $ path ) ) { throw new \ ErrorException ( "[" . get_class ( $ this ) . "] File not found: '$path'." , 404 ) ; } $ lastDotPos = strrpos ( $ path , '.' ) ; if ( $ lastDotPos !== FALSE ) { $ ext = substr ( $ path , $ lastDotPos + 1 ) ; } if ( isset ( self :: $ _assetsMimeTypes [ $ ext ] ) ) { header ( 'Content-Type: ' . self :: $ _assetsMimeTypes [ $ ext ] ) ; } header_remove ( 'X-Powered-By' ) ; header ( 'Vary: Accept-Encoding' ) ; $ assetMTime = @ filemtime ( $ path ) ; if ( $ assetMTime ) header ( 'Last-Modified: ' . gmdate ( 'D, d M Y H:i:s T' , $ assetMTime ) ) ; readfile ( $ path ) ; exit ; }
Return small assets content with proper headers
in single file application mode and immediately exit.
@throws \Exception If file path is not allowed (500) or file not found (404).
@return void
Return small assets content with proper headers in single file application mode and immediately exit .