Passed
Push — master ( a6750f...304c57 )
by Sébastien
03:33
created
fetch.php 1 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: maxage=' . $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);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     }
34 34
 
35 35
     if (!$book) {
36
-        notFound ();
36
+        notFound();
37 37
         return;
38 38
     }
39 39
 
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
             header('Content-Type: image/jpeg');
56 56
             //by default, we don't cache
57 57
             $thumbnailCacheFullpath = null;
58
-            if ( isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '' ) {
58
+            if (isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '') {
59 59
                 $thumbnailCacheFullpath = $config['cops_thumbnail_cache_directory'];
60 60
                 //if multiple databases, add a subfolder with the database ID
61
-                $thumbnailCacheFullpath .= !is_null(GetUrlParam (DB)) ? 'db-' . GetUrlParam (DB) . DIRECTORY_SEPARATOR : '';
61
+                $thumbnailCacheFullpath .= !is_null(GetUrlParam(DB))?'db-' . GetUrlParam(DB) . DIRECTORY_SEPARATOR:'';
62 62
                 //when there are lots of thumbnails, it's better to save files in subfolders, so if the book's uuid is
63 63
                 //"01234567-89ab-cdef-0123-456789abcdef", we will save the thumbnail in .../0/12/34567-89ab-cdef-0123-456789abcdef-...
64 64
                 $thumbnailCacheFullpath .= substr($book->uuid, 0, 1) . DIRECTORY_SEPARATOR . substr($book->uuid, 1, 2) . DIRECTORY_SEPARATOR;
65 65
                 //check if cache folder exists or create it
66
-                if ( file_exists($thumbnailCacheFullpath) || mkdir($thumbnailCacheFullpath, 0700, true) ) {
66
+                if (file_exists($thumbnailCacheFullpath) || mkdir($thumbnailCacheFullpath, 0700, true)) {
67 67
                     //we name the thumbnail from the book's uuid and it's dimensions (width and/or height)
68 68
                     $thumbnailCacheName = substr($book->uuid, 3) . '-' . getURLParam('width') . 'x' . getURLParam('height') . '.jpg';
69 69
                     $thumbnailCacheFullpath = $thumbnailCacheFullpath . $thumbnailCacheName;
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
                 }
74 74
             }
75 75
 
76
-            if ( $thumbnailCacheFullpath !== null && file_exists($thumbnailCacheFullpath) ) {
76
+            if ($thumbnailCacheFullpath !== null && file_exists($thumbnailCacheFullpath)) {
77 77
                 //return the already cached thumbnail
78
-                readfile( $thumbnailCacheFullpath );
78
+                readfile($thumbnailCacheFullpath);
79 79
                 return;
80 80
             }
81 81
 
82
-            if ($book->getThumbnail (getURLParam('width'), getURLParam('height'), $thumbnailCacheFullpath)) {
82
+            if ($book->getThumbnail(getURLParam('width'), getURLParam('height'), $thumbnailCacheFullpath)) {
83 83
                 //if we don't cache the thumbnail, imagejpeg() in $book->getThumbnail() already return the image data
84
-                if ( $thumbnailCacheFullpath === null ) {
84
+                if ($thumbnailCacheFullpath === null) {
85 85
                     // The cover had to be resized
86 86
                     return;
87 87
                 } else {
88 88
                     //return the just cached thumbnail
89
-                    readfile( $thumbnailCacheFullpath );
89
+                    readfile($thumbnailCacheFullpath);
90 90
                     return;
91 91
                 }
92 92
             }
Please login to merge, or discard this patch.
config_default.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      *
190 190
      * Note that the composite custom columns are not supported
191 191
      */
192
-    $config['cops_calibre_custom_column_list'] = array ();
192
+    $config['cops_calibre_custom_column_list'] = array();
193 193
 
194 194
     /*
195 195
      * Custom Columns for the book preview panel
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      *
200 200
      * Note that the composite custom columns are not supported
201 201
      */
202
-    $config['cops_calibre_custom_column_preview'] = array ();
202
+    $config['cops_calibre_custom_column_preview'] = array();
203 203
 
204 204
     /*
205 205
      * Rename .epub to .kepub.epub if downloaded from a Kobo eReader
Please login to merge, or discard this patch.
epubreader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 
16 16
 $idData = getURLParam('data', NULL);
17 17
 $add = 'data=' . $idData . '&';
18
-if (!is_null (GetUrlParam (DB))) {
19
-    $add .= DB . '=' . GetUrlParam (DB) . '&';
18
+if (!is_null(GetUrlParam(DB))) {
19
+    $add .= DB . '=' . GetUrlParam(DB) . '&';
20 20
 }
21 21
 $myBook = Book::getBookByDataId($idData);
22 22
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
         Monocle.DEBUG = true;
38 38
         var bookData = {
39 39
           getComponents: function() {
40
-            <?php echo 'return [' . implode(', ', array_map(function($comp) { return "'" . $comp . "'"; }, $book->components ())) . '];'; ?>
40
+            <?php echo 'return [' . implode(', ', array_map(function($comp) { return "'" . $comp . "'"; }, $book->components())) . '];'; ?>
41 41
           },
42 42
           getContents: function() {
43
-            <?php echo 'return [' . implode(', ', array_map(function($content) { return "{title: '" . addslashes($content['title']) . "', src: '". $content['src'] . "'}"; }, $book->contents())) . '];'; ?>
43
+            <?php echo 'return [' . implode(', ', array_map(function($content) { return "{title: '" . addslashes($content['title']) . "', src: '" . $content['src'] . "'}"; }, $book->contents())) . '];'; ?>
44 44
           },
45 45
           getComponent: function (componentId) {
46 46
             return { url: "epubfs.php?<?php echo $add ?>comp="  + componentId };
Please login to merge, or discard this patch.
transliteration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     // Counting down is faster. I'm *so* sorry.
91 91
     $len = $chunk + 1;
92 92
 
93
-    for ($i = -1; --$len; ) {
93
+    for ($i = -1; --$len;) {
94 94
       $c = $str[++$i];
95 95
       if ($remaining = $tail_bytes[$c]) {
96 96
         // UTF-8 head byte!
@@ -208,5 +208,5 @@  discard block
 block discarded – undo
208 208
 
209 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
 }
Please login to merge, or discard this patch.
lib/PageAllAuthorsLetter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
 
9 9
 class PageAllAuthorsLetter extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $this->idPage = Author::getEntryIdByLetter ($this->idGet);
14
-        $this->entryArray = Author::getAuthorsByStartingLetter ($this->idGet);
15
-        $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("authorword", count ($this->entryArray)), count ($this->entryArray)), $this->idGet);
13
+        $this->idPage = Author::getEntryIdByLetter($this->idGet);
14
+        $this->entryArray = Author::getAuthorsByStartingLetter($this->idGet);
15
+        $this->title = str_format(localize("splitByLetter.letter"), str_format(localize("authorword", count($this->entryArray)), count($this->entryArray)), $this->idGet);
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
lib/CustomColumnType.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@  discard block
 block discarded – undo
11 11
  */
12 12
 abstract class CustomColumnType extends Base
13 13
 {
14
-    const ALL_CUSTOMS_ID       = "cops:custom";
14
+    const ALL_CUSTOMS_ID = "cops:custom";
15 15
 
16
-    const CUSTOM_TYPE_TEXT      = "text";        // type 1 + 2
17
-    const CUSTOM_TYPE_COMMENT   = "comments";    // type 3
18
-    const CUSTOM_TYPE_SERIES    = "series";      // type 4
16
+    const CUSTOM_TYPE_TEXT      = "text"; // type 1 + 2
17
+    const CUSTOM_TYPE_COMMENT   = "comments"; // type 3
18
+    const CUSTOM_TYPE_SERIES    = "series"; // type 4
19 19
     const CUSTOM_TYPE_ENUM      = "enumeration"; // type 5
20
-    const CUSTOM_TYPE_DATE      = "datetime";    // type 6
21
-    const CUSTOM_TYPE_FLOAT     = "float";       // type 7
22
-    const CUSTOM_TYPE_INT       = "int";         // type 8
23
-    const CUSTOM_TYPE_RATING    = "rating";      // type 9
24
-    const CUSTOM_TYPE_BOOL      = "bool";        // type 10
25
-    const CUSTOM_TYPE_COMPOSITE = "composite";   // type 11 + 12
20
+    const CUSTOM_TYPE_DATE      = "datetime"; // type 6
21
+    const CUSTOM_TYPE_FLOAT     = "float"; // type 7
22
+    const CUSTOM_TYPE_INT       = "int"; // type 8
23
+    const CUSTOM_TYPE_RATING    = "rating"; // type 9
24
+    const CUSTOM_TYPE_BOOL      = "bool"; // type 10
25
+    const CUSTOM_TYPE_COMPOSITE = "composite"; // type 11 + 12
26 26
 
27 27
     /** @var array[integer]CustomColumnType  */
28 28
     private static $customColumnCacheID = array();
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $result->execute(array($this->customId));
111 111
         if ($post = $result->fetchObject()) {
112 112
             $json = json_decode($post->display);
113
-            return (isset($json->description) && !empty($json->description)) ? $json->description : NULL;
113
+            return (isset($json->description) && !empty($json->description))?$json->description:NULL;
114 114
         }
115 115
         return NULL;
116 116
     }
Please login to merge, or discard this patch.
lib/Serie.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,44 +21,44 @@
 block discarded – undo
21 21
         $this->name = $post->name;
22 22
     }
23 23
 
24
-    public function getUri () {
25
-        return "?page=".parent::PAGE_SERIE_DETAIL."&id=$this->id";
24
+    public function getUri() {
25
+        return "?page=" . parent::PAGE_SERIE_DETAIL . "&id=$this->id";
26 26
     }
27 27
 
28
-    public function getEntryId () {
29
-        return self::ALL_SERIES_ID.":".$this->id;
28
+    public function getEntryId() {
29
+        return self::ALL_SERIES_ID . ":" . $this->id;
30 30
     }
31 31
 
32 32
     public static function getCount() {
33 33
         // str_format (localize("series.alphabetical", count(array))
34
-        return parent::getCountGeneric ("series", self::ALL_SERIES_ID, parent::PAGE_ALL_SERIES);
34
+        return parent::getCountGeneric("series", self::ALL_SERIES_ID, parent::PAGE_ALL_SERIES);
35 35
     }
36 36
 
37
-    public static function getSerieByBookId ($bookId) {
38
-        $result = parent::getDb ()->prepare('select  series.id as id, name
37
+    public static function getSerieByBookId($bookId) {
38
+        $result = parent::getDb()->prepare('select  series.id as id, name
39 39
 from books_series_link, series
40 40
 where series.id = series and book = ?');
41
-        $result->execute (array ($bookId));
42
-        if ($post = $result->fetchObject ()) {
43
-            return new Serie ($post);
41
+        $result->execute(array($bookId));
42
+        if ($post = $result->fetchObject()) {
43
+            return new Serie($post);
44 44
         }
45 45
         return NULL;
46 46
     }
47 47
 
48
-    public static function getSerieById ($serieId) {
49
-        $result = parent::getDb ()->prepare('select id, name  from series where id = ?');
50
-        $result->execute (array ($serieId));
51
-        if ($post = $result->fetchObject ()) {
52
-            return new Serie ($post);
48
+    public static function getSerieById($serieId) {
49
+        $result = parent::getDb()->prepare('select id, name  from series where id = ?');
50
+        $result->execute(array($serieId));
51
+        if ($post = $result->fetchObject()) {
52
+            return new Serie($post);
53 53
         }
54 54
         return NULL;
55 55
     }
56 56
 
57 57
     public static function getAllSeries() {
58
-        return Base::getEntryArrayWithBookNumber (self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array (), "Serie");
58
+        return Base::getEntryArrayWithBookNumber(self::SQL_ALL_SERIES, self::SERIES_COLUMNS, array(), "Serie");
59 59
     }
60 60
 
61 61
     public static function getAllSeriesByQuery($query) {
62
-        return Base::getEntryArrayWithBookNumber (self::SQL_SERIES_FOR_SEARCH, self::SERIES_COLUMNS, array ('%' . $query . '%'), "Serie");
62
+        return Base::getEntryArrayWithBookNumber(self::SQL_SERIES_FOR_SEARCH, self::SERIES_COLUMNS, array('%' . $query . '%'), "Serie");
63 63
     }
64 64
 }
Please login to merge, or discard this patch.
lib/PageAllSeries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 class PageAllSeries extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13 13
         $this->title = localize("series.title");
14 14
         $this->entryArray = Serie::getAllSeries();
Please login to merge, or discard this patch.
lib/PageRecentBooks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
 
9 9
 class PageRecentBooks extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $this->title = localize ("recent.title");
14
-        $this->entryArray = Book::getAllRecentBooks ();
13
+        $this->title = localize("recent.title");
14
+        $this->entryArray = Book::getAllRecentBooks();
15 15
         $this->idPage = Book::ALL_RECENT_BOOKS_ID;
16 16
     }
17 17
 }
Please login to merge, or discard this patch.