Working with cops
--HG-- extra : rebase_source : 66639c415fc1286e8df50c255d83b0e8f92777d3
This commit is contained in:
parent
30f801443e
commit
ea3da650de
3 changed files with 37 additions and 17 deletions
20
epubfs.php
20
epubfs.php
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
require_once ("config.php");
|
||||
require_once ("base.php");
|
||||
require_once ("book.php");
|
||||
require_once ("resources/php-epub-meta/epub.php");
|
||||
|
||||
function notFound () {
|
||||
|
@ -9,7 +12,13 @@ function notFound () {
|
|||
$_SERVER['REDIRECT_STATUS'] = 404;
|
||||
}
|
||||
|
||||
$book = new EPub ("c:/Temp/Phare.epub");
|
||||
$idData = getURLParam ("data", NULL);
|
||||
$add = "data=$idData&";
|
||||
if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
|
||||
$myBook = Book::getBookByDataId($idData);
|
||||
|
||||
$book = new EPub ($myBook->getFilePath ("EPUB", $idData));
|
||||
|
||||
$book->initSpineComponent ();
|
||||
|
||||
$component = $_GET["comp"];
|
||||
|
@ -22,14 +31,14 @@ try {
|
|||
$data = $book->component ($component);
|
||||
$directory = dirname ($component);
|
||||
|
||||
$callback = function ($m) use ($book, $component) {
|
||||
$callback = function ($m) use ($book, $component, $add) {
|
||||
$method = $m[1];
|
||||
$path = $m[2];
|
||||
if (preg_match ("/^#/", $path)) {
|
||||
return $path;
|
||||
}
|
||||
$comp = $book->getComponentName ($component, $path);
|
||||
return "$method'epubfs.php?comp=$comp'";
|
||||
return "$method'epubfs.php?{$add}comp=$comp'";
|
||||
};
|
||||
|
||||
$data = preg_replace_callback ("/(src=)[\"']([^:]*?)[\"']/", $callback, $data);
|
||||
|
@ -42,7 +51,4 @@ try {
|
|||
catch (Exception $e) {
|
||||
error_log ($e);
|
||||
notFound ();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue