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