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-05-21 20:49:21 +03:00
|
|
|
|
require_once ("language.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");
|
2013-03-01 18:48:25 +02:00
|
|
|
|
exit ();
|
2013-02-28 17:26:15 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-03 09:10:30 +02:00
|
|
|
|
$withToolbar = false;
|
|
|
|
|
if (!isset($_COOKIE['toolbar'])) $withToolbar = true;
|
|
|
|
|
|
2013-05-04 05:46:10 +03:00
|
|
|
|
header ("Content-Type:application/xhtml+xml;charset=utf-8");
|
2012-06-02 09:48:07 +03:00
|
|
|
|
$page = getURLParam ("page", Base::PAGE_INDEX);
|
|
|
|
|
$query = getURLParam ("query");
|
|
|
|
|
$qid = getURLParam ("id");
|
2012-09-19 19:20:01 +03:00
|
|
|
|
$n = getURLParam ("n", "1");
|
2013-04-08 18:28:45 +03:00
|
|
|
|
$database = GetUrlParam (DB);
|
2012-06-02 09:48:07 +03:00
|
|
|
|
|
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-05-15 22:19:31 +03:00
|
|
|
|
if (preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
|
|
|
|
|
$isEink = 1;
|
|
|
|
|
} else {
|
|
|
|
|
$isEink = 0;
|
|
|
|
|
}
|
2012-09-02 01:54:22 +03:00
|
|
|
|
|
|
|
|
|
|
2012-06-02 09:48:07 +03:00
|
|
|
|
?>
|
2013-02-28 16:41:21 +02:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
2012-06-02 09:48:07 +03:00
|
|
|
|
<head>
|
2013-05-16 18:12:19 +03:00
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
2013-06-15 09:03:22 +03:00
|
|
|
|
<title>COPS</title>
|
2013-04-17 14:42:23 +03:00
|
|
|
|
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery-1.9.1.min.js") ?>"></script>
|
2013-03-03 09:10:30 +02:00
|
|
|
|
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.cookies.js") ?>"></script>
|
2013-05-29 22:30:37 +03:00
|
|
|
|
<?php if (getCurrentOption ('use_fancyapps') == 1) { ?>
|
2013-05-06 18:49:22 +03:00
|
|
|
|
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/fancybox/jquery.fancybox.pack.js") ?>"></script>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/fancybox/jquery.fancybox.css") ?>" media="screen" />
|
2013-05-06 18:45:27 +03:00
|
|
|
|
<?php } ?>
|
2012-06-20 23:01:19 +03:00
|
|
|
|
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.sortElements.js") ?>"></script>
|
2013-06-15 09:03:22 +03:00
|
|
|
|
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/doT/doT.min.js") ?>"></script>
|
|
|
|
|
<script type="text/javascript" src="<?php echo getUrlWithVersion("util.js") ?>"></script>
|
2013-03-08 10:43:37 +02:00
|
|
|
|
<link rel="related" href="<?php echo $config['cops_full_url'] ?>feed.php" type="application/atom+xml;profile=opds-catalog" title="<?php echo $config['cops_title_default']; ?>" />
|
2013-06-15 09:03:22 +03:00
|
|
|
|
<link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
|
2013-05-17 09:22:52 +03:00
|
|
|
|
<link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Open+Sans:400,300italic,800,300,400italic,600,600italic,700,700italic,800italic' />
|
2013-05-28 08:49:52 +03:00
|
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" />
|
2013-05-17 07:36:38 +03:00
|
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/normalize/normalize.css") ?>" />
|
2012-06-02 09:48:07 +03:00
|
|
|
|
<script type="text/javascript">
|
2013-06-15 09:03:22 +03:00
|
|
|
|
var template, result;
|
|
|
|
|
|
|
|
|
|
function ajaxifyLinks () {
|
|
|
|
|
if (history.pushState) {
|
|
|
|
|
$("a[href^='index']").click (function (event) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
|
|
var url = $(this).attr('href');
|
|
|
|
|
jsonurl = url.replace ("index", "getJSON");
|
|
|
|
|
$.getJSON(jsonurl, function(data) {
|
|
|
|
|
history.pushState(data, "", url);
|
|
|
|
|
result = template (data);
|
|
|
|
|
document.title = data.title;
|
|
|
|
|
$(".container").html (result);
|
|
|
|
|
|
|
|
|
|
ajaxifyLinks ();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.onpopstate = function(event) {
|
|
|
|
|
//alert("location: " + document.location + ", state: " + JSON.stringify(event.state));
|
|
|
|
|
result = template (event.state);
|
|
|
|
|
document.title = event.state.title;
|
|
|
|
|
$(".container").html (result);
|
|
|
|
|
|
|
|
|
|
ajaxifyLinks ();
|
|
|
|
|
};
|
|
|
|
|
|
2012-06-02 09:48:07 +03:00
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
// Handler for .ready() called.
|
|
|
|
|
|
2012-06-20 23:01:19 +03:00
|
|
|
|
$("#sort").click(function(){
|
2013-05-16 18:51:09 +03:00
|
|
|
|
$('.books').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
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2013-05-29 22:30:37 +03:00
|
|
|
|
<?php if (getCurrentOption ('use_fancyapps') == 1) { ?>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
$(".fancycover").fancybox({
|
|
|
|
|
'type' : 'image',
|
2013-05-15 22:19:31 +03:00
|
|
|
|
prevEffect : 'none',
|
|
|
|
|
nextEffect : 'none'
|
2012-09-30 16:38:09 +03:00
|
|
|
|
<?php if ($isEink) echo ", openEffect : 'none', closeEffect : 'none', helpers : {overlay : null}"; ?>
|
2012-06-02 09:48:07 +03:00
|
|
|
|
});
|
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 ?>',
|
2013-05-15 22:19:31 +03:00
|
|
|
|
prevEffect : 'none',
|
|
|
|
|
nextEffect : 'none'
|
2012-10-20 07:54:13 +03:00
|
|
|
|
<?php if ($isEink) echo ", openEffect : 'none', closeEffect : 'none', helpers : {overlay : null}"; ?>
|
|
|
|
|
});
|
2013-05-17 07:36:38 +03:00
|
|
|
|
|
|
|
|
|
$(".fancydetail").fancybox({
|
|
|
|
|
'type' : 'ajax',
|
|
|
|
|
prevEffect : 'none',
|
|
|
|
|
nextEffect : 'none'
|
|
|
|
|
<?php if ($isEink) echo ", openEffect : 'none', closeEffect : 'none', helpers : {overlay : null}"; ?>
|
|
|
|
|
});
|
2013-04-21 16:00:21 +03:00
|
|
|
|
<?php } ?>
|
2012-10-20 07:54:13 +03:00
|
|
|
|
|
2013-03-06 09:02:03 +02:00
|
|
|
|
$(".headright").click(function(){
|
2013-03-01 18:45:55 +02:00
|
|
|
|
if ($("#tool").is(":hidden")) {
|
|
|
|
|
$("#tool").slideDown("slow");
|
2013-03-03 09:10:30 +02:00
|
|
|
|
$.cookie('toolbar', '1');
|
2012-06-13 18:28:54 +03:00
|
|
|
|
} else {
|
2013-03-01 18:45:55 +02:00
|
|
|
|
$("#tool").slideUp();
|
2013-03-03 09:10:30 +02:00
|
|
|
|
$.removeCookie('toolbar');
|
2012-06-13 18:28:54 +03:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2013-06-15 09:03:22 +03:00
|
|
|
|
$.get('templates/default/frontpage.html', function(data){
|
|
|
|
|
template = doT.template(data);
|
|
|
|
|
$.getJSON('<?php echo "getJSON.php?" . str_replace ("&", "&", $_SERVER["QUERY_STRING"]); ?>', function(data) {
|
|
|
|
|
result = template (data);
|
|
|
|
|
document.title = data.title;
|
|
|
|
|
$(".container").html (result);
|
|
|
|
|
|
|
|
|
|
ajaxifyLinks ();
|
|
|
|
|
});
|
|
|
|
|
});
|
2012-06-02 09:48:07 +03:00
|
|
|
|
});
|
2013-06-15 09:03:22 +03:00
|
|
|
|
|
|
|
|
|
|
2012-10-11 22:43:37 +03:00
|
|
|
|
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2013-06-15 09:03:22 +03:00
|
|
|
|
<div id="content" style="display: none;"></div>
|
|
|
|
|
<div class="container">
|
2012-06-02 09:48:07 +03:00
|
|
|
|
</div>
|
|
|
|
|
</body>
|
2012-09-20 05:23:19 +03:00
|
|
|
|
</html>
|