@@ -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 | /** |
@@ -148,46 +148,46 @@ discard block |
||
148 | 148 | $out = $in; |
149 | 149 | |
150 | 150 | $out ["c"] = array ("version" => VERSION, "i18n" => array ( |
151 | - "coverAlt" => localize("i18n.coversection"), |
|
152 | - "authorsTitle" => localize("authors.title"), |
|
153 | - "bookwordTitle" => localize("bookword.title"), |
|
154 | - "tagsTitle" => localize("tags.title"), |
|
155 | - "linksTitle" => localize("links.title"), |
|
156 | - "seriesTitle" => localize("series.title"), |
|
157 | - "customizeTitle" => localize ("customize.title"), |
|
158 | - "aboutTitle" => localize ("about.title"), |
|
159 | - "previousAlt" => localize ("paging.previous.alternate"), |
|
160 | - "nextAlt" => localize ("paging.next.alternate"), |
|
161 | - "searchAlt" => localize ("search.alternate"), |
|
162 | - "sortAlt" => localize ("sort.alternate"), |
|
163 | - "homeAlt" => localize ("home.alternate"), |
|
164 | - "cogAlt" => localize ("cog.alternate"), |
|
165 | - "permalinkAlt" => localize ("permalink.alternate"), |
|
166 | - "publisherName" => localize("publisher.name"), |
|
167 | - "pubdateTitle" => localize("pubdate.title"), |
|
168 | - "languagesTitle" => localize("language.title"), |
|
169 | - "contentTitle" => localize("content.summary"), |
|
170 | - "filterClearAll" => localize("filter.clearall"), |
|
171 | - "sortorderAsc" => localize("search.sortorder.asc"), |
|
172 | - "sortorderDesc" => localize("search.sortorder.desc"), |
|
173 | - "customizeEmail" => localize("customize.email")), |
|
174 | - "url" => array ( |
|
175 | - "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
176 | - "coverUrl" => "fetch.php?id={0}&db={1}", |
|
177 | - "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
|
178 | - "config" => array ( |
|
179 | - "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
180 | - "max_item_per_page" => $config['cops_max_item_per_page'], |
|
181 | - "kindleHack" => "", |
|
182 | - "server_side_rendering" => useServerSideRendering (), |
|
183 | - "html_tag_filter" => $config['cops_html_tag_filter'])); |
|
151 | + "coverAlt" => localize("i18n.coversection"), |
|
152 | + "authorsTitle" => localize("authors.title"), |
|
153 | + "bookwordTitle" => localize("bookword.title"), |
|
154 | + "tagsTitle" => localize("tags.title"), |
|
155 | + "linksTitle" => localize("links.title"), |
|
156 | + "seriesTitle" => localize("series.title"), |
|
157 | + "customizeTitle" => localize ("customize.title"), |
|
158 | + "aboutTitle" => localize ("about.title"), |
|
159 | + "previousAlt" => localize ("paging.previous.alternate"), |
|
160 | + "nextAlt" => localize ("paging.next.alternate"), |
|
161 | + "searchAlt" => localize ("search.alternate"), |
|
162 | + "sortAlt" => localize ("sort.alternate"), |
|
163 | + "homeAlt" => localize ("home.alternate"), |
|
164 | + "cogAlt" => localize ("cog.alternate"), |
|
165 | + "permalinkAlt" => localize ("permalink.alternate"), |
|
166 | + "publisherName" => localize("publisher.name"), |
|
167 | + "pubdateTitle" => localize("pubdate.title"), |
|
168 | + "languagesTitle" => localize("language.title"), |
|
169 | + "contentTitle" => localize("content.summary"), |
|
170 | + "filterClearAll" => localize("filter.clearall"), |
|
171 | + "sortorderAsc" => localize("search.sortorder.asc"), |
|
172 | + "sortorderDesc" => localize("search.sortorder.desc"), |
|
173 | + "customizeEmail" => localize("customize.email")), |
|
174 | + "url" => array ( |
|
175 | + "detailUrl" => "index.php?page=13&id={0}&db={1}", |
|
176 | + "coverUrl" => "fetch.php?id={0}&db={1}", |
|
177 | + "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
|
178 | + "config" => array ( |
|
179 | + "use_fancyapps" => $config ["cops_use_fancyapps"], |
|
180 | + "max_item_per_page" => $config['cops_max_item_per_page'], |
|
181 | + "kindleHack" => "", |
|
182 | + "server_side_rendering" => useServerSideRendering (), |
|
183 | + "html_tag_filter" => $config['cops_html_tag_filter'])); |
|
184 | 184 | if ($config['cops_thumbnail_handling'] == "1") { |
185 | 185 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
186 | 186 | } else if (!empty ($config['cops_thumbnail_handling'])) { |
187 | 187 | $out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling']; |
188 | 188 | } |
189 | 189 | if (preg_match("/./", $_SERVER['HTTP_USER_AGENT'])) { |
190 | - $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"'; |
|
190 | + $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"'; |
|
191 | 191 | } |
192 | 192 | return $out; |
193 | 193 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | if (!is_null (getURLParam ("complete")) || $complete) { |
248 | 248 | $out = self::addCompleteArray ($out); |
249 | - } |
|
249 | + } |
|
250 | 250 | |
251 | 251 | $out ["containsBook"] = 0; |
252 | 252 | if ($currentPage->containsBook ()) { |
@@ -14,53 +14,53 @@ discard block |
||
14 | 14 | * @param Book $book |
15 | 15 | * @return array |
16 | 16 | */ |
17 | - public static function getBookContentArray ($book) { |
|
17 | + public static function getBookContentArray($book) { |
|
18 | 18 | global $config; |
19 | 19 | $i = 0; |
20 | - $preferedData = array (); |
|
20 | + $preferedData = array(); |
|
21 | 21 | foreach ($config['cops_prefered_format'] as $format) |
22 | 22 | { |
23 | 23 | if ($i == 2) { break; } |
24 | - if ($data = $book->getDataFormat ($format)) { |
|
24 | + if ($data = $book->getDataFormat($format)) { |
|
25 | 25 | $i++; |
26 | - array_push ($preferedData, array ("url" => $data->getHtmlLink (), |
|
27 | - "viewUrl" => $data->getViewHtmlLink (), "name" => $format)); |
|
26 | + array_push($preferedData, array("url" => $data->getHtmlLink(), |
|
27 | + "viewUrl" => $data->getViewHtmlLink(), "name" => $format)); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | 31 | $publisher = $book->getPublisher(); |
32 | - if (is_null ($publisher)) { |
|
32 | + if (is_null($publisher)) { |
|
33 | 33 | $pn = ""; |
34 | 34 | $pu = ""; |
35 | 35 | } else { |
36 | 36 | $pn = $publisher->name; |
37 | - $link = new LinkNavigation ($publisher->getUri ()); |
|
38 | - $pu = $link->hrefXhtml (); |
|
37 | + $link = new LinkNavigation($publisher->getUri()); |
|
38 | + $pu = $link->hrefXhtml(); |
|
39 | 39 | } |
40 | 40 | |
41 | - $serie = $book->getSerie (); |
|
42 | - if (is_null ($serie)) { |
|
41 | + $serie = $book->getSerie(); |
|
42 | + if (is_null($serie)) { |
|
43 | 43 | $sn = ""; |
44 | 44 | $scn = ""; |
45 | 45 | $su = ""; |
46 | 46 | } else { |
47 | 47 | $sn = $serie->name; |
48 | - $scn = str_format (localize ("content.series.data"), $book->seriesIndex, $serie->name); |
|
49 | - $link = new LinkNavigation ($serie->getUri ()); |
|
50 | - $su = $link->hrefXhtml (); |
|
48 | + $scn = str_format(localize("content.series.data"), $book->seriesIndex, $serie->name); |
|
49 | + $link = new LinkNavigation($serie->getUri()); |
|
50 | + $su = $link->hrefXhtml(); |
|
51 | 51 | } |
52 | 52 | $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true); |
53 | 53 | |
54 | - return array ("id" => $book->id, |
|
54 | + return array("id" => $book->id, |
|
55 | 55 | "hasCover" => $book->hasCover, |
56 | 56 | "preferedData" => $preferedData, |
57 | - "rating" => $book->getRating (), |
|
57 | + "rating" => $book->getRating(), |
|
58 | 58 | "publisherName" => $pn, |
59 | 59 | "publisherurl" => $pu, |
60 | - "pubDate" => $book->getPubDate (), |
|
61 | - "languagesName" => $book->getLanguages (), |
|
62 | - "authorsName" => $book->getAuthorsName (), |
|
63 | - "tagsName" => $book->getTagsName (), |
|
60 | + "pubDate" => $book->getPubDate(), |
|
61 | + "languagesName" => $book->getLanguages(), |
|
62 | + "authorsName" => $book->getAuthorsName(), |
|
63 | + "tagsName" => $book->getTagsName(), |
|
64 | 64 | "seriesName" => $sn, |
65 | 65 | "seriesIndex" => $book->seriesIndex, |
66 | 66 | "seriesCompleteName" => $scn, |
@@ -72,45 +72,45 @@ discard block |
||
72 | 72 | * @param Book $book |
73 | 73 | * @return array |
74 | 74 | */ |
75 | - public static function getFullBookContentArray ($book) { |
|
75 | + public static function getFullBookContentArray($book) { |
|
76 | 76 | global $config; |
77 | - $out = self::getBookContentArray ($book); |
|
78 | - $database = GetUrlParam (DB); |
|
77 | + $out = self::getBookContentArray($book); |
|
78 | + $database = GetUrlParam(DB); |
|
79 | 79 | |
80 | - $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml (); |
|
81 | - $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml (); |
|
82 | - $out ["content"] = $book->getComment (false); |
|
83 | - $out ["datas"] = array (); |
|
84 | - $dataKindle = $book->GetMostInterestingDataToSendToKindle (); |
|
80 | + $out ["coverurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml(); |
|
81 | + $out ["thumbnailurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml(); |
|
82 | + $out ["content"] = $book->getComment(false); |
|
83 | + $out ["datas"] = array(); |
|
84 | + $dataKindle = $book->GetMostInterestingDataToSendToKindle(); |
|
85 | 85 | foreach ($book->getDatas() as $data) { |
86 | - $tab = array ("id" => $data->id, |
|
86 | + $tab = array("id" => $data->id, |
|
87 | 87 | "format" => $data->format, |
88 | - "url" => $data->getHtmlLink (), |
|
89 | - "viewUrl" => $data->getViewHtmlLink (), |
|
88 | + "url" => $data->getHtmlLink(), |
|
89 | + "viewUrl" => $data->getViewHtmlLink(), |
|
90 | 90 | "mail" => 0, |
91 | 91 | "readerUrl" => ""); |
92 | - if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) { |
|
92 | + if (!empty ($config['cops_mail_configuration']) && !is_null($dataKindle) && $data->id == $dataKindle->id) { |
|
93 | 93 | $tab ["mail"] = 1; |
94 | 94 | } |
95 | 95 | if ($data->format == "EPUB") { |
96 | 96 | $tab ["readerUrl"] = "epubreader.php?data={$data->id}&db={$database}"; |
97 | 97 | } |
98 | - array_push ($out ["datas"], $tab); |
|
98 | + array_push($out ["datas"], $tab); |
|
99 | 99 | } |
100 | - $out ["authors"] = array (); |
|
101 | - foreach ($book->getAuthors () as $author) { |
|
102 | - $link = new LinkNavigation ($author->getUri ()); |
|
103 | - array_push ($out ["authors"], array ("name" => $author->name, "url" => $link->hrefXhtml ())); |
|
100 | + $out ["authors"] = array(); |
|
101 | + foreach ($book->getAuthors() as $author) { |
|
102 | + $link = new LinkNavigation($author->getUri()); |
|
103 | + array_push($out ["authors"], array("name" => $author->name, "url" => $link->hrefXhtml())); |
|
104 | 104 | } |
105 | - $out ["tags"] = array (); |
|
106 | - foreach ($book->getTags () as $tag) { |
|
107 | - $link = new LinkNavigation ($tag->getUri ()); |
|
108 | - array_push ($out ["tags"], array ("name" => $tag->name, "url" => $link->hrefXhtml ())); |
|
105 | + $out ["tags"] = array(); |
|
106 | + foreach ($book->getTags() as $tag) { |
|
107 | + $link = new LinkNavigation($tag->getUri()); |
|
108 | + array_push($out ["tags"], array("name" => $tag->name, "url" => $link->hrefXhtml())); |
|
109 | 109 | } |
110 | 110 | |
111 | - $out ["identifiers"] = array (); |
|
112 | - foreach ($book->getIdentifiers () as $ident) { |
|
113 | - array_push ($out ["identifiers"], array ("name" => $ident->formattedType, "url" => $ident->getUri ())); |
|
111 | + $out ["identifiers"] = array(); |
|
112 | + foreach ($book->getIdentifiers() as $ident) { |
|
113 | + array_push($out ["identifiers"], array("name" => $ident->formattedType, "url" => $ident->getUri())); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $out ["customcolumns_preview"] = $book->getCustomColumnValues($config['cops_calibre_custom_column_preview'], true); |
@@ -118,51 +118,51 @@ discard block |
||
118 | 118 | return $out; |
119 | 119 | } |
120 | 120 | |
121 | - public static function getContentArray ($entry) { |
|
121 | + public static function getContentArray($entry) { |
|
122 | 122 | if ($entry instanceof EntryBook) { |
123 | - $out = array ( "title" => $entry->title); |
|
124 | - $out ["book"] = self::getBookContentArray ($entry->book); |
|
123 | + $out = array("title" => $entry->title); |
|
124 | + $out ["book"] = self::getBookContentArray($entry->book); |
|
125 | 125 | return $out; |
126 | 126 | } |
127 | - return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement ); |
|
127 | + return array("title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement); |
|
128 | 128 | } |
129 | 129 | |
130 | - public static function getContentArrayTypeahead ($page) { |
|
131 | - $out = array (); |
|
130 | + public static function getContentArrayTypeahead($page) { |
|
131 | + $out = array(); |
|
132 | 132 | foreach ($page->entryArray as $entry) { |
133 | 133 | if ($entry instanceof EntryBook) { |
134 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ())); |
|
134 | + array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl())); |
|
135 | 135 | } else { |
136 | - if (empty ($entry->className) xor Base::noDatabaseSelected ()) { |
|
137 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ())); |
|
136 | + if (empty ($entry->className) xor Base::noDatabaseSelected()) { |
|
137 | + array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink())); |
|
138 | 138 | } else { |
139 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ())); |
|
139 | + array_push($out, array("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink())); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
143 | 143 | return $out; |
144 | 144 | } |
145 | 145 | |
146 | - public static function addCompleteArray ($in) { |
|
146 | + public static function addCompleteArray($in) { |
|
147 | 147 | global $config; |
148 | 148 | $out = $in; |
149 | 149 | |
150 | - $out ["c"] = array ("version" => VERSION, "i18n" => array ( |
|
150 | + $out ["c"] = array("version" => VERSION, "i18n" => array( |
|
151 | 151 | "coverAlt" => localize("i18n.coversection"), |
152 | 152 | "authorsTitle" => localize("authors.title"), |
153 | 153 | "bookwordTitle" => localize("bookword.title"), |
154 | 154 | "tagsTitle" => localize("tags.title"), |
155 | 155 | "linksTitle" => localize("links.title"), |
156 | 156 | "seriesTitle" => localize("series.title"), |
157 | - "customizeTitle" => localize ("customize.title"), |
|
158 | - "aboutTitle" => localize ("about.title"), |
|
159 | - "previousAlt" => localize ("paging.previous.alternate"), |
|
160 | - "nextAlt" => localize ("paging.next.alternate"), |
|
161 | - "searchAlt" => localize ("search.alternate"), |
|
162 | - "sortAlt" => localize ("sort.alternate"), |
|
163 | - "homeAlt" => localize ("home.alternate"), |
|
164 | - "cogAlt" => localize ("cog.alternate"), |
|
165 | - "permalinkAlt" => localize ("permalink.alternate"), |
|
157 | + "customizeTitle" => localize("customize.title"), |
|
158 | + "aboutTitle" => localize("about.title"), |
|
159 | + "previousAlt" => localize("paging.previous.alternate"), |
|
160 | + "nextAlt" => localize("paging.next.alternate"), |
|
161 | + "searchAlt" => localize("search.alternate"), |
|
162 | + "sortAlt" => localize("sort.alternate"), |
|
163 | + "homeAlt" => localize("home.alternate"), |
|
164 | + "cogAlt" => localize("cog.alternate"), |
|
165 | + "permalinkAlt" => localize("permalink.alternate"), |
|
166 | 166 | "publisherName" => localize("publisher.name"), |
167 | 167 | "pubdateTitle" => localize("pubdate.title"), |
168 | 168 | "languagesTitle" => localize("language.title"), |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | "sortorderAsc" => localize("search.sortorder.asc"), |
172 | 172 | "sortorderDesc" => localize("search.sortorder.desc"), |
173 | 173 | "customizeEmail" => localize("customize.email")), |
174 | - "url" => array ( |
|
174 | + "url" => array( |
|
175 | 175 | "detailUrl" => "index.php?page=13&id={0}&db={1}", |
176 | 176 | "coverUrl" => "fetch.php?id={0}&db={1}", |
177 | 177 | "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
178 | - "config" => array ( |
|
178 | + "config" => array( |
|
179 | 179 | "use_fancyapps" => $config ["cops_use_fancyapps"], |
180 | 180 | "max_item_per_page" => $config['cops_max_item_per_page'], |
181 | 181 | "kindleHack" => "", |
182 | - "server_side_rendering" => useServerSideRendering (), |
|
182 | + "server_side_rendering" => useServerSideRendering(), |
|
183 | 183 | "html_tag_filter" => $config['cops_html_tag_filter'])); |
184 | 184 | if ($config['cops_thumbnail_handling'] == "1") { |
185 | 185 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
@@ -192,32 +192,32 @@ discard block |
||
192 | 192 | return $out; |
193 | 193 | } |
194 | 194 | |
195 | - public static function getJson ($complete = false) { |
|
195 | + public static function getJson($complete = false) { |
|
196 | 196 | global $config; |
197 | - $page = getURLParam ("page", Base::PAGE_INDEX); |
|
198 | - $query = getURLParam ("query"); |
|
199 | - $search = getURLParam ("search"); |
|
200 | - $qid = getURLParam ("id"); |
|
201 | - $n = getURLParam ("n", "1"); |
|
202 | - $database = GetUrlParam (DB); |
|
197 | + $page = getURLParam("page", Base::PAGE_INDEX); |
|
198 | + $query = getURLParam("query"); |
|
199 | + $search = getURLParam("search"); |
|
200 | + $qid = getURLParam("id"); |
|
201 | + $n = getURLParam("n", "1"); |
|
202 | + $database = GetUrlParam(DB); |
|
203 | 203 | |
204 | - $currentPage = Page::getPage ($page, $qid, $query, $n); |
|
205 | - $currentPage->InitializeContent (); |
|
204 | + $currentPage = Page::getPage($page, $qid, $query, $n); |
|
205 | + $currentPage->InitializeContent(); |
|
206 | 206 | |
207 | 207 | if ($search) { |
208 | - return self::getContentArrayTypeahead ($currentPage); |
|
208 | + return self::getContentArrayTypeahead($currentPage); |
|
209 | 209 | } |
210 | 210 | |
211 | - $out = array ( "title" => $currentPage->title); |
|
212 | - $entries = array (); |
|
211 | + $out = array("title" => $currentPage->title); |
|
212 | + $entries = array(); |
|
213 | 213 | foreach ($currentPage->entryArray as $entry) { |
214 | - array_push ($entries, self::getContentArray ($entry)); |
|
214 | + array_push($entries, self::getContentArray($entry)); |
|
215 | 215 | } |
216 | - if (!is_null ($currentPage->book)) { |
|
217 | - $out ["book"] = self::getFullBookContentArray ($currentPage->book); |
|
216 | + if (!is_null($currentPage->book)) { |
|
217 | + $out ["book"] = self::getFullBookContentArray($currentPage->book); |
|
218 | 218 | } |
219 | - $out ["databaseId"] = GetUrlParam (DB, ""); |
|
220 | - $out ["databaseName"] = Base::getDbName (); |
|
219 | + $out ["databaseId"] = GetUrlParam(DB, ""); |
|
220 | + $out ["databaseName"] = Base::getDbName(); |
|
221 | 221 | if ($out ["databaseId"] == "") { |
222 | 222 | $out ["databaseName"] = ""; |
223 | 223 | } |
@@ -226,42 +226,42 @@ discard block |
||
226 | 226 | $out ["fullTitle"] = $out ["databaseName"] . " > " . $out ["fullTitle"]; |
227 | 227 | } |
228 | 228 | $out ["page"] = $page; |
229 | - $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0; |
|
229 | + $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled()?1:0; |
|
230 | 230 | $out ["entries"] = $entries; |
231 | 231 | $out ["isPaginated"] = 0; |
232 | - if ($currentPage->isPaginated ()) { |
|
233 | - $prevLink = $currentPage->getPrevLink (); |
|
234 | - $nextLink = $currentPage->getNextLink (); |
|
232 | + if ($currentPage->isPaginated()) { |
|
233 | + $prevLink = $currentPage->getPrevLink(); |
|
234 | + $nextLink = $currentPage->getNextLink(); |
|
235 | 235 | $out ["isPaginated"] = 1; |
236 | 236 | $out ["prevLink"] = ""; |
237 | - if (!is_null ($prevLink)) { |
|
238 | - $out ["prevLink"] = $prevLink->hrefXhtml (); |
|
237 | + if (!is_null($prevLink)) { |
|
238 | + $out ["prevLink"] = $prevLink->hrefXhtml(); |
|
239 | 239 | } |
240 | 240 | $out ["nextLink"] = ""; |
241 | - if (!is_null ($nextLink)) { |
|
242 | - $out ["nextLink"] = $nextLink->hrefXhtml (); |
|
241 | + if (!is_null($nextLink)) { |
|
242 | + $out ["nextLink"] = $nextLink->hrefXhtml(); |
|
243 | 243 | } |
244 | - $out ["maxPage"] = $currentPage->getMaxPage (); |
|
244 | + $out ["maxPage"] = $currentPage->getMaxPage(); |
|
245 | 245 | $out ["currentPage"] = $currentPage->n; |
246 | 246 | } |
247 | - if (!is_null (getURLParam ("complete")) || $complete) { |
|
248 | - $out = self::addCompleteArray ($out); |
|
247 | + if (!is_null(getURLParam("complete")) || $complete) { |
|
248 | + $out = self::addCompleteArray($out); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $out ["containsBook"] = 0; |
252 | - if ($currentPage->containsBook ()) { |
|
252 | + if ($currentPage->containsBook()) { |
|
253 | 253 | $out ["containsBook"] = 1; |
254 | 254 | } |
255 | 255 | |
256 | - $out["abouturl"] = "index.php" . addURLParameter ("?page=" . Base::PAGE_ABOUT, DB, $database); |
|
256 | + $out["abouturl"] = "index.php" . addURLParameter("?page=" . Base::PAGE_ABOUT, DB, $database); |
|
257 | 257 | |
258 | 258 | if ($page == Base::PAGE_ABOUT) { |
259 | - $temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); |
|
259 | + $temp = preg_replace("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); |
|
260 | 260 | $out ["fullhtml"] = $temp; |
261 | 261 | } |
262 | 262 | |
263 | 263 | $out ["homeurl"] = "index.php"; |
264 | - if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); |
|
264 | + if ($page != Base::PAGE_INDEX && !is_null($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database); |
|
265 | 265 | |
266 | 266 | return $out; |
267 | 267 | } |
@@ -7,55 +7,55 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Silly thing because PHP forbid string concatenation in class const |
10 | -define ('SQL_BOOKS_LEFT_JOIN', 'left outer join comments on comments.book = books.id |
|
10 | +define('SQL_BOOKS_LEFT_JOIN', 'left outer join comments on comments.book = books.id |
|
11 | 11 | left outer join books_ratings_link on books_ratings_link.book = books.id |
12 | 12 | left outer join ratings on books_ratings_link.rating = ratings.id '); |
13 | -define ('SQL_BOOKS_ALL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' order by books.sort '); |
|
14 | -define ('SQL_BOOKS_BY_PUBLISHER', 'select {0} from books_publishers_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
13 | +define('SQL_BOOKS_ALL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' order by books.sort '); |
|
14 | +define('SQL_BOOKS_BY_PUBLISHER', 'select {0} from books_publishers_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
15 | 15 | where books_publishers_link.book = books.id and publisher = ? {1} order by publisher'); |
16 | -define ('SQL_BOOKS_BY_FIRST_LETTER', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
16 | +define('SQL_BOOKS_BY_FIRST_LETTER', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
17 | 17 | where upper (books.sort) like ? order by books.sort'); |
18 | -define ('SQL_BOOKS_BY_AUTHOR', 'select {0} from books_authors_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
18 | +define('SQL_BOOKS_BY_AUTHOR', 'select {0} from books_authors_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
19 | 19 | left outer join books_series_link on books_series_link.book = books.id |
20 | 20 | where books_authors_link.book = books.id and author = ? {1} order by series desc, series_index asc, pubdate asc'); |
21 | -define ('SQL_BOOKS_BY_SERIE', 'select {0} from books_series_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
21 | +define('SQL_BOOKS_BY_SERIE', 'select {0} from books_series_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
22 | 22 | where books_series_link.book = books.id and series = ? {1} order by series_index'); |
23 | -define ('SQL_BOOKS_BY_TAG', 'select {0} from books_tags_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
23 | +define('SQL_BOOKS_BY_TAG', 'select {0} from books_tags_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
24 | 24 | where books_tags_link.book = books.id and tag = ? {1} order by sort'); |
25 | -define ('SQL_BOOKS_BY_LANGUAGE', 'select {0} from books_languages_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
25 | +define('SQL_BOOKS_BY_LANGUAGE', 'select {0} from books_languages_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
26 | 26 | where books_languages_link.book = books.id and lang_code = ? {1} order by sort'); |
27 | -define ('SQL_BOOKS_BY_CUSTOM', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
27 | +define('SQL_BOOKS_BY_CUSTOM', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
28 | 28 | where {2}.book = books.id and {2}.{3} = ? {1} order by sort'); |
29 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_TRUE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
29 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_TRUE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
30 | 30 | where {2}.book = books.id and {2}.value = 1 {1} order by sort'); |
31 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_FALSE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
31 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_FALSE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
32 | 32 | where {2}.book = books.id and {2}.value = 0 {1} order by sort'); |
33 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
33 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
34 | 34 | where books.id not in (select book from {2}) {1} order by sort'); |
35 | -define ('SQL_BOOKS_BY_CUSTOM_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
35 | +define('SQL_BOOKS_BY_CUSTOM_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
36 | 36 | left join {2} on {2}.book = books.id |
37 | 37 | left join {3} on {3}.id = {2}.{4} |
38 | 38 | where {3}.value = ? order by sort'); |
39 | -define ('SQL_BOOKS_BY_CUSTOM_RATING_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
39 | +define('SQL_BOOKS_BY_CUSTOM_RATING_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
40 | 40 | left join {2} on {2}.book = books.id |
41 | 41 | left join {3} on {3}.id = {2}.{4} |
42 | 42 | where ((books.id not in (select {2}.book from {2})) or ({3}.value = 0)) {1} order by sort'); |
43 | -define ('SQL_BOOKS_BY_CUSTOM_DATE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
43 | +define('SQL_BOOKS_BY_CUSTOM_DATE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
44 | 44 | where {2}.book = books.id and date({2}.value) = ? {1} order by sort'); |
45 | -define ('SQL_BOOKS_BY_CUSTOM_DIRECT', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
45 | +define('SQL_BOOKS_BY_CUSTOM_DIRECT', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
46 | 46 | where {2}.book = books.id and {2}.value = ? {1} order by sort'); |
47 | -define ('SQL_BOOKS_BY_CUSTOM_DIRECT_ID', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
47 | +define('SQL_BOOKS_BY_CUSTOM_DIRECT_ID', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
48 | 48 | where {2}.book = books.id and {2}.id = ? {1} order by sort'); |
49 | -define ('SQL_BOOKS_QUERY', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
49 | +define('SQL_BOOKS_QUERY', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
50 | 50 | where ( |
51 | 51 | exists (select null from authors, books_authors_link where book = books.id and author = authors.id and authors.name like ?) or |
52 | 52 | exists (select null from tags, books_tags_link where book = books.id and tag = tags.id and tags.name like ?) or |
53 | 53 | exists (select null from series, books_series_link on book = books.id and books_series_link.series = series.id and series.name like ?) or |
54 | 54 | exists (select null from publishers, books_publishers_link where book = books.id and books_publishers_link.publisher = publishers.id and publishers.name like ?) or |
55 | 55 | title like ?) {1} order by books.sort'); |
56 | -define ('SQL_BOOKS_RECENT', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
56 | +define('SQL_BOOKS_RECENT', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
57 | 57 | where 1=1 {1} order by timestamp desc limit '); |
58 | -define ('SQL_BOOKS_BY_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
58 | +define('SQL_BOOKS_BY_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
59 | 59 | where books_ratings_link.book = books.id and ratings.id = ? {1} order by sort'); |
60 | 60 | |
61 | 61 | require('Identifier.php'); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | public $tags = NULL; |
109 | 109 | public $identifiers = NULL; |
110 | 110 | public $languages = NULL; |
111 | - public $format = array (); |
|
111 | + public $format = array(); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | public function __construct($line) { |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | public function getEntryId() { |
133 | - return self::ALL_BOOKS_UUID.':'.$this->uuid; |
|
133 | + return self::ALL_BOOKS_UUID . ':' . $this->uuid; |
|
134 | 134 | } |
135 | 135 | |
136 | - public static function getEntryIdByLetter ($startingLetter) { |
|
137 | - return self::ALL_BOOKS_ID.':letter:'.$startingLetter; |
|
136 | + public static function getEntryIdByLetter($startingLetter) { |
|
137 | + return self::ALL_BOOKS_ID . ':letter:' . $startingLetter; |
|
138 | 138 | } |
139 | 139 | |
140 | - public function getUri () { |
|
141 | - return '?page='.parent::PAGE_BOOK_DETAIL.'&id=' . $this->id; |
|
140 | + public function getUri() { |
|
141 | + return '?page=' . parent::PAGE_BOOK_DETAIL . '&id=' . $this->id; |
|
142 | 142 | } |
143 | 143 | |
144 | - public function getDetailUrl () { |
|
144 | + public function getDetailUrl() { |
|
145 | 145 | $urlParam = $this->getUri(); |
146 | - if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam (DB)); |
|
146 | + if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam(DB)); |
|
147 | 147 | return 'index.php' . $urlParam; |
148 | 148 | } |
149 | 149 | |
150 | - public function getTitle () { |
|
150 | + public function getTitle() { |
|
151 | 151 | return $this->title; |
152 | 152 | } |
153 | 153 | |
@@ -156,22 +156,22 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * @return Author[] |
158 | 158 | */ |
159 | - public function getAuthors () { |
|
159 | + public function getAuthors() { |
|
160 | 160 | if (is_null($this->authors)) { |
161 | 161 | $this->authors = Author::getAuthorByBookId($this->id); |
162 | 162 | } |
163 | 163 | return $this->authors; |
164 | 164 | } |
165 | 165 | |
166 | - public function getAuthorsName () { |
|
167 | - return implode(', ', array_map(function ($author) { return $author->name; }, $this->getAuthors())); |
|
166 | + public function getAuthorsName() { |
|
167 | + return implode(', ', array_map(function($author) { return $author->name; }, $this->getAuthors())); |
|
168 | 168 | } |
169 | 169 | |
170 | - public function getAuthorsSort () { |
|
171 | - return implode(', ', array_map(function ($author) { return $author->sort; }, $this->getAuthors())); |
|
170 | + public function getAuthorsSort() { |
|
171 | + return implode(', ', array_map(function($author) { return $author->sort; }, $this->getAuthors())); |
|
172 | 172 | } |
173 | 173 | |
174 | - public function getPublisher () { |
|
174 | + public function getPublisher() { |
|
175 | 175 | if (is_null($this->publisher)) { |
176 | 176 | $this->publisher = Publisher::getPublisherByBookId($this->id); |
177 | 177 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return Tag[] |
211 | 211 | */ |
212 | 212 | public function getTags() { |
213 | - if (is_null ($this->tags)) { |
|
213 | + if (is_null($this->tags)) { |
|
214 | 214 | $this->tags = array(); |
215 | 215 | |
216 | 216 | $result = parent::getDb()->prepare('select tags.id as id, name |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | public function getTagsName() { |
231 | - return implode(', ', array_map(function ($tag) { return $tag->name; }, $this->getTags())); |
|
231 | + return implode(', ', array_map(function($tag) { return $tag->name; }, $this->getTags())); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @return Identifiers[] |
237 | 237 | */ |
238 | 238 | public function getIdentifiers() { |
239 | - if (is_null ($this->identifiers)) { |
|
239 | + if (is_null($this->identifiers)) { |
|
240 | 240 | $this->identifiers = array(); |
241 | 241 | |
242 | 242 | $result = parent::getDb()->prepare('select type, val, id |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | public function getDataById($idData) |
304 | 304 | { |
305 | - $reduced = array_filter($this->getDatas(), function ($data) use ($idData) { |
|
305 | + $reduced = array_filter($this->getDatas(), function($data) use ($idData) { |
|
306 | 306 | return $data->id == $idData; |
307 | 307 | }); |
308 | 308 | return reset($reduced); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | if (empty ($this->pubdate)) { |
327 | 327 | return ''; |
328 | 328 | } |
329 | - $dateY = (int) substr($this->pubdate, 0, 4); |
|
329 | + $dateY = (int)substr($this->pubdate, 0, 4); |
|
330 | 330 | if ($dateY > 102) { |
331 | 331 | return str_pad($dateY, 4, '0', STR_PAD_LEFT); |
332 | 332 | } |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | |
336 | 336 | public function getComment($withSerie = true) { |
337 | 337 | $addition = ''; |
338 | - $se = $this->getSerie (); |
|
339 | - if (!is_null ($se) && $withSerie) { |
|
338 | + $se = $this->getSerie(); |
|
339 | + if (!is_null($se) && $withSerie) { |
|
340 | 340 | $addition = $addition . '<strong>' . localize('content.series') . '</strong>' . str_format(localize('content.series.data'), $this->seriesIndex, htmlspecialchars($se->name)) . "<br />\n"; |
341 | 341 | } |
342 | 342 | if (preg_match('/<\/(div|p|a|span)>/', $this->comment)) |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | } |
351 | 351 | |
352 | 352 | public function getDataFormat($format) { |
353 | - $reduced = array_filter($this->getDatas(), function ($data) use ($format) { |
|
353 | + $reduced = array_filter($this->getDatas(), function($data) use ($format) { |
|
354 | 354 | return $data->format == $format; |
355 | 355 | }); |
356 | 356 | return reset($reduced); |
@@ -371,11 +371,11 @@ discard block |
||
371 | 371 | |
372 | 372 | if ($relative) |
373 | 373 | { |
374 | - return $this->relativePath.'/'.$file; |
|
374 | + return $this->relativePath . '/' . $file; |
|
375 | 375 | } |
376 | 376 | else |
377 | 377 | { |
378 | - return $this->path.'/'.$file; |
|
378 | + return $this->path . '/' . $file; |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | } |
396 | 396 | $epub->Authors($authorArray); |
397 | 397 | $epub->Language($this->getLanguages()); |
398 | - $epub->Description ($this->getComment(false)); |
|
398 | + $epub->Description($this->getComment(false)); |
|
399 | 399 | $epub->Subjects($this->getTagsName()); |
400 | 400 | $epub->Cover2($this->getFilePath('jpg'), 'image/jpeg'); |
401 | 401 | $epub->Calibre($this->uuid); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $epub->SerieIndex($this->seriesIndex); |
406 | 406 | } |
407 | 407 | $filename = $data->getUpdatedFilenameEpub(); |
408 | - if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) { |
|
408 | + if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) { |
|
409 | 409 | $epub->updateForKepub(); |
410 | 410 | $filename = $data->getUpdatedFilenameKepub(); |
411 | 411 | } |
@@ -431,11 +431,11 @@ discard block |
||
431 | 431 | if (!is_null($width)) { |
432 | 432 | $nw = $width; |
433 | 433 | if ($nw >= $w) { return false; } |
434 | - $nh = ($nw*$h)/$w; |
|
434 | + $nh = ($nw * $h) / $w; |
|
435 | 435 | } else { |
436 | 436 | $nh = $height; |
437 | 437 | if ($nh >= $h) { return false; } |
438 | - $nw = ($nh*$w)/$h; |
|
438 | + $nw = ($nh * $w) / $h; |
|
439 | 439 | } |
440 | 440 | } else { |
441 | 441 | return false; |
@@ -443,16 +443,16 @@ discard block |
||
443 | 443 | |
444 | 444 | //draw the image |
445 | 445 | $src_img = imagecreatefromjpeg($file); |
446 | - $dst_img = imagecreatetruecolor($nw,$nh); |
|
447 | - imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h);//resizing the image |
|
448 | - imagejpeg($dst_img,$outputfile,80); |
|
446 | + $dst_img = imagecreatetruecolor($nw, $nh); |
|
447 | + imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h); //resizing the image |
|
448 | + imagejpeg($dst_img, $outputfile, 80); |
|
449 | 449 | imagedestroy($src_img); |
450 | 450 | imagedestroy($dst_img); |
451 | 451 | |
452 | 452 | return true; |
453 | 453 | } |
454 | 454 | |
455 | - public function getLinkArray () |
|
455 | + public function getLinkArray() |
|
456 | 456 | { |
457 | 457 | $linkArray = array(); |
458 | 458 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | } |
478 | 478 | |
479 | 479 | $serie = $this->getSerie(); |
480 | - if (!is_null ($serie)) { |
|
480 | + if (!is_null($serie)) { |
|
481 | 481 | array_push($linkArray, new LinkNavigation($serie->getUri(), 'related', str_format(localize('content.series.data'), $this->seriesIndex, $serie->name))); |
482 | 482 | } |
483 | 483 | |
@@ -502,13 +502,13 @@ discard block |
||
502 | 502 | $entry = new Entry(localize('allbooks.title'), |
503 | 503 | self::ALL_BOOKS_ID, |
504 | 504 | str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', |
505 | - array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
505 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
506 | 506 | array_push($result, $entry); |
507 | 507 | if ($config['cops_recentbooks_limit'] > 0) { |
508 | 508 | $entry = new Entry(localize('recent.title'), |
509 | 509 | self::ALL_RECENT_BOOKS_ID, |
510 | 510 | str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', |
511 | - array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
511 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
512 | 512 | array_push($result, $entry); |
513 | 513 | } |
514 | 514 | return $result; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | } |
605 | 605 | |
606 | 606 | public static function getBooks($n) { |
607 | - list ($entryArray, $totalNumber) = self::getEntryArray(self::SQL_BOOKS_ALL , array (), $n); |
|
607 | + list ($entryArray, $totalNumber) = self::getEntryArray(self::SQL_BOOKS_ALL, array(), $n); |
|
608 | 608 | return array($entryArray, $totalNumber); |
609 | 609 | } |
610 | 610 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | { |
622 | 622 | array_push($entryArray, new Entry($post->title, Book::getEntryIdByLetter($post->title), |
623 | 623 | str_format(localize('bookword', $post->count), $post->count), 'text', |
624 | - array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))), '', $post->count)); |
|
624 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS_LETTER . '&id=' . rawurlencode($post->title))), '', $post->count)); |
|
625 | 625 | } |
626 | 626 | return $entryArray; |
627 | 627 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | |
647 | 647 | public static function getAllRecentBooks() { |
648 | 648 | global $config; |
649 | - list ($entryArray, ) = self::getEntryArray(self::SQL_BOOKS_RECENT . $config['cops_recentbooks_limit'], array(), -1); |
|
649 | + list ($entryArray,) = self::getEntryArray(self::SQL_BOOKS_RECENT . $config['cops_recentbooks_limit'], array(), -1); |
|
650 | 650 | return $entryArray; |
651 | 651 | } |
652 | 652 |
@@ -111,7 +111,8 @@ discard block |
||
111 | 111 | public $format = array (); |
112 | 112 | |
113 | 113 | |
114 | - public function __construct($line) { |
|
114 | + public function __construct($line) |
|
115 | + { |
|
115 | 116 | $this->id = $line->id; |
116 | 117 | $this->title = $line->title; |
117 | 118 | $this->timestamp = strtotime($line->timestamp); |
@@ -129,25 +130,32 @@ discard block |
||
129 | 130 | $this->rating = $line->rating; |
130 | 131 | } |
131 | 132 | |
132 | - public function getEntryId() { |
|
133 | + public function getEntryId() |
|
134 | + { |
|
133 | 135 | return self::ALL_BOOKS_UUID.':'.$this->uuid; |
134 | 136 | } |
135 | 137 | |
136 | - public static function getEntryIdByLetter ($startingLetter) { |
|
138 | + public static function getEntryIdByLetter ($startingLetter) |
|
139 | + { |
|
137 | 140 | return self::ALL_BOOKS_ID.':letter:'.$startingLetter; |
138 | 141 | } |
139 | 142 | |
140 | - public function getUri () { |
|
143 | + public function getUri () |
|
144 | + { |
|
141 | 145 | return '?page='.parent::PAGE_BOOK_DETAIL.'&id=' . $this->id; |
142 | 146 | } |
143 | 147 | |
144 | - public function getDetailUrl () { |
|
148 | + public function getDetailUrl () |
|
149 | + { |
|
145 | 150 | $urlParam = $this->getUri(); |
146 | - if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam (DB)); |
|
151 | + if (!is_null(GetUrlParam(DB))) { |
|
152 | + $urlParam = addURLParameter($urlParam, DB, GetUrlParam (DB)); |
|
153 | + } |
|
147 | 154 | return 'index.php' . $urlParam; |
148 | 155 | } |
149 | 156 | |
150 | - public function getTitle () { |
|
157 | + public function getTitle () |
|
158 | + { |
|
151 | 159 | return $this->title; |
152 | 160 | } |
153 | 161 | |
@@ -156,22 +164,26 @@ discard block |
||
156 | 164 | /** |
157 | 165 | * @return Author[] |
158 | 166 | */ |
159 | - public function getAuthors () { |
|
167 | + public function getAuthors () |
|
168 | + { |
|
160 | 169 | if (is_null($this->authors)) { |
161 | 170 | $this->authors = Author::getAuthorByBookId($this->id); |
162 | 171 | } |
163 | 172 | return $this->authors; |
164 | 173 | } |
165 | 174 | |
166 | - public function getAuthorsName () { |
|
175 | + public function getAuthorsName () |
|
176 | + { |
|
167 | 177 | return implode(', ', array_map(function ($author) { return $author->name; }, $this->getAuthors())); |
168 | 178 | } |
169 | 179 | |
170 | - public function getAuthorsSort () { |
|
180 | + public function getAuthorsSort () |
|
181 | + { |
|
171 | 182 | return implode(', ', array_map(function ($author) { return $author->sort; }, $this->getAuthors())); |
172 | 183 | } |
173 | 184 | |
174 | - public function getPublisher () { |
|
185 | + public function getPublisher () |
|
186 | + { |
|
175 | 187 | if (is_null($this->publisher)) { |
176 | 188 | $this->publisher = Publisher::getPublisherByBookId($this->id); |
177 | 189 | } |
@@ -181,7 +193,8 @@ discard block |
||
181 | 193 | /** |
182 | 194 | * @return Serie |
183 | 195 | */ |
184 | - public function getSerie() { |
|
196 | + public function getSerie() |
|
197 | + { |
|
185 | 198 | if (is_null($this->serie)) { |
186 | 199 | $this->serie = Serie::getSerieByBookId($this->id); |
187 | 200 | } |
@@ -191,7 +204,8 @@ discard block |
||
191 | 204 | /** |
192 | 205 | * @return string |
193 | 206 | */ |
194 | - public function getLanguages() { |
|
207 | + public function getLanguages() |
|
208 | + { |
|
195 | 209 | $lang = array(); |
196 | 210 | $result = parent::getDb()->prepare('select languages.lang_code |
197 | 211 | from books_languages_link, languages |
@@ -199,8 +213,7 @@ discard block |
||
199 | 213 | and book = ? |
200 | 214 | order by item_order'); |
201 | 215 | $result->execute(array($this->id)); |
202 | - while ($post = $result->fetchObject()) |
|
203 | - { |
|
216 | + while ($post = $result->fetchObject()) { |
|
204 | 217 | array_push($lang, Language::getLanguageString($post->lang_code)); |
205 | 218 | } |
206 | 219 | return implode(', ', $lang); |
@@ -209,7 +222,8 @@ discard block |
||
209 | 222 | /** |
210 | 223 | * @return Tag[] |
211 | 224 | */ |
212 | - public function getTags() { |
|
225 | + public function getTags() |
|
226 | + { |
|
213 | 227 | if (is_null ($this->tags)) { |
214 | 228 | $this->tags = array(); |
215 | 229 | |
@@ -219,15 +233,15 @@ discard block |
||
219 | 233 | and book = ? |
220 | 234 | order by name'); |
221 | 235 | $result->execute(array($this->id)); |
222 | - while ($post = $result->fetchObject()) |
|
223 | - { |
|
236 | + while ($post = $result->fetchObject()) { |
|
224 | 237 | array_push($this->tags, new Tag($post)); |
225 | 238 | } |
226 | 239 | } |
227 | 240 | return $this->tags; |
228 | 241 | } |
229 | 242 | |
230 | - public function getTagsName() { |
|
243 | + public function getTagsName() |
|
244 | + { |
|
231 | 245 | return implode(', ', array_map(function ($tag) { return $tag->name; }, $this->getTags())); |
232 | 246 | } |
233 | 247 | |
@@ -235,7 +249,8 @@ discard block |
||
235 | 249 | /** |
236 | 250 | * @return Identifiers[] |
237 | 251 | */ |
238 | - public function getIdentifiers() { |
|
252 | + public function getIdentifiers() |
|
253 | + { |
|
239 | 254 | if (is_null ($this->identifiers)) { |
240 | 255 | $this->identifiers = array(); |
241 | 256 | |
@@ -244,8 +259,7 @@ discard block |
||
244 | 259 | where book = ? |
245 | 260 | order by type'); |
246 | 261 | $result->execute(array($this->id)); |
247 | - while ($post = $result->fetchObject()) |
|
248 | - { |
|
262 | + while ($post = $result->fetchObject()) { |
|
249 | 263 | array_push($this->identifiers, new Identifier($post)); |
250 | 264 | } |
251 | 265 | |
@@ -266,9 +280,12 @@ discard block |
||
266 | 280 | |
267 | 281 | /* End of other class (author, series, tag, ...) initialization and accessors */ |
268 | 282 | |
269 | - public static function getFilterString() { |
|
283 | + public static function getFilterString() |
|
284 | + { |
|
270 | 285 | $filter = getURLParam('tag', NULL); |
271 | - if (empty($filter)) return ''; |
|
286 | + if (empty($filter)) { |
|
287 | + return ''; |
|
288 | + } |
|
272 | 289 | |
273 | 290 | $exists = true; |
274 | 291 | if (preg_match("/^!(.*)$/", $filter, $matches)) { |
@@ -308,7 +325,8 @@ discard block |
||
308 | 325 | return reset($reduced); |
309 | 326 | } |
310 | 327 | |
311 | - public function getRating() { |
|
328 | + public function getRating() |
|
329 | + { |
|
312 | 330 | if (is_null($this->rating) || $this->rating == 0) { |
313 | 331 | return ''; |
314 | 332 | } |
@@ -322,7 +340,8 @@ discard block |
||
322 | 340 | return $retour; |
323 | 341 | } |
324 | 342 | |
325 | - public function getPubDate() { |
|
343 | + public function getPubDate() |
|
344 | + { |
|
326 | 345 | if (empty ($this->pubdate)) { |
327 | 346 | return ''; |
328 | 347 | } |
@@ -333,23 +352,22 @@ discard block |
||
333 | 352 | return ''; |
334 | 353 | } |
335 | 354 | |
336 | - public function getComment($withSerie = true) { |
|
355 | + public function getComment($withSerie = true) |
|
356 | + { |
|
337 | 357 | $addition = ''; |
338 | 358 | $se = $this->getSerie (); |
339 | 359 | if (!is_null ($se) && $withSerie) { |
340 | 360 | $addition = $addition . '<strong>' . localize('content.series') . '</strong>' . str_format(localize('content.series.data'), $this->seriesIndex, htmlspecialchars($se->name)) . "<br />\n"; |
341 | 361 | } |
342 | - if (preg_match('/<\/(div|p|a|span)>/', $this->comment)) |
|
343 | - { |
|
362 | + if (preg_match('/<\/(div|p|a|span)>/', $this->comment)) { |
|
344 | 363 | return $addition . html2xhtml($this->comment); |
345 | - } |
|
346 | - else |
|
347 | - { |
|
364 | + } else { |
|
348 | 365 | return $addition . htmlspecialchars($this->comment); |
349 | 366 | } |
350 | 367 | } |
351 | 368 | |
352 | - public function getDataFormat($format) { |
|
369 | + public function getDataFormat($format) |
|
370 | + { |
|
353 | 371 | $reduced = array_filter($this->getDatas(), function ($data) use ($format) { |
354 | 372 | return $data->format == $format; |
355 | 373 | }); |
@@ -358,23 +376,19 @@ discard block |
||
358 | 376 | |
359 | 377 | public function getFilePath($extension, $idData = NULL, $relative = false) |
360 | 378 | { |
361 | - if ($extension == 'jpg') |
|
362 | - { |
|
379 | + if ($extension == 'jpg') { |
|
363 | 380 | $file = 'cover.jpg'; |
364 | - } |
|
365 | - else |
|
366 | - { |
|
381 | + } else { |
|
367 | 382 | $data = $this->getDataById($idData); |
368 | - if (!$data) return NULL; |
|
383 | + if (!$data) { |
|
384 | + return NULL; |
|
385 | + } |
|
369 | 386 | $file = $data->name . '.' . strtolower($data->format); |
370 | 387 | } |
371 | 388 | |
372 | - if ($relative) |
|
373 | - { |
|
389 | + if ($relative) { |
|
374 | 390 | return $this->relativePath.'/'.$file; |
375 | - } |
|
376 | - else |
|
377 | - { |
|
391 | + } else { |
|
378 | 392 | return $this->path.'/'.$file; |
379 | 393 | } |
380 | 394 | } |
@@ -384,8 +398,7 @@ discard block |
||
384 | 398 | global $config; |
385 | 399 | $data = $this->getDataById($idData); |
386 | 400 | |
387 | - try |
|
388 | - { |
|
401 | + try { |
|
389 | 402 | $epub = new EPub($data->getLocalPath()); |
390 | 403 | |
391 | 404 | $epub->Title($this->title); |
@@ -410,14 +423,13 @@ discard block |
||
410 | 423 | $filename = $data->getUpdatedFilenameKepub(); |
411 | 424 | } |
412 | 425 | $epub->download($filename); |
413 | - } |
|
414 | - catch (Exception $e) |
|
415 | - { |
|
426 | + } catch (Exception $e) { |
|
416 | 427 | echo 'Exception : ' . $e->getMessage(); |
417 | 428 | } |
418 | 429 | } |
419 | 430 | |
420 | - public function getThumbnail($width, $height, $outputfile = NULL) { |
|
431 | + public function getThumbnail($width, $height, $outputfile = NULL) |
|
432 | + { |
|
421 | 433 | if (is_null($width) && is_null($height)) { |
422 | 434 | return false; |
423 | 435 | } |
@@ -456,17 +468,14 @@ discard block |
||
456 | 468 | { |
457 | 469 | $linkArray = array(); |
458 | 470 | |
459 | - if ($this->hasCover) |
|
460 | - { |
|
471 | + if ($this->hasCover) { |
|
461 | 472 | array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
462 | 473 | |
463 | 474 | array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL)); |
464 | 475 | } |
465 | 476 | |
466 | - foreach ($this->getDatas() as $data) |
|
467 | - { |
|
468 | - if ($data->isKnownType()) |
|
469 | - { |
|
477 | + foreach ($this->getDatas() as $data) { |
|
478 | + if ($data->isKnownType()) { |
|
470 | 479 | array_push($linkArray, $data->getDataLink(Link::OPDS_ACQUISITION_TYPE, $data->format)); |
471 | 480 | } |
472 | 481 | } |
@@ -485,17 +494,20 @@ discard block |
||
485 | 494 | } |
486 | 495 | |
487 | 496 | |
488 | - public function getEntry() { |
|
497 | + public function getEntry() |
|
498 | + { |
|
489 | 499 | return new EntryBook($this->getTitle(), $this->getEntryId(), |
490 | 500 | $this->getComment(), 'text/html', |
491 | 501 | $this->getLinkArray(), $this); |
492 | 502 | } |
493 | 503 | |
494 | - public static function getBookCount($database = NULL) { |
|
504 | + public static function getBookCount($database = NULL) |
|
505 | + { |
|
495 | 506 | return parent::executeQuerySingle('select count(*) from books', $database); |
496 | 507 | } |
497 | 508 | |
498 | - public static function getCount() { |
|
509 | + public static function getCount() |
|
510 | + { |
|
499 | 511 | global $config; |
500 | 512 | $nBooks = parent::executeQuerySingle('select count(*) from books'); |
501 | 513 | $result = array(); |
@@ -514,27 +526,33 @@ discard block |
||
514 | 526 | return $result; |
515 | 527 | } |
516 | 528 | |
517 | - public static function getBooksByAuthor($authorId, $n) { |
|
529 | + public static function getBooksByAuthor($authorId, $n) |
|
530 | + { |
|
518 | 531 | return self::getEntryArray(self::SQL_BOOKS_BY_AUTHOR, array($authorId), $n); |
519 | 532 | } |
520 | 533 | |
521 | - public static function getBooksByRating($ratingId, $n) { |
|
534 | + public static function getBooksByRating($ratingId, $n) |
|
535 | + { |
|
522 | 536 | return self::getEntryArray(self::SQL_BOOKS_BY_RATING, array($ratingId), $n); |
523 | 537 | } |
524 | 538 | |
525 | - public static function getBooksByPublisher($publisherId, $n) { |
|
539 | + public static function getBooksByPublisher($publisherId, $n) |
|
540 | + { |
|
526 | 541 | return self::getEntryArray(self::SQL_BOOKS_BY_PUBLISHER, array($publisherId), $n); |
527 | 542 | } |
528 | 543 | |
529 | - public static function getBooksBySeries($serieId, $n) { |
|
544 | + public static function getBooksBySeries($serieId, $n) |
|
545 | + { |
|
530 | 546 | return self::getEntryArray(self::SQL_BOOKS_BY_SERIE, array($serieId), $n); |
531 | 547 | } |
532 | 548 | |
533 | - public static function getBooksByTag($tagId, $n) { |
|
549 | + public static function getBooksByTag($tagId, $n) |
|
550 | + { |
|
534 | 551 | return self::getEntryArray(self::SQL_BOOKS_BY_TAG, array($tagId), $n); |
535 | 552 | } |
536 | 553 | |
537 | - public static function getBooksByLanguage($languageId, $n) { |
|
554 | + public static function getBooksByLanguage($languageId, $n) |
|
555 | + { |
|
538 | 556 | return self::getEntryArray(self::SQL_BOOKS_BY_LANGUAGE, array($languageId), $n); |
539 | 557 | } |
540 | 558 | |
@@ -544,32 +562,33 @@ discard block |
||
544 | 562 | * @param $n integer |
545 | 563 | * @return array |
546 | 564 | */ |
547 | - public static function getBooksByCustom($customColumn, $id, $n) { |
|
565 | + public static function getBooksByCustom($customColumn, $id, $n) |
|
566 | + { |
|
548 | 567 | list($query, $params) = $customColumn->getQuery($id); |
549 | 568 | |
550 | 569 | return self::getEntryArray($query, $params, $n); |
551 | 570 | } |
552 | 571 | |
553 | - public static function getBookById($bookId) { |
|
572 | + public static function getBookById($bookId) |
|
573 | + { |
|
554 | 574 | $result = parent::getDb()->prepare('select ' . self::BOOK_COLUMNS . ' |
555 | 575 | from books ' . self::SQL_BOOKS_LEFT_JOIN . ' |
556 | 576 | where books.id = ?'); |
557 | 577 | $result->execute(array($bookId)); |
558 | - while ($post = $result->fetchObject()) |
|
559 | - { |
|
578 | + while ($post = $result->fetchObject()) { |
|
560 | 579 | $book = new Book($post); |
561 | 580 | return $book; |
562 | 581 | } |
563 | 582 | return NULL; |
564 | 583 | } |
565 | 584 | |
566 | - public static function getBookByDataId($dataId) { |
|
585 | + public static function getBookByDataId($dataId) |
|
586 | + { |
|
567 | 587 | $result = parent::getDb()->prepare('select ' . self::BOOK_COLUMNS . ', data.name, data.format |
568 | 588 | from data, books ' . self::SQL_BOOKS_LEFT_JOIN . ' |
569 | 589 | where data.book = books.id and data.id = ?'); |
570 | 590 | $result->execute(array($dataId)); |
571 | - while ($post = $result->fetchObject()) |
|
572 | - { |
|
591 | + while ($post = $result->fetchObject()) { |
|
573 | 592 | $book = new Book($post); |
574 | 593 | $data = new Data($post, $book); |
575 | 594 | $data->id = $dataId; |
@@ -579,7 +598,8 @@ discard block |
||
579 | 598 | return NULL; |
580 | 599 | } |
581 | 600 | |
582 | - public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
|
601 | + public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) |
|
602 | + { |
|
583 | 603 | $i = 0; |
584 | 604 | $critArray = array(); |
585 | 605 | foreach (array(PageQueryResult::SCOPE_AUTHOR, |
@@ -590,8 +610,7 @@ discard block |
||
590 | 610 | if (in_array($key, getCurrentOption('ignored_categories')) || |
591 | 611 | (!array_key_exists($key, $query) && !array_key_exists('all', $query))) { |
592 | 612 | $critArray[$i] = self::BAD_SEARCH; |
593 | - } |
|
594 | - else { |
|
613 | + } else { |
|
595 | 614 | if (array_key_exists($key, $query)) { |
596 | 615 | $critArray[$i] = $query[$key]; |
597 | 616 | } else { |
@@ -603,12 +622,14 @@ discard block |
||
603 | 622 | return self::getEntryArray(self::SQL_BOOKS_QUERY, $critArray, $n, $database, $numberPerPage); |
604 | 623 | } |
605 | 624 | |
606 | - public static function getBooks($n) { |
|
625 | + public static function getBooks($n) |
|
626 | + { |
|
607 | 627 | list ($entryArray, $totalNumber) = self::getEntryArray(self::SQL_BOOKS_ALL , array (), $n); |
608 | 628 | return array($entryArray, $totalNumber); |
609 | 629 | } |
610 | 630 | |
611 | - public static function getAllBooks() { |
|
631 | + public static function getAllBooks() |
|
632 | + { |
|
612 | 633 | /* @var $result PDOStatement */ |
613 | 634 | |
614 | 635 | list (, $result) = parent::executeQuery('select {0} |
@@ -617,8 +638,7 @@ discard block |
||
617 | 638 | order by substr (upper (sort), 1, 1)', 'substr (upper (sort), 1, 1) as title, count(*) as count', self::getFilterString(), array(), -1); |
618 | 639 | |
619 | 640 | $entryArray = array(); |
620 | - while ($post = $result->fetchObject()) |
|
621 | - { |
|
641 | + while ($post = $result->fetchObject()) { |
|
622 | 642 | array_push($entryArray, new Entry($post->title, Book::getEntryIdByLetter($post->title), |
623 | 643 | str_format(localize('bookword', $post->count), $post->count), 'text', |
624 | 644 | array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))), '', $post->count)); |
@@ -626,25 +646,27 @@ discard block |
||
626 | 646 | return $entryArray; |
627 | 647 | } |
628 | 648 | |
629 | - public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { |
|
649 | + public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) |
|
650 | + { |
|
630 | 651 | return self::getEntryArray(self::SQL_BOOKS_BY_FIRST_LETTER, array($letter . '%'), $n, $database, $numberPerPage); |
631 | 652 | } |
632 | 653 | |
633 | - public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) { |
|
654 | + public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) |
|
655 | + { |
|
634 | 656 | /* @var $totalNumber integer */ |
635 | 657 | /* @var $result PDOStatement */ |
636 | 658 | list($totalNumber, $result) = parent::executeQuery($query, self::BOOK_COLUMNS, self::getFilterString(), $params, $n, $database, $numberPerPage); |
637 | 659 | |
638 | 660 | $entryArray = array(); |
639 | - while ($post = $result->fetchObject()) |
|
640 | - { |
|
661 | + while ($post = $result->fetchObject()) { |
|
641 | 662 | $book = new Book($post); |
642 | 663 | array_push($entryArray, $book->getEntry()); |
643 | 664 | } |
644 | 665 | return array($entryArray, $totalNumber); |
645 | 666 | } |
646 | 667 | |
647 | - public static function getAllRecentBooks() { |
|
668 | + public static function getAllRecentBooks() |
|
669 | + { |
|
648 | 670 | global $config; |
649 | 671 | list ($entryArray, ) = self::getEntryArray(self::SQL_BOOKS_RECENT . $config['cops_recentbooks_limit'], array(), -1); |
650 | 672 | return $entryArray; |
@@ -656,7 +678,8 @@ discard block |
||
656 | 678 | * @param string[] $columns |
657 | 679 | * @return CustomColumn[] |
658 | 680 | */ |
659 | - public function getCustomColumnValues($columns, $asArray = false) { |
|
681 | + public function getCustomColumnValues($columns, $asArray = false) |
|
682 | + { |
|
660 | 683 | $result = array(); |
661 | 684 | |
662 | 685 | foreach ($columns as $lookup) { |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | public $seriesIndex; |
102 | 102 | public $comment; |
103 | 103 | public $rating; |
104 | - public $datas = NULL; |
|
105 | - public $authors = NULL; |
|
106 | - public $publisher = NULL; |
|
107 | - public $serie = NULL; |
|
108 | - public $tags = NULL; |
|
109 | - public $identifiers = NULL; |
|
110 | - public $languages = NULL; |
|
104 | + public $datas = null; |
|
105 | + public $authors = null; |
|
106 | + public $publisher = null; |
|
107 | + public $serie = null; |
|
108 | + public $tags = null; |
|
109 | + public $identifiers = null; |
|
110 | + public $languages = null; |
|
111 | 111 | public $format = array (); |
112 | 112 | |
113 | 113 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | /* End of other class (author, series, tag, ...) initialization and accessors */ |
268 | 268 | |
269 | 269 | public static function getFilterString() { |
270 | - $filter = getURLParam('tag', NULL); |
|
270 | + $filter = getURLParam('tag', null); |
|
271 | 271 | if (empty($filter)) return ''; |
272 | 272 | |
273 | 273 | $exists = true; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | { |
290 | 290 | $bestFormatForKindle = array('EPUB', 'PDF', 'AZW3', 'MOBI'); |
291 | 291 | $bestRank = -1; |
292 | - $bestData = NULL; |
|
292 | + $bestData = null; |
|
293 | 293 | foreach ($this->getDatas() as $data) { |
294 | 294 | $key = array_search($data->format, $bestFormatForKindle); |
295 | 295 | if ($key !== false && $key > $bestRank) { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | return reset($reduced); |
357 | 357 | } |
358 | 358 | |
359 | - public function getFilePath($extension, $idData = NULL, $relative = false) |
|
359 | + public function getFilePath($extension, $idData = null, $relative = false) |
|
360 | 360 | { |
361 | 361 | if ($extension == 'jpg') |
362 | 362 | { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | else |
366 | 366 | { |
367 | 367 | $data = $this->getDataById($idData); |
368 | - if (!$data) return NULL; |
|
368 | + if (!$data) return null; |
|
369 | 369 | $file = $data->name . '.' . strtolower($data->format); |
370 | 370 | } |
371 | 371 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | } |
418 | 418 | } |
419 | 419 | |
420 | - public function getThumbnail($width, $height, $outputfile = NULL) { |
|
420 | + public function getThumbnail($width, $height, $outputfile = null) { |
|
421 | 421 | if (is_null($width) && is_null($height)) { |
422 | 422 | return false; |
423 | 423 | } |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | |
459 | 459 | if ($this->hasCover) |
460 | 460 | { |
461 | - array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL)); |
|
461 | + array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', null)); |
|
462 | 462 | |
463 | - array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL)); |
|
463 | + array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', null)); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | foreach ($this->getDatas() as $data) |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $this->getLinkArray(), $this); |
492 | 492 | } |
493 | 493 | |
494 | - public static function getBookCount($database = NULL) { |
|
494 | + public static function getBookCount($database = null) { |
|
495 | 495 | return parent::executeQuerySingle('select count(*) from books', $database); |
496 | 496 | } |
497 | 497 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | $book = new Book($post); |
561 | 561 | return $book; |
562 | 562 | } |
563 | - return NULL; |
|
563 | + return null; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | public static function getBookByDataId($dataId) { |
@@ -576,10 +576,10 @@ discard block |
||
576 | 576 | $book->datas = array($data); |
577 | 577 | return $book; |
578 | 578 | } |
579 | - return NULL; |
|
579 | + return null; |
|
580 | 580 | } |
581 | 581 | |
582 | - public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
|
582 | + public static function getBooksByQuery($query, $n, $database = null, $numberPerPage = null) { |
|
583 | 583 | $i = 0; |
584 | 584 | $critArray = array(); |
585 | 585 | foreach (array(PageQueryResult::SCOPE_AUTHOR, |
@@ -626,11 +626,11 @@ discard block |
||
626 | 626 | return $entryArray; |
627 | 627 | } |
628 | 628 | |
629 | - public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { |
|
629 | + public static function getBooksByStartingLetter($letter, $n, $database = null, $numberPerPage = null) { |
|
630 | 630 | return self::getEntryArray(self::SQL_BOOKS_BY_FIRST_LETTER, array($letter . '%'), $n, $database, $numberPerPage); |
631 | 631 | } |
632 | 632 | |
633 | - public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) { |
|
633 | + public static function getEntryArray($query, $params, $n, $database = null, $numberPerPage = null) { |
|
634 | 634 | /* @var $totalNumber integer */ |
635 | 635 | /* @var $result PDOStatement */ |
636 | 636 | list($totalNumber, $result) = parent::executeQuery($query, self::BOOK_COLUMNS, self::getFilterString(), $params, $n, $database, $numberPerPage); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function __construct($post) |
18 | 18 | { |
19 | 19 | $this->id = $post->id; |
20 | - $this->type = strtolower($post->type);; |
|
20 | + $this->type = strtolower($post->type); ; |
|
21 | 21 | $this->val = $post->val; |
22 | 22 | $this->formatType(); |
23 | 23 | } |