Fix the url in CSS when there's not space.
Properly test the component before accessing it Don't handle & if handling src:url
This commit is contained in:
parent
8a678a620f
commit
90ffaeda77
15
epubfs.php
15
epubfs.php
|
@ -21,12 +21,13 @@ $book = new EPub ($myBook->getFilePath ("EPUB", $idData));
|
||||||
|
|
||||||
$book->initSpineComponent ();
|
$book->initSpineComponent ();
|
||||||
|
|
||||||
$component = $_GET["comp"];
|
if (!isset ($_GET["comp"])) {
|
||||||
|
|
||||||
if (empty ($component)) {
|
|
||||||
notFound ();
|
notFound ();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$component = $_GET["comp"];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$data = $book->component ($component);
|
$data = $book->component ($component);
|
||||||
$directory = dirname ($component);
|
$directory = dirname ($component);
|
||||||
|
@ -48,13 +49,17 @@ try {
|
||||||
}
|
}
|
||||||
$comp = $book->getComponentName ($component, $path);
|
$comp = $book->getComponentName ($component, $path);
|
||||||
if (!$comp) return "#";
|
if (!$comp) return "#";
|
||||||
return str_replace ("&", "&", "{$method}'epubfs.php?{$add}comp={$comp}{$hash}'{$end}");
|
$out = "{$method}'epubfs.php?{$add}comp={$comp}{$hash}'{$end}";
|
||||||
|
if ($end) {
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
return str_replace ("&", "&", $out);
|
||||||
};
|
};
|
||||||
|
|
||||||
$data = preg_replace_callback ("/(src=)[\"']([^:]*?)[\"']/", $callback, $data);
|
$data = preg_replace_callback ("/(src=)[\"']([^:]*?)[\"']/", $callback, $data);
|
||||||
$data = preg_replace_callback ("/(href=)[\"']([^:]*?)[\"']/", $callback, $data);
|
$data = preg_replace_callback ("/(href=)[\"']([^:]*?)[\"']/", $callback, $data);
|
||||||
$data = preg_replace_callback ("/(\@import\s+)[\"'](.*?)[\"'];/", $callback, $data);
|
$data = preg_replace_callback ("/(\@import\s+)[\"'](.*?)[\"'];/", $callback, $data);
|
||||||
$data = preg_replace_callback ("/(src:\s+url\()(.*?)\)/", $callback, $data);
|
$data = preg_replace_callback ("/(src:\s*url\()(.*?)\)/", $callback, $data);
|
||||||
|
|
||||||
$expires = 60*60*24*14;
|
$expires = 60*60*24*14;
|
||||||
header("Pragma: public");
|
header("Pragma: public");
|
||||||
|
|
Loading…
Reference in a new issue