diff options
author | Andrew Dolgov <[email protected]> | 2017-02-25 09:01:49 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-02-25 09:01:49 +0300 |
commit | bfbfed517b681fde380335bbb9d1d9c26abaa1fb (patch) | |
tree | d9a1ce4a8de97938ce8b2ba2e8d868610d59af66 | |
parent | a0ca4ba4d11e064d21753c810ad9ca1247eed182 (diff) |
add favicon, store total pages
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | backend.php | 12 | ||||
-rw-r--r-- | img/favicon.png | bin | 0 -> 622 bytes | |||
-rw-r--r-- | index.php | 1 | ||||
-rw-r--r-- | read.html | 3 | ||||
-rw-r--r-- | schema.sql | 1 |
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 Binary files differnew file mode 100644 index 0000000..7d863f9 --- /dev/null +++ b/img/favicon.png @@ -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> @@ -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) { @@ -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( |