2012-05-28 08:01:33 +03:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* COPS (Calibre OPDS PHP Server) main script
|
|
|
|
|
*
|
|
|
|
|
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
|
|
|
|
* @author S<EFBFBD>bastien Lucas <sebastien@slucas.fr>
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
require_once ("config.php");
|
|
|
|
|
require_once ("base.php");
|
|
|
|
|
require_once ("author.php");
|
|
|
|
|
require_once ("serie.php");
|
2012-05-28 08:07:49 +03:00
|
|
|
|
require_once ("tag.php");
|
2012-05-28 08:01:33 +03:00
|
|
|
|
require_once ("book.php");
|
2012-05-28 08:05:05 +03:00
|
|
|
|
require_once ("OPDS_renderer.php");
|
|
|
|
|
|
2012-05-28 08:01:33 +03:00
|
|
|
|
header ("Content-Type:application/xml");
|
2012-05-28 08:05:05 +03:00
|
|
|
|
$page = getURLParam ("page", Base::PAGE_INDEX);
|
|
|
|
|
$query = getURLParam ("query");
|
2012-09-18 16:39:22 +03:00
|
|
|
|
$n = getURLParam ("n", "1");
|
2012-05-28 08:06:12 +03:00
|
|
|
|
if ($query)
|
|
|
|
|
$page = Base::PAGE_OPENSEARCH_QUERY;
|
2012-05-28 08:05:05 +03:00
|
|
|
|
$qid = getURLParam ("id");
|
|
|
|
|
|
|
|
|
|
$OPDSRender = new OPDSRenderer ();
|
|
|
|
|
|
2013-07-21 23:10:36 +03:00
|
|
|
|
// Clean output buffer : mandatory for nginx / php-fpm on Wheezy
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
2012-05-28 08:01:33 +03:00
|
|
|
|
switch ($page) {
|
|
|
|
|
case Base::PAGE_OPENSEARCH :
|
2012-05-28 08:05:05 +03:00
|
|
|
|
echo $OPDSRender->getOpenSearch ();
|
2012-05-28 08:01:33 +03:00
|
|
|
|
return;
|
|
|
|
|
default:
|
2012-09-18 16:39:22 +03:00
|
|
|
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
2012-05-28 08:05:05 +03:00
|
|
|
|
$currentPage->InitializeContent ();
|
|
|
|
|
echo $OPDSRender->render ($currentPage);
|
|
|
|
|
return;
|
2012-05-28 08:01:33 +03:00
|
|
|
|
break;
|
|
|
|
|
}
|
2013-07-20 14:35:51 +03:00
|
|
|
|
?>
|