Test Setup Failed
Pull Request — master (#505)
by
unknown
01:30 queued 29s
created
fetch.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@
 block discarded – undo
49 49
         }
50 50
     }
51 51
 
52
-    switch ($type)
53
-    {
52
+    switch ($type) {
54 53
         case 'jpg':
55 54
             header('Content-Type: image/jpeg');
56 55
             //by default, we don't cache
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
     header('Pragma: public');
24 24
     header('Cache-Control: max-age=' . $expires);
25 25
     header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
26
-    $bookId   = getURLParam('id', NULL);
26
+    $bookId   = getURLParam('id', null);
27 27
     $type     = getURLParam('type', 'jpg');
28
-    $idData   = getURLParam('data', NULL);
29
-    $viewOnly = getURLParam('view', FALSE);
28
+    $idData   = getURLParam('data', null);
29
+    $viewOnly = getURLParam('view', false);
30 30
 
31 31
     if (is_null($bookId)) {
32 32
         $book = Book::getBookByDataId($idData);
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
         }
20 20
     }
21 21
 
22
-    $expires = 60*60*24*14;
22
+    $expires = 60 * 60 * 24 * 14;
23 23
     header('Pragma: public');
24 24
     header('Cache-Control: max-age=' . $expires);
25
-    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
25
+    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
26 26
     $bookId   = getURLParam('id', NULL);
27 27
     $type     = getURLParam('type', 'jpg');
28 28
     $idData   = getURLParam('data', NULL);
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     }
36 36
 
37 37
     if (!$book) {
38
-        notFound ();
38
+        notFound();
39 39
         return;
40 40
     }
41 41
 
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
             header('Content-Type: image/jpeg');
58 58
             //by default, we don't cache
59 59
             $thumbnailCacheFullpath = null;
60
-            if ( isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '' ) {
60
+            if (isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '') {
61 61
                 $thumbnailCacheFullpath = $config['cops_thumbnail_cache_directory'];
62 62
                 //if multiple databases, add a subfolder with the database ID
63
-                $thumbnailCacheFullpath .= !is_null(GetUrlParam (DB)) ? 'db-' . GetUrlParam (DB) . DIRECTORY_SEPARATOR : '';
63
+                $thumbnailCacheFullpath .= !is_null(GetUrlParam(DB))?'db-' . GetUrlParam(DB) . DIRECTORY_SEPARATOR:'';
64 64
                 //when there are lots of thumbnails, it's better to save files in subfolders, so if the book's uuid is
65 65
                 //"01234567-89ab-cdef-0123-456789abcdef", we will save the thumbnail in .../0/12/34567-89ab-cdef-0123-456789abcdef-...
66 66
                 $thumbnailCacheFullpath .= substr($book->uuid, 0, 1) . DIRECTORY_SEPARATOR . substr($book->uuid, 1, 2) . DIRECTORY_SEPARATOR;
67 67
                 //check if cache folder exists or create it
68
-                if ( file_exists($thumbnailCacheFullpath) || mkdir($thumbnailCacheFullpath, 0700, true) ) {
68
+                if (file_exists($thumbnailCacheFullpath) || mkdir($thumbnailCacheFullpath, 0700, true)) {
69 69
                     //we name the thumbnail from the book's uuid and it's dimensions (width and/or height)
70 70
                     $thumbnailCacheName = substr($book->uuid, 3) . '-' . getURLParam('width') . 'x' . getURLParam('height') . '.jpg';
71 71
                     $thumbnailCacheFullpath = $thumbnailCacheFullpath . $thumbnailCacheName;
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
                 }
76 76
             }
77 77
 
78
-            if ( $thumbnailCacheFullpath !== null && file_exists($thumbnailCacheFullpath) ) {
78
+            if ($thumbnailCacheFullpath !== null && file_exists($thumbnailCacheFullpath)) {
79 79
                 //return the already cached thumbnail
80
-                readfile( $thumbnailCacheFullpath );
80
+                readfile($thumbnailCacheFullpath);
81 81
                 return;
82 82
             }
83 83
 
84
-            if ($book->getThumbnail (getURLParam('width'), getURLParam('height'), $thumbnailCacheFullpath)) {
84
+            if ($book->getThumbnail(getURLParam('width'), getURLParam('height'), $thumbnailCacheFullpath)) {
85 85
                 //if we don't cache the thumbnail, imagejpeg() in $book->getThumbnail() already return the image data
86
-                if ( $thumbnailCacheFullpath === null ) {
86
+                if ($thumbnailCacheFullpath === null) {
87 87
                     // The cover had to be resized
88 88
                     return;
89 89
                 } else {
90 90
                     //return the just cached thumbnail
91
-                    readfile( $thumbnailCacheFullpath );
91
+                    readfile($thumbnailCacheFullpath);
92 92
                     return;
93 93
                 }
94 94
             }
Please login to merge, or discard this patch.