diff --git a/epubfs.php b/epubfs.php new file mode 100644 index 0000000..9a5ea3c --- /dev/null +++ b/epubfs.php @@ -0,0 +1,37 @@ +initSpineComponent (); + +$component = $_GET["comp"]; + +if (empty ($component)) { + notFound (); +} + +try { + $data = $book->component ($component); + $directory = dirname ($component); + + $data = preg_replace ("/src=[\"']([^:]*?)[\"']/", "src='epubfs.php?comp=$1'", $data); + $data = preg_replace ("/href=[\"']([^:]*?)[\"']/", "href='epubfs.php?comp=$1'", $data); + $data = preg_replace ("/\@import\s+[\"'](.*?)[\"'];/", "@import 'epubfs.php?comp={$directory}/$1';", $data); + + header ("Content-Type: " . $book->componentContentType($component)); + echo $data; +} +catch (Exception $e) { + notFound (); +} + + +?> \ No newline at end of file