cops/feed.php

45 lines
1.2 KiB
PHP
Raw Permalink Normal View History

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");
2013-12-05 11:52:51 +02:00
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");
$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");
2013-12-05 11:52:51 +02:00
if ($config ['cops_fetch_protect'] == "1") {
session_start();
if (!isset($_SESSION['connected'])) {
$_SESSION['connected'] = 0;
}
}
2012-05-28 08:05:05 +03:00
$OPDSRender = new OPDSRenderer ();
2013-12-05 11:52:51 +02:00
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:
$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
}