2012-06-02 09:48:07 +03:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
2012-06-12 23:52:39 +03:00
|
|
|
|
* COPS (Calibre OPDS PHP Server) HTML main script
|
2012-06-02 09:48:07 +03:00
|
|
|
|
*
|
|
|
|
|
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
2012-09-03 16:57:35 +03:00
|
|
|
|
* @author S<EFBFBD>bastien Lucas <sebastien@slucas.fr>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
require_once ("config.php");
|
|
|
|
|
require_once ("base.php");
|
|
|
|
|
require_once ("author.php");
|
|
|
|
|
require_once ("serie.php");
|
|
|
|
|
require_once ("tag.php");
|
2013-01-19 08:08:47 +02:00
|
|
|
|
require_once ("customcolumn.php");
|
2012-06-02 09:48:07 +03:00
|
|
|
|
require_once ("book.php");
|
|
|
|
|
|
2013-02-28 17:26:15 +02:00
|
|
|
|
// If we detect that an OPDS reader try to connect try to redirect to feed.php
|
|
|
|
|
if (preg_match("/(MantanoReader|FBReader|Stanza|Aldiko|Moon+ Reader)/", $_SERVER['HTTP_USER_AGENT'])) {
|
|
|
|
|
header("location: feed.php");
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-02 09:48:07 +03:00
|
|
|
|
header ("Content-Type:application/xhtml+xml");
|
|
|
|
|
$page = getURLParam ("page", Base::PAGE_INDEX);
|
|
|
|
|
$query = getURLParam ("query");
|
|
|
|
|
$qid = getURLParam ("id");
|
2012-09-19 19:20:01 +03:00
|
|
|
|
$n = getURLParam ("n", "1");
|
2012-06-02 09:48:07 +03:00
|
|
|
|
|
2012-09-19 19:20:01 +03:00
|
|
|
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
2012-06-02 09:48:07 +03:00
|
|
|
|
$currentPage->InitializeContent ();
|
2012-09-02 01:54:22 +03:00
|
|
|
|
|
|
|
|
|
/* Test to see if pages are opened on an Eink screen
|
2013-02-28 17:31:59 +02:00
|
|
|
|
* test Kindle, Kobo Touch and Sony PRS-T1 Ereader.
|
|
|
|
|
* HTTP_USER_AGENT = "Mozilla/5.0 (Linux; U; en-us; EBRD1101; EXT) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
|
|
|
|
|
*/
|
2012-09-02 01:54:22 +03:00
|
|
|
|
|
2013-02-28 17:31:59 +02:00
|
|
|
|
if (preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
2012-09-02 01:54:22 +03:00
|
|
|
|
$isEink = 1;
|
|
|
|
|
} else {
|
|
|
|
|
$isEink = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-06-02 09:48:07 +03:00
|
|
|
|
?>
|
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
|
|
|
<meta http-equiv="imagetoolbar" content="no" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" />
|
2012-09-03 17:01:46 +03:00
|
|
|
|
<title><?php echo htmlspecialchars ($currentPage->title) ?></title>
|
2012-09-20 05:23:19 +03:00
|
|
|
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
|
2012-12-03 17:30:35 +02:00
|
|
|
|
<script type="text/javascript" src="fancybox/jquery.fancybox.pack.js?v=2.1.3"></script>
|
2012-06-20 23:01:19 +03:00
|
|
|
|
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.sortElements.js") ?>"></script>
|
2013-01-06 10:22:47 +02:00
|
|
|
|
<link rel="related" href="feed.php" type="application/atom+xml;profile=opds-catalog" title="<?php echo $config['cops_title_default']; ?>" />
|
2012-12-22 19:03:52 +02:00
|
|
|
|
<link rel="icon" type="image/vnd.microsoft.icon" href="<?php echo $currentPage->favicon ?>" />
|
2012-12-03 17:30:35 +02:00
|
|
|
|
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox.css?v=2.1.3" media="screen" />
|
2012-06-02 10:10:54 +03:00
|
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("style.css") ?>" media="screen" />
|
2012-06-02 09:48:07 +03:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
// Handler for .ready() called.
|
|
|
|
|
$(".entry").click(function(){
|
|
|
|
|
window.location=$(this).find("a").attr("href");
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
2012-06-20 23:01:19 +03:00
|
|
|
|
$("#sort").click(function(){
|
|
|
|
|
$('.book').sortElements(function(a, b){
|
2012-06-20 23:33:57 +03:00
|
|
|
|
var test = 1;
|
|
|
|
|
if ($("#sortorder").val() == "desc")
|
|
|
|
|
{
|
|
|
|
|
test = -1;
|
|
|
|
|
}
|
|
|
|
|
return $(a).find ("." + $("#sortchoice").val()).text() > $(b).find ("." + $("#sortchoice").val()).text() ? test : -test;
|
2012-06-20 23:01:19 +03:00
|
|
|
|
});
|
2012-06-20 23:23:23 +03:00
|
|
|
|
$("#search").slideUp();
|
2012-06-20 23:01:19 +03:00
|
|
|
|
});
|
|
|
|
|
|
2012-12-10 07:06:45 +02:00
|
|
|
|
<?php if ($config['cops_use_fancyapps'] == 1) { ?>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
$(".fancycover").fancybox({
|
|
|
|
|
'type' : 'image',
|
2012-07-21 18:50:27 +03:00
|
|
|
|
prevEffect : 'none',
|
2012-09-30 16:38:09 +03:00
|
|
|
|
nextEffect : 'none'
|
|
|
|
|
<?php if ($isEink) echo ", openEffect : 'none', closeEffect : 'none', helpers : {overlay : null}"; ?>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
});
|
2012-12-10 07:06:45 +02:00
|
|
|
|
<?php } ?>
|
2012-06-13 18:28:54 +03:00
|
|
|
|
|
2012-10-20 07:54:13 +03:00
|
|
|
|
$(".fancyabout").fancybox({
|
|
|
|
|
'type' : 'ajax',
|
|
|
|
|
title : 'COPS <?php echo VERSION ?>',
|
|
|
|
|
prevEffect : 'none',
|
|
|
|
|
nextEffect : 'none'
|
|
|
|
|
<?php if ($isEink) echo ", openEffect : 'none', closeEffect : 'none', helpers : {overlay : null}"; ?>
|
|
|
|
|
});
|
|
|
|
|
|
2012-06-13 18:28:54 +03:00
|
|
|
|
$("#searchImage").click(function(){
|
|
|
|
|
if ($("#search").is(":hidden")) {
|
|
|
|
|
$("#search").slideDown("slow");
|
|
|
|
|
} else {
|
2012-06-13 22:21:13 +03:00
|
|
|
|
$("#search").slideUp();
|
2012-06-13 18:28:54 +03:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2012-06-02 09:48:07 +03:00
|
|
|
|
$(".bookdetail").click(function(){
|
|
|
|
|
var url = $(this).find("a").attr("href");
|
2012-12-10 07:06:45 +02:00
|
|
|
|
<?php if ($config['cops_use_fancyapps'] == 0) { ?>
|
|
|
|
|
window.location = url;
|
|
|
|
|
<?php } else { ?>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
$('#content').load(url, function(data, stat, req){
|
2012-07-21 16:23:49 +03:00
|
|
|
|
$.fancybox( {
|
2012-09-30 16:38:09 +03:00
|
|
|
|
content: data,
|
|
|
|
|
autoSize: true
|
|
|
|
|
<?php if ($isEink) echo ", margin : [15, 35, 10, 10], openEffect : 'none', closeEffect : 'none', helpers : {overlay : null}"; ?>
|
2012-07-21 16:23:49 +03:00
|
|
|
|
} );
|
2012-06-02 09:48:07 +03:00
|
|
|
|
});
|
2012-12-10 07:06:45 +02:00
|
|
|
|
<?php } ?>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
});
|
2012-10-11 22:43:37 +03:00
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
if ($currentPage->isPaginated ()) {
|
|
|
|
|
$prevLink = $currentPage->getPrevLink ();
|
|
|
|
|
$nextLink = $currentPage->getNextLink ();
|
|
|
|
|
?>
|
|
|
|
|
$(document).keydown(function(e){
|
|
|
|
|
<?php
|
|
|
|
|
if (!is_null ($prevLink)) {
|
|
|
|
|
echo "if (e.keyCode == 37) {\$(location).attr('href','" . $prevLink->hrefXhtml () . "');}";
|
|
|
|
|
}
|
|
|
|
|
if (!is_null ($nextLink)) {
|
|
|
|
|
echo "if (e.keyCode == 39) {\$(location).attr('href','" . $nextLink->hrefXhtml () . "');}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
});
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div id="loading">
|
|
|
|
|
<p><img src="images/ajax-loader.gif" alt="waiting" /> Please Wait</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="container">
|
|
|
|
|
<div class="head">
|
|
|
|
|
<div class="headleft">
|
|
|
|
|
<a href="<?php echo $_SERVER["SCRIPT_NAME"] ?>">
|
2012-06-02 10:10:54 +03:00
|
|
|
|
<img src="<?php echo getUrlWithVersion("images/home.png") ?>" alt="Home" />
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="headright">
|
2012-06-18 21:59:45 +03:00
|
|
|
|
<img id="searchImage" src="<?php echo getUrlWithVersion("images/setting64.png") ?>" alt="Settings and menu" />
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</div>
|
|
|
|
|
<div class="headcenter">
|
2012-09-03 17:01:46 +03:00
|
|
|
|
<p><?php echo htmlspecialchars ($currentPage->title) ?></p>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="clearer" />
|
2012-06-17 21:49:26 +03:00
|
|
|
|
<div class="menu">
|
|
|
|
|
<div id="search" class="search">
|
|
|
|
|
<form action="index.php?page=9" method="get">
|
2012-06-18 21:59:45 +03:00
|
|
|
|
<input type="text" name="query" />
|
2012-06-17 21:49:26 +03:00
|
|
|
|
<input type="hidden" name="page" value="9" />
|
2012-06-18 21:59:45 +03:00
|
|
|
|
<input type="image" src="images/search32.png" alt="Search" />
|
2012-06-17 21:49:26 +03:00
|
|
|
|
</form>
|
|
|
|
|
<form action="index.php?page=9" method="get">
|
2012-07-01 22:17:19 +03:00
|
|
|
|
<select id="sortchoice">
|
2012-06-20 23:01:19 +03:00
|
|
|
|
<option value="st"><?php echo localize("bookword.title") ?></option>
|
|
|
|
|
<option value="sa"><?php echo localize("authors.title") ?></option>
|
2012-06-20 23:23:23 +03:00
|
|
|
|
<option value="ss"><?php echo localize("series.title") ?></option>
|
|
|
|
|
<option value="sp"><?php echo localize("content.published") ?></option>
|
2012-06-20 23:33:57 +03:00
|
|
|
|
</select>
|
2012-07-01 22:17:19 +03:00
|
|
|
|
<select id="sortorder">
|
2012-06-20 23:33:57 +03:00
|
|
|
|
<option value="asc">Asc</option>
|
|
|
|
|
<option value="desc">Desc</option>
|
2012-06-17 21:49:26 +03:00
|
|
|
|
</select>
|
2012-06-20 23:01:19 +03:00
|
|
|
|
<img id="sort" src="images/sort32.png" alt="Sort" />
|
2012-06-17 21:49:26 +03:00
|
|
|
|
</form>
|
|
|
|
|
</div>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</div>
|
2012-06-13 22:21:13 +03:00
|
|
|
|
<div class="clearer" />
|
2012-06-02 09:48:07 +03:00
|
|
|
|
<div id="content" style="display: none;"></div>
|
|
|
|
|
<div class="entries">
|
|
|
|
|
<?php
|
2012-12-10 07:06:45 +02:00
|
|
|
|
if ($page == Base::PAGE_BOOK_DETAIL)
|
|
|
|
|
{
|
|
|
|
|
include ("bookdetail.php");
|
|
|
|
|
}
|
2012-06-02 09:48:07 +03:00
|
|
|
|
foreach ($currentPage->entryArray as $entry) {
|
|
|
|
|
if (get_class ($entry) != "EntryBook") {
|
|
|
|
|
?>
|
|
|
|
|
<div class="entry">
|
2012-06-17 21:49:26 +03:00
|
|
|
|
<div class="entryTitle"><?php echo htmlspecialchars ($entry->title) ?></div>
|
|
|
|
|
<div class="entryContent"><?php echo htmlspecialchars ($entry->content) ?></div>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
<?php
|
|
|
|
|
foreach ($entry->linkArray as $link) {
|
|
|
|
|
?>
|
|
|
|
|
<a href="<?php echo $link->hrefXhtml () ?>" class="navigation">nav</a>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
?>
|
|
|
|
|
<div class="book">
|
|
|
|
|
<div class="cover">
|
2012-06-24 09:51:49 +03:00
|
|
|
|
<?php
|
|
|
|
|
if ($entry->book->hasCover) {
|
|
|
|
|
?>
|
2013-01-06 10:28:49 +02:00
|
|
|
|
<a rel="group" class="fancycover" href="<?php echo $entry->getCover () ?>"><img src="<?php echo $entry->getCoverThumbnail () ?>" alt="<?php echo localize("i18n.coversection") ?>" /></a>
|
2012-06-24 09:51:49 +03:00
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</div>
|
|
|
|
|
<div class="download">
|
|
|
|
|
<?php
|
2012-07-01 15:59:18 +03:00
|
|
|
|
$i = 0;
|
2012-06-24 09:16:47 +03:00
|
|
|
|
foreach ($config['cops_prefered_format'] as $format)
|
|
|
|
|
{
|
2012-07-01 15:59:18 +03:00
|
|
|
|
if ($i == 2) { break; }
|
2012-06-26 15:45:09 +03:00
|
|
|
|
if ($data = $entry->book->getDataFormat ($format)) {
|
2012-07-01 15:59:18 +03:00
|
|
|
|
$i++;
|
2012-06-02 09:48:07 +03:00
|
|
|
|
?>
|
2012-06-26 15:45:09 +03:00
|
|
|
|
<div class="button buttonEffect"><a href="<?php echo $data->getHtmlLink () ?>"><?php echo $format ?></a></div>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
<?php
|
2012-06-24 09:16:47 +03:00
|
|
|
|
}
|
2012-06-02 09:48:07 +03:00
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="bookdetail">
|
2013-01-03 22:40:43 +02:00
|
|
|
|
<a class="navigation" href="<?php echo $entry->book->getDetailUrl () ?>" />
|
2013-02-20 22:06:37 +02:00
|
|
|
|
<div class="entryTitle st"><?php echo htmlspecialchars ($entry->title) ?>
|
|
|
|
|
<?php
|
|
|
|
|
if ($entry->book->getPubDate() != "")
|
|
|
|
|
{
|
|
|
|
|
?>
|
|
|
|
|
<span class="sp">(<?php echo $entry->book->getPubDate() ?>)</span>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<span class="sr"><?php echo $entry->book->getRating () ?></span>
|
|
|
|
|
</div>
|
2012-06-20 23:01:19 +03:00
|
|
|
|
<div class="entryContent sa"><?php echo localize("authors.title") . " : " . htmlspecialchars ($entry->book->getAuthorsName ()) ?></div>
|
2012-06-18 15:12:12 +03:00
|
|
|
|
<div class="entryContent"><?php echo localize("tags.title") . " : " . htmlspecialchars ($entry->book->getTagsName ()) ?></div>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
<?php
|
|
|
|
|
$serie = $entry->book->getSerie ();
|
|
|
|
|
if (!is_null ($serie)) {
|
|
|
|
|
?>
|
2012-06-20 23:23:23 +03:00
|
|
|
|
<div class="entryContent ss"><?php echo localize("series.title") . " : " . htmlspecialchars ($serie->name) . " (" . $entry->book->seriesIndex . ")" ?></div>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<div class="clearer" />
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
2012-10-20 07:54:13 +03:00
|
|
|
|
<div class="foot">
|
|
|
|
|
<div class="footright">
|
|
|
|
|
<a class="fancyabout" href="about.xml"><img src="<?php echo getUrlWithVersion("images/info.png") ?>" alt="Home" /></a>
|
|
|
|
|
</div>
|
2012-09-21 14:36:52 +03:00
|
|
|
|
<?php
|
2012-09-21 15:19:11 +03:00
|
|
|
|
if ($currentPage->isPaginated ()) {
|
2012-09-21 14:36:52 +03:00
|
|
|
|
?>
|
2012-10-20 07:54:13 +03:00
|
|
|
|
|
2012-10-11 22:14:06 +03:00
|
|
|
|
<div class="footcenter">
|
2012-09-21 14:36:52 +03:00
|
|
|
|
<?php
|
|
|
|
|
if (!is_null ($prevLink)) {
|
|
|
|
|
?>
|
2012-10-11 22:14:06 +03:00
|
|
|
|
<a href="<?php echo $prevLink->hrefXhtml () ?>" ><img src="<?php echo getUrlWithVersion("images/previous.png") ?>" alt="Previous" /></a>
|
2012-09-21 14:36:52 +03:00
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
2012-10-11 22:14:06 +03:00
|
|
|
|
<p><?php echo " " . $currentPage->n . " / " . $currentPage->getMaxPage () . " " ?></p>
|
2012-09-21 14:36:52 +03:00
|
|
|
|
<?php
|
|
|
|
|
if (!is_null ($nextLink)) {
|
|
|
|
|
?>
|
2012-10-11 22:14:06 +03:00
|
|
|
|
<a href="<?php echo $nextLink->hrefXhtml () ?>" ><img src="<?php echo getUrlWithVersion("images/next.png") ?>" alt="Next" /></a>
|
2012-09-21 14:36:52 +03:00
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
2012-10-11 22:14:06 +03:00
|
|
|
|
</div>
|
2012-09-21 14:36:52 +03:00
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
2012-10-20 07:54:13 +03:00
|
|
|
|
</div>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</div>
|
|
|
|
|
</body>
|
2012-09-20 05:23:19 +03:00
|
|
|
|
</html>
|