@@ -603,10 +603,10 @@ |
||
603 | 603 | $i = 0; |
604 | 604 | $critArray = []; |
605 | 605 | foreach ([PageQueryResult::SCOPE_AUTHOR, |
606 | - PageQueryResult::SCOPE_TAG, |
|
607 | - PageQueryResult::SCOPE_SERIES, |
|
608 | - PageQueryResult::SCOPE_PUBLISHER, |
|
609 | - PageQueryResult::SCOPE_BOOK] as $key) { |
|
606 | + PageQueryResult::SCOPE_TAG, |
|
607 | + PageQueryResult::SCOPE_SERIES, |
|
608 | + PageQueryResult::SCOPE_PUBLISHER, |
|
609 | + PageQueryResult::SCOPE_BOOK] as $key) { |
|
610 | 610 | if (in_array($key, getCurrentOption('ignored_categories')) || |
611 | 611 | (!array_key_exists($key, $query) && !array_key_exists('all', $query))) { |
612 | 612 | $critArray[$i] = self::BAD_SEARCH; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | // Generate the function for the template |
34 | 34 | $template = new doT(); |
35 | 35 | $dot = $template->template($page, ['bookdetail' => $bookdetail, |
36 | - 'header' => $header, |
|
37 | - 'footer' => $footer, |
|
38 | - 'main' => $main]); |
|
36 | + 'header' => $header, |
|
37 | + 'footer' => $footer, |
|
38 | + 'main' => $main]); |
|
39 | 39 | // If there is a syntax error in the function created |
40 | 40 | // $dot will be equal to FALSE |
41 | 41 | if (!$dot) { |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $return .= trim($error->message) . |
138 | - "\n Line: " . $error->line . |
|
139 | - "\n Column: " . $error->column; |
|
138 | + "\n Line: " . $error->line . |
|
139 | + "\n Column: " . $error->column; |
|
140 | 140 | |
141 | 141 | if ($error->file) { |
142 | 142 | $return .= "\n File: " . $error->file; |
@@ -38,14 +38,14 @@ |
||
38 | 38 | header('Content-Type:text/html;charset=utf-8'); |
39 | 39 | |
40 | 40 | $data = ['title' => $config['cops_title_default'], |
41 | - 'version' => VERSION, |
|
42 | - 'opds_url' => $config['cops_full_url'] . 'feed.php', |
|
43 | - 'customHeader' => '', |
|
44 | - 'template' => getCurrentTemplate(), |
|
45 | - 'server_side_rendering' => useServerSideRendering(), |
|
46 | - 'current_css' => getCurrentCss(), |
|
47 | - 'favico' => $config['cops_icon'], |
|
48 | - 'getjson_url' => 'getJSON.php?' . addURLParameter(getQueryString(), 'complete', 1)]; |
|
41 | + 'version' => VERSION, |
|
42 | + 'opds_url' => $config['cops_full_url'] . 'feed.php', |
|
43 | + 'customHeader' => '', |
|
44 | + 'template' => getCurrentTemplate(), |
|
45 | + 'server_side_rendering' => useServerSideRendering(), |
|
46 | + 'current_css' => getCurrentCss(), |
|
47 | + 'favico' => $config['cops_icon'], |
|
48 | + 'getjson_url' => 'getJSON.php?' . addURLParameter(getQueryString(), 'complete', 1)]; |
|
49 | 49 | if (preg_match('/Kindle/', $_SERVER['HTTP_USER_AGENT'])) { |
50 | 50 | $data['customHeader'] = '<style media="screen" type="text/css"> html { font-size: 75%; -webkit-text-size-adjust: 75%; -ms-text-size-adjust: 75%; }</style>'; |
51 | 51 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if ($data = $book->getDataFormat($format)) { |
27 | 27 | $i++; |
28 | 28 | array_push($preferedData, ["url" => $data->getHtmlLink(), |
29 | - "viewUrl" => $data->getViewHtmlLink(), "name" => $format]); |
|
29 | + "viewUrl" => $data->getViewHtmlLink(), "name" => $format]); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true); |
55 | 55 | |
56 | 56 | return ["id" => $book->id, |
57 | - "hasCover" => $book->hasCover, |
|
58 | - "preferedData" => $preferedData, |
|
59 | - "rating" => $book->getRating(), |
|
60 | - "publisherName" => $pn, |
|
61 | - "publisherurl" => $pu, |
|
62 | - "pubDate" => $book->getPubDate(), |
|
63 | - "languagesName" => $book->getLanguages(), |
|
64 | - "authorsName" => $book->getAuthorsName(), |
|
65 | - "tagsName" => $book->getTagsName(), |
|
66 | - "seriesName" => $sn, |
|
67 | - "seriesIndex" => $book->seriesIndex, |
|
68 | - "seriesCompleteName" => $scn, |
|
69 | - "seriesurl" => $su, |
|
70 | - "customcolumns_list" => $cc]; |
|
57 | + "hasCover" => $book->hasCover, |
|
58 | + "preferedData" => $preferedData, |
|
59 | + "rating" => $book->getRating(), |
|
60 | + "publisherName" => $pn, |
|
61 | + "publisherurl" => $pu, |
|
62 | + "pubDate" => $book->getPubDate(), |
|
63 | + "languagesName" => $book->getLanguages(), |
|
64 | + "authorsName" => $book->getAuthorsName(), |
|
65 | + "tagsName" => $book->getTagsName(), |
|
66 | + "seriesName" => $sn, |
|
67 | + "seriesIndex" => $book->seriesIndex, |
|
68 | + "seriesCompleteName" => $scn, |
|
69 | + "seriesurl" => $su, |
|
70 | + "customcolumns_list" => $cc]; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -154,39 +154,39 @@ discard block |
||
154 | 154 | $out = $in; |
155 | 155 | |
156 | 156 | $out ["c"] = ["version" => VERSION, "i18n" => [ |
157 | - "coverAlt" => localize("i18n.coversection"), |
|
158 | - "authorsTitle" => localize("authors.title"), |
|
159 | - "bookwordTitle" => localize("bookword.title"), |
|
160 | - "tagsTitle" => localize("tags.title"), |
|
161 | - "linksTitle" => localize("links.title"), |
|
162 | - "seriesTitle" => localize("series.title"), |
|
163 | - "customizeTitle" => localize("customize.title"), |
|
164 | - "aboutTitle" => localize("about.title"), |
|
165 | - "previousAlt" => localize("paging.previous.alternate"), |
|
166 | - "nextAlt" => localize("paging.next.alternate"), |
|
167 | - "searchAlt" => localize("search.alternate"), |
|
168 | - "sortAlt" => localize("sort.alternate"), |
|
169 | - "homeAlt" => localize("home.alternate"), |
|
170 | - "cogAlt" => localize("cog.alternate"), |
|
171 | - "permalinkAlt" => localize("permalink.alternate"), |
|
172 | - "publisherName" => localize("publisher.name"), |
|
173 | - "pubdateTitle" => localize("pubdate.title"), |
|
174 | - "languagesTitle" => localize("language.title"), |
|
175 | - "contentTitle" => localize("content.summary"), |
|
176 | - "filterClearAll" => localize("filter.clearall"), |
|
177 | - "sortorderAsc" => localize("search.sortorder.asc"), |
|
178 | - "sortorderDesc" => localize("search.sortorder.desc"), |
|
179 | - "customizeEmail" => localize("customize.email")], |
|
180 | - "url" => [ |
|
181 | - "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
182 | - "coverUrl" => "fetch.php?id={0}&db={1}", |
|
183 | - "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"], |
|
184 | - "config" => [ |
|
185 | - "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
186 | - "max_item_per_page" => $config['cops_max_item_per_page'], |
|
187 | - "kindleHack" => "", |
|
188 | - "server_side_rendering" => useServerSideRendering(), |
|
189 | - "html_tag_filter" => $config['cops_html_tag_filter']]]; |
|
157 | + "coverAlt" => localize("i18n.coversection"), |
|
158 | + "authorsTitle" => localize("authors.title"), |
|
159 | + "bookwordTitle" => localize("bookword.title"), |
|
160 | + "tagsTitle" => localize("tags.title"), |
|
161 | + "linksTitle" => localize("links.title"), |
|
162 | + "seriesTitle" => localize("series.title"), |
|
163 | + "customizeTitle" => localize("customize.title"), |
|
164 | + "aboutTitle" => localize("about.title"), |
|
165 | + "previousAlt" => localize("paging.previous.alternate"), |
|
166 | + "nextAlt" => localize("paging.next.alternate"), |
|
167 | + "searchAlt" => localize("search.alternate"), |
|
168 | + "sortAlt" => localize("sort.alternate"), |
|
169 | + "homeAlt" => localize("home.alternate"), |
|
170 | + "cogAlt" => localize("cog.alternate"), |
|
171 | + "permalinkAlt" => localize("permalink.alternate"), |
|
172 | + "publisherName" => localize("publisher.name"), |
|
173 | + "pubdateTitle" => localize("pubdate.title"), |
|
174 | + "languagesTitle" => localize("language.title"), |
|
175 | + "contentTitle" => localize("content.summary"), |
|
176 | + "filterClearAll" => localize("filter.clearall"), |
|
177 | + "sortorderAsc" => localize("search.sortorder.asc"), |
|
178 | + "sortorderDesc" => localize("search.sortorder.desc"), |
|
179 | + "customizeEmail" => localize("customize.email")], |
|
180 | + "url" => [ |
|
181 | + "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
182 | + "coverUrl" => "fetch.php?id={0}&db={1}", |
|
183 | + "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"], |
|
184 | + "config" => [ |
|
185 | + "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
186 | + "max_item_per_page" => $config['cops_max_item_per_page'], |
|
187 | + "kindleHack" => "", |
|
188 | + "server_side_rendering" => useServerSideRendering(), |
|
189 | + "html_tag_filter" => $config['cops_html_tag_filter']]]; |
|
190 | 190 | if ($config['cops_thumbnail_handling'] == "1") { |
191 | 191 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
192 | 192 | } elseif (!empty($config['cops_thumbnail_handling'])) { |
@@ -59,11 +59,11 @@ |
||
59 | 59 | $this->entryArray = []; |
60 | 60 | |
61 | 61 | $ignoredBaseArray = [PageQueryResult::SCOPE_AUTHOR, |
62 | - PageQueryResult::SCOPE_TAG, |
|
63 | - PageQueryResult::SCOPE_SERIES, |
|
64 | - PageQueryResult::SCOPE_PUBLISHER, |
|
65 | - PageQueryResult::SCOPE_RATING, |
|
66 | - "language"]; |
|
62 | + PageQueryResult::SCOPE_TAG, |
|
63 | + PageQueryResult::SCOPE_SERIES, |
|
64 | + PageQueryResult::SCOPE_PUBLISHER, |
|
65 | + PageQueryResult::SCOPE_RATING, |
|
66 | + "language"]; |
|
67 | 67 | |
68 | 68 | $content = ""; |
69 | 69 | if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) { |
@@ -56,57 +56,57 @@ |
||
56 | 56 | |
57 | 57 | switch ($type) { |
58 | 58 | // -DC- Add png type |
59 | - case 'jpg': |
|
60 | - case 'png': |
|
61 | - if ($type == 'jpg') { |
|
62 | - header('Content-Type: image/jpeg'); |
|
63 | - } else { |
|
64 | - header('Content-Type: image/png'); |
|
65 | - } |
|
66 | - //by default, we don't cache |
|
67 | - $thumbnailCacheFullpath = null; |
|
68 | - if (isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '') { |
|
69 | - $thumbnailCacheFullpath = $config['cops_thumbnail_cache_directory']; |
|
70 | - //if multiple databases, add a subfolder with the database ID |
|
71 | - $thumbnailCacheFullpath .= !is_null(GetUrlParam(DB)) ? 'db-' . GetUrlParam(DB) . DIRECTORY_SEPARATOR : ''; |
|
72 | - //when there are lots of thumbnails, it's better to save files in subfolders, so if the book's uuid is |
|
73 | - //"01234567-89ab-cdef-0123-456789abcdef", we will save the thumbnail in .../0/12/34567-89ab-cdef-0123-456789abcdef-... |
|
74 | - $thumbnailCacheFullpath .= substr($book->uuid, 0, 1) . DIRECTORY_SEPARATOR . substr($book->uuid, 1, 2) . DIRECTORY_SEPARATOR; |
|
75 | - //check if cache folder exists or create it |
|
76 | - if (file_exists($thumbnailCacheFullpath) || mkdir($thumbnailCacheFullpath, 0700, true)) { |
|
77 | - //we name the thumbnail from the book's uuid and it's dimensions (width and/or height) |
|
78 | - $thumbnailCacheName = substr($book->uuid, 3) . '-' . getURLParam('width') . 'x' . getURLParam('height') . '.' . $type; |
|
79 | - $thumbnailCacheFullpath = $thumbnailCacheFullpath . $thumbnailCacheName; |
|
59 | + case 'jpg': |
|
60 | + case 'png': |
|
61 | + if ($type == 'jpg') { |
|
62 | + header('Content-Type: image/jpeg'); |
|
80 | 63 | } else { |
81 | - //error creating the folder, so we don't cache |
|
82 | - $thumbnailCacheFullpath = null; |
|
64 | + header('Content-Type: image/png'); |
|
65 | + } |
|
66 | + //by default, we don't cache |
|
67 | + $thumbnailCacheFullpath = null; |
|
68 | + if (isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '') { |
|
69 | + $thumbnailCacheFullpath = $config['cops_thumbnail_cache_directory']; |
|
70 | + //if multiple databases, add a subfolder with the database ID |
|
71 | + $thumbnailCacheFullpath .= !is_null(GetUrlParam(DB)) ? 'db-' . GetUrlParam(DB) . DIRECTORY_SEPARATOR : ''; |
|
72 | + //when there are lots of thumbnails, it's better to save files in subfolders, so if the book's uuid is |
|
73 | + //"01234567-89ab-cdef-0123-456789abcdef", we will save the thumbnail in .../0/12/34567-89ab-cdef-0123-456789abcdef-... |
|
74 | + $thumbnailCacheFullpath .= substr($book->uuid, 0, 1) . DIRECTORY_SEPARATOR . substr($book->uuid, 1, 2) . DIRECTORY_SEPARATOR; |
|
75 | + //check if cache folder exists or create it |
|
76 | + if (file_exists($thumbnailCacheFullpath) || mkdir($thumbnailCacheFullpath, 0700, true)) { |
|
77 | + //we name the thumbnail from the book's uuid and it's dimensions (width and/or height) |
|
78 | + $thumbnailCacheName = substr($book->uuid, 3) . '-' . getURLParam('width') . 'x' . getURLParam('height') . '.' . $type; |
|
79 | + $thumbnailCacheFullpath = $thumbnailCacheFullpath . $thumbnailCacheName; |
|
80 | + } else { |
|
81 | + //error creating the folder, so we don't cache |
|
82 | + $thumbnailCacheFullpath = null; |
|
83 | + } |
|
83 | 84 | } |
84 | - } |
|
85 | - |
|
86 | - if ($thumbnailCacheFullpath !== null && file_exists($thumbnailCacheFullpath)) { |
|
87 | - //return the already cached thumbnail |
|
88 | - readfile($thumbnailCacheFullpath); |
|
89 | - return; |
|
90 | - } |
|
91 | 85 | |
92 | - $width = getURLParam('width'); |
|
93 | - $height = getURLParam('height'); |
|
94 | - if ($book->getThumbnail($width, $height, $thumbnailCacheFullpath, $type)) { |
|
95 | - //if we don't cache the thumbnail, imagejpeg() in $book->getThumbnail() already return the image data |
|
96 | - if ($thumbnailCacheFullpath === null) { |
|
97 | - // The cover had to be resized |
|
98 | - return; |
|
99 | - } else { |
|
100 | - //return the just cached thumbnail |
|
86 | + if ($thumbnailCacheFullpath !== null && file_exists($thumbnailCacheFullpath)) { |
|
87 | + //return the already cached thumbnail |
|
101 | 88 | readfile($thumbnailCacheFullpath); |
102 | 89 | return; |
103 | 90 | } |
104 | - } |
|
105 | - break; |
|
106 | - default: |
|
107 | - $data = $book->getDataById($idData); |
|
108 | - header('Content-Type: ' . $data->getMimeType()); |
|
109 | - break; |
|
91 | + |
|
92 | + $width = getURLParam('width'); |
|
93 | + $height = getURLParam('height'); |
|
94 | + if ($book->getThumbnail($width, $height, $thumbnailCacheFullpath, $type)) { |
|
95 | + //if we don't cache the thumbnail, imagejpeg() in $book->getThumbnail() already return the image data |
|
96 | + if ($thumbnailCacheFullpath === null) { |
|
97 | + // The cover had to be resized |
|
98 | + return; |
|
99 | + } else { |
|
100 | + //return the just cached thumbnail |
|
101 | + readfile($thumbnailCacheFullpath); |
|
102 | + return; |
|
103 | + } |
|
104 | + } |
|
105 | + break; |
|
106 | + default: |
|
107 | + $data = $book->getDataById($idData); |
|
108 | + header('Content-Type: ' . $data->getMimeType()); |
|
109 | + break; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // absolute path for single DB in PHP app here - cfr. internal dir for X-Accel-Redirect with Nginx |