From 881f76d87ae041209dc5467c6f4c0f6e5ab90bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 29 Aug 2013 08:43:11 +0200 Subject: [PATCH] Another test --HG-- extra : rebase_source : d6fd95a2c138efdb1901d7b09af47e20e6bf993e --- epubfs.php | 12 ++++++++---- epubreader.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/epubfs.php b/epubfs.php index 9a5ea3c..53f32e2 100644 --- a/epubfs.php +++ b/epubfs.php @@ -9,21 +9,25 @@ function notFound () { $_SERVER['REDIRECT_STATUS'] = 404; } -$book = new EPub ("c:/Temp/Alice.epub"); +$book = new EPub ("c:/Temp/Phare.epub"); $book->initSpineComponent (); $component = $_GET["comp"]; +$elementPath = NULL; +if (!empty ($_GET) && isset($_GET["path"]) && $_GET["path"] != "") { + $elementPath = $_GET["path"]; +} if (empty ($component)) { notFound (); } try { - $data = $book->component ($component); + $data = $book->component ($component, $elementPath); $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 ("/src=[\"']([^:]*?)[\"']/", "src='epubfs.php?path=$1&comp=$component'", $data); + $data = preg_replace ("/href=[\"']([^:]*?)[\"']/", "href='epubfs.php?path=$1&comp=$component'", $data); $data = preg_replace ("/\@import\s+[\"'](.*?)[\"'];/", "@import 'epubfs.php?comp={$directory}/$1';", $data); header ("Content-Type: " . $book->componentContentType($component)); diff --git a/epubreader.php b/epubreader.php index ef8dcc1..f865914 100644 --- a/epubreader.php +++ b/epubreader.php @@ -6,7 +6,7 @@ require_once ("resources/php-epub-meta/epub.php"); header ("Content-Type: text/html;charset=utf-8"); -$book = new EPub ("c:/Temp/Alice.epub"); +$book = new EPub ("c:/Temp/Phare.epub"); $book->initSpineComponent (); ?>