Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...) http://blog.slucas.fr/en/oss/calibre-opds-php-server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
3.1KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  3. <?php
  4. /**
  5. * COPS (Calibre OPDS PHP Server) epub reader
  6. *
  7. * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
  8. * @author Sébastien Lucas <sebastien@slucas.fr>
  9. */
  10. require_once ("config.php");
  11. require_once ("base.php");
  12. require_once ("book.php");
  13. require_once ("resources/php-epub-meta/epub.php");
  14. header ("Content-Type: text/html;charset=utf-8");
  15. $idData = getURLParam ("data", NULL);
  16. $add = "data=$idData&";
  17. if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
  18. $myBook = Book::getBookByDataId($idData);
  19. $book = new EPub ($myBook->getFilePath ("EPUB", $idData));
  20. $book->initSpineComponent ();
  21. ?>
  22. <head>
  23. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  24. <meta http-equiv="imagetoolbar" content="no" />
  25. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  26. <title>COPS's Epub Reader</title>
  27. <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle/scripts/monocore.js") ?>"></script>
  28. <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle/scripts/monoctrl.js") ?>"></script>
  29. <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle/styles/monocore.css") ?>" media="screen" />
  30. <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle/styles/monoctrl.css") ?>" media="screen" />
  31. <script type="text/javascript">
  32. Monocle.DEBUG = true;
  33. var bookData = {
  34. getComponents: function () {
  35. <?php echo "return [" . implode (", ", array_map (function ($comp) { return "'" . $comp . "'"; }, $book->components ())) . "];"; ?>
  36. },
  37. getContents: function () {
  38. <?php echo "return [" . implode (", ", array_map (function ($content) { return "{title: '" . addslashes($content["title"]) . "', src: '". $content["src"] . "'}"; }, $book->contents ())) . "];"; ?>
  39. },
  40. getComponent: function (componentId) {
  41. return { url: "epubfs.php?<?php echo $add ?>comp=" + componentId };
  42. },
  43. getMetaData: function(key) {
  44. return {
  45. title: "<?php echo $myBook->title ?>",
  46. creator: "Inventive Labs"
  47. }[key];
  48. }
  49. }
  50. </script>
  51. <script type="text/javascript" src="<?php echo getUrlWithVersion("styles/cops-monocle.js") ?>"></script>
  52. <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("styles/cops-monocle.css") ?>" media="screen" />
  53. </head>
  54. <body>
  55. <div id="readerBg">
  56. <div class="board"></div>
  57. <div class="jacket"></div>
  58. <div class="dummyPage"></div>
  59. <div class="dummyPage"></div>
  60. <div class="dummyPage"></div>
  61. <div class="dummyPage"></div>
  62. <div class="dummyPage"></div>
  63. </div>
  64. <div id="readerCntr">
  65. <div id="reader"></div>
  66. </div>
  67. </body>
  68. </html>