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.

39 lines
1.1KB

  1. <?php
  2. /**
  3. * COPS (Calibre OPDS PHP Server) main script
  4. *
  5. * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
  6. * @author Sébastien Lucas <sebastien@slucas.fr>
  7. *
  8. */
  9. require_once ("config.php");
  10. require_once ("base.php");
  11. require_once ("author.php");
  12. require_once ("serie.php");
  13. require_once ("tag.php");
  14. require_once ("book.php");
  15. require_once ("OPDS_renderer.php");
  16. header ("Content-Type:application/xml");
  17. $page = getURLParam ("page", Base::PAGE_INDEX);
  18. $query = getURLParam ("query");
  19. $n = getURLParam ("n", "1");
  20. if ($query)
  21. $page = Base::PAGE_OPENSEARCH_QUERY;
  22. $qid = getURLParam ("id");
  23. $OPDSRender = new OPDSRenderer ();
  24. switch ($page) {
  25. case Base::PAGE_OPENSEARCH :
  26. echo $OPDSRender->getOpenSearch ();
  27. return;
  28. default:
  29. $currentPage = Page::getPage ($page, $qid, $query, $n);
  30. $currentPage->InitializeContent ();
  31. echo $OPDSRender->render ($currentPage);
  32. return;
  33. break;
  34. }