summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-02-25 09:01:49 +0300
committerAndrew Dolgov <[email protected]>2017-02-25 09:01:49 +0300
commitbfbfed517b681fde380335bbb9d1d9c26abaa1fb (patch)
treed9a1ce4a8de97938ce8b2ba2e8d868610d59af66
parenta0ca4ba4d11e064d21753c810ad9ca1247eed182 (diff)
add favicon, store total pages
-rw-r--r--.gitignore1
-rw-r--r--backend.php12
-rw-r--r--img/favicon.pngbin0 -> 622 bytes
-rw-r--r--index.php1
-rw-r--r--read.html3
-rw-r--r--schema.sql1
6 files changed, 12 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4f4773f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+config.php
diff --git a/backend.php b/backend.php
index c353e5c..9ce0bfa 100644
--- a/backend.php
+++ b/backend.php
@@ -82,10 +82,11 @@
break;
case "storepagination":
- $payload = db_escape_string($_REQUEST["payload"]);
$bookid = (int) $_REQUEST["id"];
+ $payload = db_escape_string($_REQUEST["payload"]);
+ $total_pages = (int) $_REQUEST["total"];
- if ($bookid && $payload) {
+ if ($bookid && $payload && $total_pages) {
db_query($link, "BEGIN");
@@ -94,11 +95,12 @@
if (db_num_rows($result) != 0) {
$id = db_fetch_result($result, 0, "id");
- db_query($link, "UPDATE epube_pagination SET pagination = '$payload' WHERE id = '$id'");
+ db_query($link, "UPDATE epube_pagination SET pagination = '$payload',
+ total_pages = '$total_pages' WHERE id = '$id'");
} else {
- db_query($link, "INSERT INTO epube_pagination (bookid, pagination) VALUES
- ('$bookid', '$payload')");
+ db_query($link, "INSERT INTO epube_pagination (bookid, pagination, total_pages) VALUES
+ ('$bookid', '$payload', '$total_pages')");
}
diff --git a/img/favicon.png b/img/favicon.png
new file mode 100644
index 0000000..7d863f9
--- /dev/null
+++ b/img/favicon.png
Binary files differ
diff --git a/index.php b/index.php
index 1c2ca8e..d7e6397 100644
--- a/index.php
+++ b/index.php
@@ -10,6 +10,7 @@
<script src="lib/holder.min.js"></script>
<title>The Epube</title>
<link type="text/css" rel="stylesheet" media="screen" href="css/index.css" />
+ <link id="favicon" rel="shortcut icon" type="image/png" href="img/favicon.png" />
</head>
<body>
diff --git a/read.html b/read.html
index 49f57a9..bbb8d65 100644
--- a/read.html
+++ b/read.html
@@ -14,6 +14,7 @@
<script src="lib/smartimages.js"></script>
<script src="js/read.js"></script>
+ <link id="favicon" rel="shortcut icon" type="image/png" href="img/favicon.png" />
<link type="text/css" rel="stylesheet" media="screen" href="css/read.css" />
</head>
<body>
@@ -248,7 +249,7 @@
console.log("storing pagination on server");
$.post("backend.php", { op: "storepagination", id: $.urlParam("id"),
- payload: JSON.stringify(pageList) });
+ payload: JSON.stringify(pageList), total: book.pagination.totalPages });
}
$.get("backend.php", { op: "getlastread", id: $.urlParam("id") }, function(data) {
diff --git a/schema.sql b/schema.sql
index 8e425db..cd9cf95 100644
--- a/schema.sql
+++ b/schema.sql
@@ -12,6 +12,7 @@ drop table if exists epube_books;
create table epube_pagination(
id serial not null primary key,
bookid integer not null,
+ total_pages integer not null,
pagination text not null);
create table epube_books(