@@ -37,14 +37,14 @@ |
||
37 | 37 | header('Content-Type:text/html;charset=utf-8'); |
38 | 38 | |
39 | 39 | $data = array('title' => $config['cops_title_default'], |
40 | - 'version' => VERSION, |
|
41 | - 'opds_url' => $config['cops_full_url'] . 'feed.php', |
|
42 | - 'customHeader' => '', |
|
43 | - 'template' => getCurrentTemplate(), |
|
44 | - 'server_side_rendering' => useServerSideRendering(), |
|
45 | - 'current_css' => getCurrentCss(), |
|
46 | - 'favico' => $config['cops_icon'], |
|
47 | - 'getjson_url' => 'getJSON.php?' . addURLParameter(getQueryString(), 'complete', 1)); |
|
40 | + 'version' => VERSION, |
|
41 | + 'opds_url' => $config['cops_full_url'] . 'feed.php', |
|
42 | + 'customHeader' => '', |
|
43 | + 'template' => getCurrentTemplate(), |
|
44 | + 'server_side_rendering' => useServerSideRendering(), |
|
45 | + 'current_css' => getCurrentCss(), |
|
46 | + 'favico' => $config['cops_icon'], |
|
47 | + 'getjson_url' => 'getJSON.php?' . addURLParameter(getQueryString(), 'complete', 1)); |
|
48 | 48 | if (preg_match('/Kindle/', $_SERVER['HTTP_USER_AGENT'])) { |
49 | 49 | $data['customHeader'] = '<style media="screen" type="text/css"> html { font-size: 75%; -webkit-text-size-adjust: 75%; -ms-text-size-adjust: 75%; }</style>'; |
50 | 50 | } |
@@ -26,56 +26,56 @@ discard block |
||
26 | 26 | * Transliterated text. |
27 | 27 | */ |
28 | 28 | function _transliteration_process($string, $unknown = '?', $source_langcode = NULL) { |
29 | - // ASCII is always valid NFC! If we're only ever given plain ASCII, we can |
|
30 | - // avoid the overhead of initializing the decomposition tables by skipping |
|
31 | - // out early. |
|
32 | - if (!preg_match('/[\x80-\xff]/', $string)) { |
|
29 | + // ASCII is always valid NFC! If we're only ever given plain ASCII, we can |
|
30 | + // avoid the overhead of initializing the decomposition tables by skipping |
|
31 | + // out early. |
|
32 | + if (!preg_match('/[\x80-\xff]/', $string)) { |
|
33 | 33 | return $string; |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | - static $tail_bytes; |
|
36 | + static $tail_bytes; |
|
37 | 37 | |
38 | - if (!isset($tail_bytes)) { |
|
38 | + if (!isset($tail_bytes)) { |
|
39 | 39 | // Each UTF-8 head byte is followed by a certain number of tail bytes. |
40 | 40 | $tail_bytes = array(); |
41 | 41 | for ($n = 0; $n < 256; $n++) { |
42 | - if ($n < 0xc0) { |
|
42 | + if ($n < 0xc0) { |
|
43 | 43 | $remaining = 0; |
44 | - } |
|
45 | - elseif ($n < 0xe0) { |
|
44 | + } |
|
45 | + elseif ($n < 0xe0) { |
|
46 | 46 | $remaining = 1; |
47 | - } |
|
48 | - elseif ($n < 0xf0) { |
|
47 | + } |
|
48 | + elseif ($n < 0xf0) { |
|
49 | 49 | $remaining = 2; |
50 | - } |
|
51 | - elseif ($n < 0xf8) { |
|
50 | + } |
|
51 | + elseif ($n < 0xf8) { |
|
52 | 52 | $remaining = 3; |
53 | - } |
|
54 | - elseif ($n < 0xfc) { |
|
53 | + } |
|
54 | + elseif ($n < 0xfc) { |
|
55 | 55 | $remaining = 4; |
56 | - } |
|
57 | - elseif ($n < 0xfe) { |
|
56 | + } |
|
57 | + elseif ($n < 0xfe) { |
|
58 | 58 | $remaining = 5; |
59 | - } |
|
60 | - else { |
|
59 | + } |
|
60 | + else { |
|
61 | 61 | $remaining = 0; |
62 | - } |
|
63 | - $tail_bytes[chr($n)] = $remaining; |
|
62 | + } |
|
63 | + $tail_bytes[chr($n)] = $remaining; |
|
64 | + } |
|
64 | 65 | } |
65 | - } |
|
66 | 66 | |
67 | - // Chop the text into pure-ASCII and non-ASCII areas; large ASCII parts can |
|
68 | - // be handled much more quickly. Don't chop up Unicode areas for punctuation, |
|
69 | - // though, that wastes energy. |
|
70 | - preg_match_all('/[\x00-\x7f]+|[\x80-\xff][\x00-\x40\x5b-\x5f\x7b-\xff]*/', $string, $matches); |
|
67 | + // Chop the text into pure-ASCII and non-ASCII areas; large ASCII parts can |
|
68 | + // be handled much more quickly. Don't chop up Unicode areas for punctuation, |
|
69 | + // though, that wastes energy. |
|
70 | + preg_match_all('/[\x00-\x7f]+|[\x80-\xff][\x00-\x40\x5b-\x5f\x7b-\xff]*/', $string, $matches); |
|
71 | 71 | |
72 | - $result = ''; |
|
73 | - foreach ($matches[0] as $str) { |
|
72 | + $result = ''; |
|
73 | + foreach ($matches[0] as $str) { |
|
74 | 74 | if ($str[0] < "\x80") { |
75 | - // ASCII chunk: guaranteed to be valid UTF-8 and in normal form C, so |
|
76 | - // skip over it. |
|
77 | - $result .= $str; |
|
78 | - continue; |
|
75 | + // ASCII chunk: guaranteed to be valid UTF-8 and in normal form C, so |
|
76 | + // skip over it. |
|
77 | + $result .= $str; |
|
78 | + continue; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // We'll have to examine the chunk byte by byte to ensure that it consists |
@@ -91,72 +91,72 @@ discard block |
||
91 | 91 | $len = $chunk + 1; |
92 | 92 | |
93 | 93 | for ($i = -1; --$len; ) { |
94 | - $c = $str[++$i]; |
|
95 | - if ($remaining = $tail_bytes[$c]) { |
|
94 | + $c = $str[++$i]; |
|
95 | + if ($remaining = $tail_bytes[$c]) { |
|
96 | 96 | // UTF-8 head byte! |
97 | 97 | $sequence = $head = $c; |
98 | 98 | do { |
99 | - // Look for the defined number of tail bytes... |
|
100 | - if (--$len && ($c = $str[++$i]) >= "\x80" && $c < "\xc0") { |
|
99 | + // Look for the defined number of tail bytes... |
|
100 | + if (--$len && ($c = $str[++$i]) >= "\x80" && $c < "\xc0") { |
|
101 | 101 | // Legal tail bytes are nice. |
102 | 102 | $sequence .= $c; |
103 | - } |
|
104 | - else { |
|
103 | + } |
|
104 | + else { |
|
105 | 105 | if ($len == 0) { |
106 | - // Premature end of string! Drop a replacement character into |
|
107 | - // output to represent the invalid UTF-8 sequence. |
|
108 | - $result .= $unknown; |
|
109 | - break 2; |
|
106 | + // Premature end of string! Drop a replacement character into |
|
107 | + // output to represent the invalid UTF-8 sequence. |
|
108 | + $result .= $unknown; |
|
109 | + break 2; |
|
110 | 110 | } |
111 | 111 | else { |
112 | - // Illegal tail byte; abandon the sequence. |
|
113 | - $result .= $unknown; |
|
114 | - // Back up and reprocess this byte; it may itself be a legal |
|
115 | - // ASCII or UTF-8 sequence head. |
|
116 | - --$i; |
|
117 | - ++$len; |
|
118 | - continue 2; |
|
112 | + // Illegal tail byte; abandon the sequence. |
|
113 | + $result .= $unknown; |
|
114 | + // Back up and reprocess this byte; it may itself be a legal |
|
115 | + // ASCII or UTF-8 sequence head. |
|
116 | + --$i; |
|
117 | + ++$len; |
|
118 | + continue 2; |
|
119 | + } |
|
119 | 120 | } |
120 | - } |
|
121 | 121 | } while (--$remaining); |
122 | 122 | |
123 | 123 | $n = ord($head); |
124 | 124 | if ($n <= 0xdf) { |
125 | - $ord = ($n - 192) * 64 + (ord($sequence[1]) - 128); |
|
125 | + $ord = ($n - 192) * 64 + (ord($sequence[1]) - 128); |
|
126 | 126 | } |
127 | 127 | elseif ($n <= 0xef) { |
128 | - $ord = ($n - 224) * 4096 + (ord($sequence[1]) - 128) * 64 + (ord($sequence[2]) - 128); |
|
128 | + $ord = ($n - 224) * 4096 + (ord($sequence[1]) - 128) * 64 + (ord($sequence[2]) - 128); |
|
129 | 129 | } |
130 | 130 | elseif ($n <= 0xf7) { |
131 | - $ord = ($n - 240) * 262144 + (ord($sequence[1]) - 128) * 4096 + (ord($sequence[2]) - 128) * 64 + (ord($sequence[3]) - 128); |
|
131 | + $ord = ($n - 240) * 262144 + (ord($sequence[1]) - 128) * 4096 + (ord($sequence[2]) - 128) * 64 + (ord($sequence[3]) - 128); |
|
132 | 132 | } |
133 | 133 | elseif ($n <= 0xfb) { |
134 | - $ord = ($n - 248) * 16777216 + (ord($sequence[1]) - 128) * 262144 + (ord($sequence[2]) - 128) * 4096 + (ord($sequence[3]) - 128) * 64 + (ord($sequence[4]) - 128); |
|
134 | + $ord = ($n - 248) * 16777216 + (ord($sequence[1]) - 128) * 262144 + (ord($sequence[2]) - 128) * 4096 + (ord($sequence[3]) - 128) * 64 + (ord($sequence[4]) - 128); |
|
135 | 135 | } |
136 | 136 | elseif ($n <= 0xfd) { |
137 | - $ord = ($n - 252) * 1073741824 + (ord($sequence[1]) - 128) * 16777216 + (ord($sequence[2]) - 128) * 262144 + (ord($sequence[3]) - 128) * 4096 + (ord($sequence[4]) - 128) * 64 + (ord($sequence[5]) - 128); |
|
137 | + $ord = ($n - 252) * 1073741824 + (ord($sequence[1]) - 128) * 16777216 + (ord($sequence[2]) - 128) * 262144 + (ord($sequence[3]) - 128) * 4096 + (ord($sequence[4]) - 128) * 64 + (ord($sequence[5]) - 128); |
|
138 | 138 | } else { |
139 | - $ord = $n; |
|
139 | + $ord = $n; |
|
140 | 140 | } |
141 | 141 | $result .= _transliteration_replace($ord, $unknown, $source_langcode); |
142 | 142 | $head = ''; |
143 | - } elseif ($c < "\x80") { |
|
143 | + } elseif ($c < "\x80") { |
|
144 | 144 | // ASCII byte. |
145 | 145 | $result .= $c; |
146 | 146 | $head = ''; |
147 | - } elseif ($c < "\xc0") { |
|
147 | + } elseif ($c < "\xc0") { |
|
148 | 148 | // Illegal tail bytes. |
149 | 149 | if ($head == '') { |
150 | - $result .= $unknown; |
|
150 | + $result .= $unknown; |
|
151 | 151 | } |
152 | - } else { |
|
152 | + } else { |
|
153 | 153 | // Miscellaneous freaks. |
154 | 154 | $result .= $unknown; |
155 | 155 | $head = ''; |
156 | - } |
|
156 | + } |
|
157 | 157 | } |
158 | - } |
|
159 | - return $result; |
|
158 | + } |
|
159 | + return $result; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -175,38 +175,38 @@ discard block |
||
175 | 175 | * ASCII replacement character. |
176 | 176 | */ |
177 | 177 | function _transliteration_replace($ord, $unknown = '?', $langcode = NULL) { |
178 | - static $map = array(); |
|
178 | + static $map = array(); |
|
179 | 179 | |
180 | - //GL: set language later |
|
181 | - /* |
|
180 | + //GL: set language later |
|
181 | + /* |
|
182 | 182 | if (!isset($langcode)) { |
183 | 183 | global $language; |
184 | 184 | $langcode = $language->language; |
185 | 185 | } |
186 | 186 | */ |
187 | 187 | |
188 | - $bank = $ord >> 8; |
|
188 | + $bank = $ord >> 8; |
|
189 | 189 | |
190 | - if (!isset($map[$bank][$langcode])) { |
|
190 | + if (!isset($map[$bank][$langcode])) { |
|
191 | 191 | $file = './resources/transliteration-data/' . sprintf('x%02x', $bank) . '.php'; |
192 | 192 | if (file_exists($file)) { |
193 | - $base = array(); |
|
194 | - $variant = array(); |
|
195 | - include $file; |
|
196 | - if ($langcode != 'en' && isset($variant[$langcode])) { |
|
193 | + $base = array(); |
|
194 | + $variant = array(); |
|
195 | + include $file; |
|
196 | + if ($langcode != 'en' && isset($variant[$langcode])) { |
|
197 | 197 | // Merge in language specific mappings. |
198 | 198 | $map[$bank][$langcode] = $variant[$langcode] + $base; |
199 | - } |
|
200 | - else { |
|
199 | + } |
|
200 | + else { |
|
201 | 201 | $map[$bank][$langcode] = $base; |
202 | - } |
|
202 | + } |
|
203 | 203 | } |
204 | 204 | else { |
205 | - $map[$bank][$langcode] = array(); |
|
205 | + $map[$bank][$langcode] = array(); |
|
206 | + } |
|
206 | 207 | } |
207 | - } |
|
208 | 208 | |
209 | - $ord = $ord & 255; |
|
209 | + $ord = $ord & 255; |
|
210 | 210 | |
211 | - return isset($map[$bank][$langcode][$ord]) ? $map[$bank][$langcode][$ord] : $unknown; |
|
211 | + return isset($map[$bank][$langcode][$ord]) ? $map[$bank][$langcode][$ord] : $unknown; |
|
212 | 212 | } |
@@ -45,11 +45,11 @@ |
||
45 | 45 | $this->entryArray = array (); |
46 | 46 | |
47 | 47 | $ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR, |
48 | - PageQueryResult::SCOPE_TAG, |
|
49 | - PageQueryResult::SCOPE_SERIES, |
|
50 | - PageQueryResult::SCOPE_PUBLISHER, |
|
51 | - PageQueryResult::SCOPE_RATING, |
|
52 | - "language"); |
|
48 | + PageQueryResult::SCOPE_TAG, |
|
49 | + PageQueryResult::SCOPE_SERIES, |
|
50 | + PageQueryResult::SCOPE_PUBLISHER, |
|
51 | + PageQueryResult::SCOPE_RATING, |
|
52 | + "language"); |
|
53 | 53 | |
54 | 54 | $content = ""; |
55 | 55 | array_push ($this->entryArray, new Entry ("Template", "", |
@@ -78,9 +78,9 @@ |
||
78 | 78 | $mail->AltBody = "Sent by COPS"; |
79 | 79 | |
80 | 80 | if (!$mail->Send()) { |
81 | - echo localize ("mail.messagenotsent"); |
|
82 | - echo 'Mailer Error: ' . $mail->ErrorInfo; |
|
83 | - exit; |
|
81 | + echo localize ("mail.messagenotsent"); |
|
82 | + echo 'Mailer Error: ' . $mail->ErrorInfo; |
|
83 | + exit; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | echo localize ("mail.messagesent"); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | // Generate the function for the template |
33 | 33 | $template = new doT (); |
34 | 34 | $dot = $template->template ($page, array ('bookdetail' => $bookdetail, |
35 | - 'header' => $header, |
|
36 | - 'footer' => $footer, |
|
37 | - 'main' => $main)); |
|
35 | + 'header' => $header, |
|
36 | + 'footer' => $footer, |
|
37 | + 'main' => $main)); |
|
38 | 38 | // If there is a syntax error in the function created |
39 | 39 | // $dot will be equal to FALSE |
40 | 40 | if (!$dot) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | case LIBXML_ERR_WARNING: |
126 | 126 | $return .= 'Warning ' . $error->code . ': '; |
127 | 127 | break; |
128 | - case LIBXML_ERR_ERROR: |
|
128 | + case LIBXML_ERR_ERROR: |
|
129 | 129 | $return .= 'Error ' . $error->code . ': '; |
130 | 130 | break; |
131 | 131 | case LIBXML_ERR_FATAL: |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | $return .= trim($error->message) . |
137 | - "\n Line: " . $error->line . |
|
138 | - "\n Column: " . $error->column; |
|
137 | + "\n Line: " . $error->line . |
|
138 | + "\n Column: " . $error->column; |
|
139 | 139 | |
140 | 140 | if ($error->file) { |
141 | 141 | $return .= "\n File: " . $error->file; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | if ($data = $book->getDataFormat ($format)) { |
25 | 25 | $i++; |
26 | 26 | array_push ($preferedData, array ("url" => $data->getHtmlLink (), |
27 | - "viewUrl" => $data->getViewHtmlLink (), "name" => $format)); |
|
27 | + "viewUrl" => $data->getViewHtmlLink (), "name" => $format)); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
@@ -52,20 +52,20 @@ discard block |
||
52 | 52 | $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true); |
53 | 53 | |
54 | 54 | return array ("id" => $book->id, |
55 | - "hasCover" => $book->hasCover, |
|
56 | - "preferedData" => $preferedData, |
|
57 | - "rating" => $book->getRating (), |
|
58 | - "publisherName" => $pn, |
|
59 | - "publisherurl" => $pu, |
|
60 | - "pubDate" => $book->getPubDate (), |
|
61 | - "languagesName" => $book->getLanguages (), |
|
62 | - "authorsName" => $book->getAuthorsName (), |
|
63 | - "tagsName" => $book->getTagsName (), |
|
64 | - "seriesName" => $sn, |
|
65 | - "seriesIndex" => $book->seriesIndex, |
|
66 | - "seriesCompleteName" => $scn, |
|
67 | - "seriesurl" => $su, |
|
68 | - "customcolumns_list" => $cc); |
|
55 | + "hasCover" => $book->hasCover, |
|
56 | + "preferedData" => $preferedData, |
|
57 | + "rating" => $book->getRating (), |
|
58 | + "publisherName" => $pn, |
|
59 | + "publisherurl" => $pu, |
|
60 | + "pubDate" => $book->getPubDate (), |
|
61 | + "languagesName" => $book->getLanguages (), |
|
62 | + "authorsName" => $book->getAuthorsName (), |
|
63 | + "tagsName" => $book->getTagsName (), |
|
64 | + "seriesName" => $sn, |
|
65 | + "seriesIndex" => $book->seriesIndex, |
|
66 | + "seriesCompleteName" => $scn, |
|
67 | + "seriesurl" => $su, |
|
68 | + "customcolumns_list" => $cc); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -137,44 +137,44 @@ discard block |
||
137 | 137 | $out = $in; |
138 | 138 | |
139 | 139 | $out ["c"] = array ("version" => VERSION, "i18n" => array ( |
140 | - "coverAlt" => localize("i18n.coversection"), |
|
141 | - "authorsTitle" => localize("authors.title"), |
|
142 | - "bookwordTitle" => localize("bookword.title"), |
|
143 | - "tagsTitle" => localize("tags.title"), |
|
144 | - "seriesTitle" => localize("series.title"), |
|
145 | - "customizeTitle" => localize ("customize.title"), |
|
146 | - "aboutTitle" => localize ("about.title"), |
|
147 | - "previousAlt" => localize ("paging.previous.alternate"), |
|
148 | - "nextAlt" => localize ("paging.next.alternate"), |
|
149 | - "searchAlt" => localize ("search.alternate"), |
|
150 | - "sortAlt" => localize ("sort.alternate"), |
|
151 | - "homeAlt" => localize ("home.alternate"), |
|
152 | - "cogAlt" => localize ("cog.alternate"), |
|
153 | - "permalinkAlt" => localize ("permalink.alternate"), |
|
154 | - "publisherName" => localize("publisher.name"), |
|
155 | - "pubdateTitle" => localize("pubdate.title"), |
|
156 | - "languagesTitle" => localize("language.title"), |
|
157 | - "contentTitle" => localize("content.summary"), |
|
158 | - "sortorderAsc" => localize("search.sortorder.asc"), |
|
159 | - "sortorderDesc" => localize("search.sortorder.desc"), |
|
160 | - "customizeEmail" => localize("customize.email")), |
|
161 | - "url" => array ( |
|
162 | - "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
163 | - "coverUrl" => "fetch.php?id={0}&db={1}", |
|
164 | - "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
|
165 | - "config" => array ( |
|
166 | - "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
167 | - "max_item_per_page" => $config['cops_max_item_per_page'], |
|
168 | - "kindleHack" => "", |
|
169 | - "server_side_rendering" => useServerSideRendering (), |
|
170 | - "html_tag_filter" => $config['cops_html_tag_filter'])); |
|
140 | + "coverAlt" => localize("i18n.coversection"), |
|
141 | + "authorsTitle" => localize("authors.title"), |
|
142 | + "bookwordTitle" => localize("bookword.title"), |
|
143 | + "tagsTitle" => localize("tags.title"), |
|
144 | + "seriesTitle" => localize("series.title"), |
|
145 | + "customizeTitle" => localize ("customize.title"), |
|
146 | + "aboutTitle" => localize ("about.title"), |
|
147 | + "previousAlt" => localize ("paging.previous.alternate"), |
|
148 | + "nextAlt" => localize ("paging.next.alternate"), |
|
149 | + "searchAlt" => localize ("search.alternate"), |
|
150 | + "sortAlt" => localize ("sort.alternate"), |
|
151 | + "homeAlt" => localize ("home.alternate"), |
|
152 | + "cogAlt" => localize ("cog.alternate"), |
|
153 | + "permalinkAlt" => localize ("permalink.alternate"), |
|
154 | + "publisherName" => localize("publisher.name"), |
|
155 | + "pubdateTitle" => localize("pubdate.title"), |
|
156 | + "languagesTitle" => localize("language.title"), |
|
157 | + "contentTitle" => localize("content.summary"), |
|
158 | + "sortorderAsc" => localize("search.sortorder.asc"), |
|
159 | + "sortorderDesc" => localize("search.sortorder.desc"), |
|
160 | + "customizeEmail" => localize("customize.email")), |
|
161 | + "url" => array ( |
|
162 | + "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
163 | + "coverUrl" => "fetch.php?id={0}&db={1}", |
|
164 | + "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
|
165 | + "config" => array ( |
|
166 | + "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
167 | + "max_item_per_page" => $config['cops_max_item_per_page'], |
|
168 | + "kindleHack" => "", |
|
169 | + "server_side_rendering" => useServerSideRendering (), |
|
170 | + "html_tag_filter" => $config['cops_html_tag_filter'])); |
|
171 | 171 | if ($config['cops_thumbnail_handling'] == "1") { |
172 | 172 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
173 | 173 | } else if (!empty ($config['cops_thumbnail_handling'])) { |
174 | 174 | $out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling']; |
175 | 175 | } |
176 | 176 | if (preg_match("/./", $_SERVER['HTTP_USER_AGENT'])) { |
177 | - $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"'; |
|
177 | + $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"'; |
|
178 | 178 | } |
179 | 179 | return $out; |
180 | 180 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | if (!is_null (getURLParam ("complete")) || $complete) { |
235 | 235 | $out = self::addCompleteArray ($out); |
236 | - } |
|
236 | + } |
|
237 | 237 | |
238 | 238 | $out ["containsBook"] = 0; |
239 | 239 | if ($currentPage->containsBook ()) { |
@@ -105,7 +105,7 @@ |
||
105 | 105 | public function getUpdatedFilenameKepub () { |
106 | 106 | $str = $this->getUpdatedFilename () . ".kepub.epub"; |
107 | 107 | return str_replace(array(':', '#', '&'), |
108 | - array('-', '-', ' '), $str ); |
|
108 | + array('-', '-', ' '), $str ); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | public function getDataLink ($rel, $title = NULL, $view = false) { |
@@ -99,13 +99,13 @@ |
||
99 | 99 | |
100 | 100 | // -DC- Add image directory |
101 | 101 | public static function getImgDirectory ($database = NULL) { |
102 | - global $config; |
|
103 | - if (self::isMultipleDatabaseEnabled ()) { |
|
104 | - if (is_null ($database)) $database = GetUrlParam (DB, 0); |
|
105 | - $array = array_values ($config['image_directory']); |
|
106 | - return $array[$database]; |
|
107 | - } |
|
108 | - return $config['image_directory']; |
|
102 | + global $config; |
|
103 | + if (self::isMultipleDatabaseEnabled ()) { |
|
104 | + if (is_null ($database)) $database = GetUrlParam (DB, 0); |
|
105 | + $array = array_values ($config['image_directory']); |
|
106 | + return $array[$database]; |
|
107 | + } |
|
108 | + return $config['image_directory']; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | public static function getDbFileName ($database = NULL) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | private $coverFileName = NULL; |
110 | 110 | |
111 | 111 | public function __construct($line) { |
112 | - global $config; |
|
112 | + global $config; |
|
113 | 113 | |
114 | 114 | $this->id = $line->id; |
115 | 115 | $this->title = $line->title; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | // -DC- Init relative or full path |
121 | 121 | $this->path = $line->path; |
122 | 122 | if (!is_dir($this->path)) { |
123 | - $this->path = Base::getDbDirectory() . $line->path; |
|
123 | + $this->path = Base::getDbDirectory() . $line->path; |
|
124 | 124 | } |
125 | 125 | $this->seriesIndex = $line->series_index; |
126 | 126 | $this->comment = $line->comment; |
@@ -132,47 +132,47 @@ discard block |
||
132 | 132 | // $this->hasCover = 0; |
133 | 133 | //} |
134 | 134 | if ($this->hasCover) { |
135 | - if (!empty($config['calibre_database_field_cover'])) { |
|
136 | - $imgDirectory = Base::getImgDirectory(); |
|
137 | - $this->coverFileName = $line->cover; |
|
138 | - if (!file_exists($this->coverFileName)) { |
|
139 | - $this->coverFileName = NULL; |
|
140 | - } |
|
141 | - if (empty($this->coverFileName)) { |
|
142 | - $this->coverFileName = sprintf('%s%s', $imgDirectory, $line->cover); |
|
143 | - if (!file_exists($this->coverFileName)) { |
|
144 | - $this->coverFileName = NULL; |
|
145 | - } |
|
146 | - } |
|
147 | - if (empty($this->coverFileName)) { |
|
148 | - $data = $this->getDataById($this->id); |
|
149 | - if ($data) { |
|
150 | - $this->coverFileName = sprintf('%s%s/%s', $imgDirectory, $data->name, $line->cover); |
|
151 | - if (!file_exists($this->coverFileName)) { |
|
152 | - $this->coverFileName = NULL; |
|
153 | - } |
|
154 | - if (empty($this->coverFileName)) { |
|
155 | - $this->coverFileName = sprintf('%s%s.jpg', $imgDirectory, $data->name); |
|
156 | - if (!file_exists($this->coverFileName)) { |
|
157 | - $this->coverFileName = NULL; |
|
158 | - } |
|
159 | - } |
|
160 | - } |
|
161 | - } |
|
162 | - } |
|
163 | - // Else try with default cover file name |
|
164 | - if (empty($this->coverFileName)) { |
|
165 | - $cover = $this->getFilePath("jpg"); |
|
166 | - if ($cover === false || !file_exists($cover)) { |
|
167 | - $cover = $this->getFilePath("png"); |
|
168 | - } |
|
169 | - if ($cover === false || !file_exists($cover)) { |
|
170 | - $this->hasCover = 0; |
|
171 | - } |
|
172 | - else { |
|
173 | - $this->coverFileName = $cover; |
|
174 | - } |
|
175 | - } |
|
135 | + if (!empty($config['calibre_database_field_cover'])) { |
|
136 | + $imgDirectory = Base::getImgDirectory(); |
|
137 | + $this->coverFileName = $line->cover; |
|
138 | + if (!file_exists($this->coverFileName)) { |
|
139 | + $this->coverFileName = NULL; |
|
140 | + } |
|
141 | + if (empty($this->coverFileName)) { |
|
142 | + $this->coverFileName = sprintf('%s%s', $imgDirectory, $line->cover); |
|
143 | + if (!file_exists($this->coverFileName)) { |
|
144 | + $this->coverFileName = NULL; |
|
145 | + } |
|
146 | + } |
|
147 | + if (empty($this->coverFileName)) { |
|
148 | + $data = $this->getDataById($this->id); |
|
149 | + if ($data) { |
|
150 | + $this->coverFileName = sprintf('%s%s/%s', $imgDirectory, $data->name, $line->cover); |
|
151 | + if (!file_exists($this->coverFileName)) { |
|
152 | + $this->coverFileName = NULL; |
|
153 | + } |
|
154 | + if (empty($this->coverFileName)) { |
|
155 | + $this->coverFileName = sprintf('%s%s.jpg', $imgDirectory, $data->name); |
|
156 | + if (!file_exists($this->coverFileName)) { |
|
157 | + $this->coverFileName = NULL; |
|
158 | + } |
|
159 | + } |
|
160 | + } |
|
161 | + } |
|
162 | + } |
|
163 | + // Else try with default cover file name |
|
164 | + if (empty($this->coverFileName)) { |
|
165 | + $cover = $this->getFilePath("jpg"); |
|
166 | + if ($cover === false || !file_exists($cover)) { |
|
167 | + $cover = $this->getFilePath("png"); |
|
168 | + } |
|
169 | + if ($cover === false || !file_exists($cover)) { |
|
170 | + $this->hasCover = 0; |
|
171 | + } |
|
172 | + else { |
|
173 | + $this->coverFileName = $cover; |
|
174 | + } |
|
175 | + } |
|
176 | 176 | } |
177 | 177 | $this->rating = $line->rating; |
178 | 178 | } |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | // -DC- Get customisable book columns |
181 | 181 | private static function getBookColumns() |
182 | 182 | { |
183 | - global $config; |
|
183 | + global $config; |
|
184 | 184 | |
185 | - $res = self::BOOK_COLUMNS; |
|
186 | - if (!empty($config['calibre_database_field_cover'])) { |
|
187 | - $res = str_replace('has_cover,', 'has_cover, ' . $config['calibre_database_field_cover'] . ',', $res); |
|
188 | - } |
|
185 | + $res = self::BOOK_COLUMNS; |
|
186 | + if (!empty($config['calibre_database_field_cover'])) { |
|
187 | + $res = str_replace('has_cover,', 'has_cover, ' . $config['calibre_database_field_cover'] . ',', $res); |
|
188 | + } |
|
189 | 189 | |
190 | - return $res; |
|
190 | + return $res; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | public function getEntryId() { |
@@ -416,26 +416,26 @@ discard block |
||
416 | 416 | { |
417 | 417 | return $this->path.'/'.$file; |
418 | 418 | }*/ |
419 | - if ($extension == "jpg" || $extension == "png") { |
|
420 | - if (empty($this->coverFileName)) { |
|
421 | - return $this->path . '/cover.' . $extension; |
|
422 | - } |
|
423 | - else { |
|
424 | - $ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION)); |
|
425 | - if ($ext == $extension) { |
|
426 | - return $this->coverFileName; |
|
427 | - } |
|
428 | - } |
|
429 | - return false; |
|
430 | - } |
|
431 | - else { |
|
432 | - $data = $this->getDataById($idData); |
|
433 | - if (!$data) { |
|
434 | - return NULL; |
|
435 | - } |
|
436 | - $file = $data->name . "." . strtolower($data->format); |
|
437 | - return $this->path . '/' . $file; |
|
438 | - } |
|
419 | + if ($extension == "jpg" || $extension == "png") { |
|
420 | + if (empty($this->coverFileName)) { |
|
421 | + return $this->path . '/cover.' . $extension; |
|
422 | + } |
|
423 | + else { |
|
424 | + $ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION)); |
|
425 | + if ($ext == $extension) { |
|
426 | + return $this->coverFileName; |
|
427 | + } |
|
428 | + } |
|
429 | + return false; |
|
430 | + } |
|
431 | + else { |
|
432 | + $data = $this->getDataById($idData); |
|
433 | + if (!$data) { |
|
434 | + return NULL; |
|
435 | + } |
|
436 | + $file = $data->name . "." . strtolower($data->format); |
|
437 | + return $this->path . '/' . $file; |
|
438 | + } |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | public function getUpdatedEpub($idData) |
@@ -520,18 +520,18 @@ discard block |
||
520 | 520 | $linkArray = array(); |
521 | 521 | |
522 | 522 | if ($this->hasCover) { |
523 | - // -DC- Use cover file name |
|
524 | - //array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
|
525 | - //array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL)); |
|
526 | - $ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION)); |
|
527 | - if ($ext == 'png') { |
|
528 | - array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_IMAGE_TYPE, "cover.png", NULL)); |
|
529 | - array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_THUMBNAIL_TYPE, "cover.png", NULL)); |
|
530 | - } |
|
531 | - else { |
|
532 | - array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
|
533 | - array_push($linkArray, Data::getLink($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL)); |
|
534 | - } |
|
523 | + // -DC- Use cover file name |
|
524 | + //array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
|
525 | + //array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL)); |
|
526 | + $ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION)); |
|
527 | + if ($ext == 'png') { |
|
528 | + array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_IMAGE_TYPE, "cover.png", NULL)); |
|
529 | + array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_THUMBNAIL_TYPE, "cover.png", NULL)); |
|
530 | + } |
|
531 | + else { |
|
532 | + array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
|
533 | + array_push($linkArray, Data::getLink($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL)); |
|
534 | + } |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | foreach ($this->getDatas() as $data) |
@@ -571,15 +571,15 @@ discard block |
||
571 | 571 | $nBooks = parent::executeQuerySingle('select count(*) from books'); |
572 | 572 | $result = array(); |
573 | 573 | $entry = new Entry(localize('allbooks.title'), |
574 | - self::ALL_BOOKS_ID, |
|
575 | - str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', |
|
576 | - array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
574 | + self::ALL_BOOKS_ID, |
|
575 | + str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', |
|
576 | + array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
577 | 577 | array_push($result, $entry); |
578 | 578 | if ($config['cops_recentbooks_limit'] > 0) { |
579 | 579 | $entry = new Entry(localize('recent.title'), |
580 | - self::ALL_RECENT_BOOKS_ID, |
|
581 | - str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', |
|
582 | - array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
580 | + self::ALL_RECENT_BOOKS_ID, |
|
581 | + str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', |
|
582 | + array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
583 | 583 | array_push($result, $entry); |
584 | 584 | } |
585 | 585 | return $result; |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } |
623 | 623 | |
624 | 624 | public static function getBookById($bookId) { |
625 | - $result = parent::getDb()->prepare('select ' . self::getBookColumns() . ' |
|
625 | + $result = parent::getDb()->prepare('select ' . self::getBookColumns() . ' |
|
626 | 626 | from books ' . self::SQL_BOOKS_LEFT_JOIN . ' |
627 | 627 | where books.id = ?'); |
628 | 628 | $result->execute(array($bookId)); |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | } |
636 | 636 | |
637 | 637 | public static function getBookByDataId($dataId) { |
638 | - $result = parent::getDb()->prepare('select ' . self::getBookColumns() . ', data.name, data.format |
|
638 | + $result = parent::getDb()->prepare('select ' . self::getBookColumns() . ', data.name, data.format |
|
639 | 639 | from data, books ' . self::SQL_BOOKS_LEFT_JOIN . ' |
640 | 640 | where data.book = books.id and data.id = ?'); |
641 | 641 | $result->execute(array($dataId)); |
@@ -654,10 +654,10 @@ discard block |
||
654 | 654 | $i = 0; |
655 | 655 | $critArray = array(); |
656 | 656 | foreach (array(PageQueryResult::SCOPE_AUTHOR, |
657 | - PageQueryResult::SCOPE_TAG, |
|
658 | - PageQueryResult::SCOPE_SERIES, |
|
659 | - PageQueryResult::SCOPE_PUBLISHER, |
|
660 | - PageQueryResult::SCOPE_BOOK) as $key) { |
|
657 | + PageQueryResult::SCOPE_TAG, |
|
658 | + PageQueryResult::SCOPE_SERIES, |
|
659 | + PageQueryResult::SCOPE_PUBLISHER, |
|
660 | + PageQueryResult::SCOPE_BOOK) as $key) { |
|
661 | 661 | if (in_array($key, getCurrentOption('ignored_categories')) || |
662 | 662 | (!array_key_exists($key, $query) && !array_key_exists('all', $query))) { |
663 | 663 | $critArray[$i] = self::BAD_SEARCH; |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) { |
705 | 705 | /* @var $totalNumber integer */ |
706 | 706 | /* @var $result PDOStatement */ |
707 | - list($totalNumber, $result) = parent::executeQuery($query, self::getBookColumns(), self::getFilterString(), $params, $n, $database, $numberPerPage); |
|
707 | + list($totalNumber, $result) = parent::executeQuery($query, self::getBookColumns(), self::getFilterString(), $params, $n, $database, $numberPerPage); |
|
708 | 708 | |
709 | 709 | $entryArray = array(); |
710 | 710 | while ($post = $result->fetchObject()) |