Test Setup Failed
Pull Request — master (#522)
by Mike's
01:01
created
epubfs.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 {
14 14
     $data = $book->component($component);
15 15
 
16
-    $callback = function ($m) use ($book, $component, $add) {
16
+    $callback = function($m) use ($book, $component, $add) {
17 17
         $method = $m[1];
18 18
         $path = $m[2];
19 19
         $end = '';
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 try {
73 73
     $data = getComponentContent($book, $component, $add);
74 74
 
75
-    $expires = 60*60*24*14;
75
+    $expires = 60 * 60 * 24 * 14;
76 76
     header('Pragma: public');
77
-    header('Cache-Control: maxage='.$expires);
78
-    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
77
+    header('Cache-Control: maxage=' . $expires);
78
+    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
79 79
     header('Content-Type: ' . $book->componentContentType($component));
80 80
     echo $data;
81 81
 } catch (Exception $e) {
Please login to merge, or discard this patch.
lib/Rating.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     public const ALL_RATING_ID = "cops:rating";
12 12
 
13 13
     public const RATING_COLUMNS = "ratings.id as id, ratings.rating as rating, count(*) as count";
14
-    public const SQL_ALL_RATINGS ="select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating";
14
+    public const SQL_ALL_RATINGS = "select {0} from ratings, books_ratings_link where books_ratings_link.rating = ratings.id group by ratings.id order by ratings.rating";
15 15
     public $id;
16 16
     public $name;
17 17
 
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function getUri()
25 25
     {
26
-        return "?page=".parent::PAGE_RATING_DETAIL."&id=$this->id";
26
+        return "?page=" . parent::PAGE_RATING_DETAIL . "&id=$this->id";
27 27
     }
28 28
 
29 29
     public function getEntryId()
30 30
     {
31
-        return self::ALL_RATING_ID.":".$this->id;
31
+        return self::ALL_RATING_ID . ":" . $this->id;
32 32
     }
33 33
 
34 34
     public static function getCount()
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
         $entryArray = [];
49 49
         while ($post = $result->fetchObject()) {
50 50
             $ratingObj = new Rating($post->id, $post->rating);
51
-            $rating=$post->rating/2;
51
+            $rating = $post->rating / 2;
52 52
             $rating = str_format(localize("ratingword", $rating), $rating);
53 53
             array_push($entryArray, new Entry(
54 54
                 $rating,
55 55
                 $ratingObj->getEntryId(),
56 56
                 str_format(localize("bookword", $post->count), $post->count),
57 57
                 "text",
58
-                [ new LinkNavigation($ratingObj->getUri())],
58
+                [new LinkNavigation($ratingObj->getUri())],
59 59
                 "",
60 60
                 $post->count
61 61
             ));
Please login to merge, or discard this patch.
lib/PageRatingDetail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     {
13 13
         $rating = Rating::getRatingById($this->idGet);
14 14
         $this->idPage = $rating->getEntryId();
15
-        $this->title =str_format(localize("ratingword", $rating->name/2), $rating->name/2);
15
+        $this->title = str_format(localize("ratingword", $rating->name / 2), $rating->name / 2);
16 16
         [$this->entryArray, $this->totalNumber] = Book::getBooksByRating($this->idGet, $this->n);
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
lib/Author.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function getUri()
30 30
     {
31
-        return "?page=".parent::PAGE_AUTHOR_DETAIL."&id=$this->id";
31
+        return "?page=" . parent::PAGE_AUTHOR_DETAIL . "&id=$this->id";
32 32
     }
33 33
 
34 34
     public function getEntryId()
35 35
     {
36
-        return self::ALL_AUTHORS_ID.":".$this->id;
36
+        return self::ALL_AUTHORS_ID . ":" . $this->id;
37 37
     }
38 38
 
39 39
     public static function getEntryIdByLetter($startingLetter)
40 40
     {
41
-        return self::ALL_AUTHORS_ID.":letter:".$startingLetter;
41
+        return self::ALL_AUTHORS_ID . ":letter:" . $startingLetter;
42 42
     }
43 43
 
44 44
     public static function getCount()
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                 Author::getEntryIdByLetter($post->title),
61 61
                 str_format(localize("authorword", $post->count), $post->count),
62 62
                 "text",
63
-                [ new LinkNavigation("?page=".parent::PAGE_AUTHORS_FIRST_LETTER."&id=". rawurlencode($post->title))],
63
+                [new LinkNavigation("?page=" . parent::PAGE_AUTHORS_FIRST_LETTER . "&id=" . rawurlencode($post->title))],
64 64
                 "",
65 65
                 $post->count
66 66
             ));
Please login to merge, or discard this patch.
lib/PageQueryResult.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                     DB . ":query:{$d}",
79 79
                     " ",
80 80
                     "text",
81
-                    [ new LinkNavigation("?" . DB . "={$d}")],
81
+                    [new LinkNavigation("?" . DB . "={$d}")],
82 82
                     "tt-header"
83 83
                 ));
84 84
                 Base::getDb($d);
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
                         DB . ":query:{$d}:{$key}",
113 113
                         str_format(localize("{$key}word", $total), $total),
114 114
                         "text",
115
-                        [ new LinkNavigation("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")],
116
-                        Base::noDatabaseSelected() ? "" : "tt-header",
115
+                        [new LinkNavigation("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")],
116
+                        Base::noDatabaseSelected()?"":"tt-header",
117 117
                         $total
118 118
                     ));
119 119
                 }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                     DB . ":query:{$i}",
164 164
                     str_format(localize("bookword", $totalNumber), $totalNumber),
165 165
                     "text",
166
-                    [ new LinkNavigation("?" . DB . "={$i}&page=9&query=" . $this->query)],
166
+                    [new LinkNavigation("?" . DB . "={$i}&page=9&query=" . $this->query)],
167 167
                     "",
168 168
                     $totalNumber
169 169
                 ));
Please login to merge, or discard this patch.
lib/Data.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@
 block discarded – undo
228 228
                 return new Link("fetch.php?" . $urlParam, $mime, $rel, $title);
229 229
             }
230 230
         } else {
231
-            return new Link(str_replace('%2F', '/', rawurlencode($book->path."/".$filename)), $mime, $rel, $title);
231
+            return new Link(str_replace('%2F', '/', rawurlencode($book->path . "/" . $filename)), $mime, $rel, $title);
232 232
         }
233 233
     }
234 234
 }
Please login to merge, or discard this patch.
lib/Book.php 2 patches
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.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -196,17 +196,17 @@  discard block
 block discarded – undo
196 196
 
197 197
     public function getEntryId()
198 198
     {
199
-        return self::ALL_BOOKS_UUID.':'.$this->uuid;
199
+        return self::ALL_BOOKS_UUID . ':' . $this->uuid;
200 200
     }
201 201
 
202 202
     public static function getEntryIdByLetter($startingLetter)
203 203
     {
204
-        return self::ALL_BOOKS_ID.':letter:'.$startingLetter;
204
+        return self::ALL_BOOKS_ID . ':letter:' . $startingLetter;
205 205
     }
206 206
 
207 207
     public function getUri()
208 208
     {
209
-        return '?page='.parent::PAGE_BOOK_DETAIL.'&id=' . $this->id;
209
+        return '?page=' . parent::PAGE_BOOK_DETAIL . '&id=' . $this->id;
210 210
     }
211 211
 
212 212
     public function getDetailUrl()
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 
239 239
     public function getAuthorsName()
240 240
     {
241
-        return implode(', ', array_map(function ($author) {
241
+        return implode(', ', array_map(function($author) {
242 242
             return $author->name;
243 243
         }, $this->getAuthors()));
244 244
     }
245 245
 
246 246
     public function getAuthorsSort()
247 247
     {
248
-        return implode(', ', array_map(function ($author) {
248
+        return implode(', ', array_map(function($author) {
249 249
             return $author->sort;
250 250
         }, $this->getAuthors()));
251 251
     }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
     public function getTagsName()
312 312
     {
313
-        return implode(', ', array_map(function ($tag) {
313
+        return implode(', ', array_map(function($tag) {
314 314
             return $tag->name;
315 315
         }, $this->getTags()));
316 316
     }
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     public function getDataById($idData)
389 389
     {
390
-        $reduced = array_filter($this->getDatas(), function ($data) use ($idData) {
390
+        $reduced = array_filter($this->getDatas(), function($data) use ($idData) {
391 391
             return $data->id == $idData;
392 392
         });
393 393
         return reset($reduced);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         if (empty($this->pubdate)) {
414 414
             return '';
415 415
         }
416
-        $dateY = (int) substr($this->pubdate, 0, 4);
416
+        $dateY = (int)substr($this->pubdate, 0, 4);
417 417
         if ($dateY > 102) {
418 418
             return str_pad(strval($dateY), 4, '0', STR_PAD_LEFT);
419 419
         }
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
     public function getDataFormat($format)
438 438
     {
439
-        $reduced = array_filter($this->getDatas(), function ($data) use ($format) {
439
+        $reduced = array_filter($this->getDatas(), function($data) use ($format) {
440 440
             return $data->format == $format;
441 441
         });
442 442
         return reset($reduced);
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
                 $epub->SerieIndex($this->seriesIndex);
512 512
             }
513 513
             $filename = $data->getUpdatedFilenameEpub();
514
-            if ($config['cops_provide_kepub'] == '1'  && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) {
514
+            if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) {
515 515
                 $epub->updateForKepub();
516 516
                 $filename = $data->getUpdatedFilenameKepub();
517 517
             }
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
                 if ($nw >= $w) {
541 541
                     return false;
542 542
                 }
543
-                $nh = intval(($nw*$h)/$w);
543
+                $nh = intval(($nw * $h) / $w);
544 544
             } else {
545 545
                 $nh = $height;
546 546
                 if ($nh >= $h) {
547 547
                     return false;
548 548
                 }
549
-                $nw = intval(($nh*$w)/$h);
549
+                $nw = intval(($nh * $w) / $h);
550 550
             }
551 551
         } else {
552 552
             return false;
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
             self::ALL_BOOKS_ID,
643 643
             str_format(localize('allbooks.alphabetical', $nBooks), $nBooks),
644 644
             'text',
645
-            [new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)],
645
+            [new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS)],
646 646
             '',
647 647
             $nBooks
648 648
         );
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
                 self::ALL_RECENT_BOOKS_ID,
654 654
                 str_format(localize('recent.list'), $config['cops_recentbooks_limit']),
655 655
                 'text',
656
-                [ new LinkNavigation('?page='.parent::PAGE_ALL_RECENT_BOOKS)],
656
+                [new LinkNavigation('?page=' . parent::PAGE_ALL_RECENT_BOOKS)],
657 657
                 '',
658 658
                 $config['cops_recentbooks_limit']
659 659
             );
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
                 Book::getEntryIdByLetter($post->title),
781 781
                 str_format(localize('bookword', $post->count), $post->count),
782 782
                 'text',
783
-                [new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))],
783
+                [new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS_LETTER . '&id=' . rawurlencode($post->title))],
784 784
                 '',
785 785
                 $post->count
786 786
             ));
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
-    public const ALL_CUSTOMS_ID       = "cops:custom";
14
+    public const ALL_CUSTOMS_ID = "cops:custom";
15 15
 
16
-    public const CUSTOM_TYPE_TEXT      = "text";        // type 1 + 2
17
-    public const CUSTOM_TYPE_COMMENT   = "comments";    // type 3
18
-    public const CUSTOM_TYPE_SERIES    = "series";      // type 4
16
+    public const CUSTOM_TYPE_TEXT      = "text"; // type 1 + 2
17
+    public const CUSTOM_TYPE_COMMENT   = "comments"; // type 3
18
+    public const CUSTOM_TYPE_SERIES    = "series"; // type 4
19 19
     public const CUSTOM_TYPE_ENUM      = "enumeration"; // type 5
20
-    public const CUSTOM_TYPE_DATE      = "datetime";    // type 6
21
-    public const CUSTOM_TYPE_FLOAT     = "float";       // type 7
22
-    public const CUSTOM_TYPE_INT       = "int";         // type 8
23
-    public const CUSTOM_TYPE_RATING    = "rating";      // type 9
24
-    public const CUSTOM_TYPE_BOOL      = "bool";        // type 10
25
-    public const CUSTOM_TYPE_COMPOSITE = "composite";   // type 11 + 12
20
+    public const CUSTOM_TYPE_DATE      = "datetime"; // type 6
21
+    public const CUSTOM_TYPE_FLOAT     = "float"; // type 7
22
+    public const CUSTOM_TYPE_INT       = "int"; // type 8
23
+    public const CUSTOM_TYPE_RATING    = "rating"; // type 9
24
+    public const CUSTOM_TYPE_BOOL      = "bool"; // type 10
25
+    public const CUSTOM_TYPE_COMPOSITE = "composite"; // type 11 + 12
26 26
 
27 27
     /** @var array[integer]CustomColumnType  */
28 28
     private static $customColumnCacheID = [];
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $result->execute([$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/Tag.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function getUri()
25 25
     {
26
-        return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id";
26
+        return "?page=" . parent::PAGE_TAG_DETAIL . "&id=$this->id";
27 27
     }
28 28
 
29 29
     public function getEntryId()
30 30
     {
31
-        return self::ALL_TAGS_ID.":".$this->id;
31
+        return self::ALL_TAGS_ID . ":" . $this->id;
32 32
     }
33 33
 
34 34
     public static function getCount()
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     public static function getAllTagsByQuery($query, $n, $database = null, $numberPerPage = null)
56 56
     {
57
-        $columns  = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count";
57
+        $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count";
58 58
         $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name';
59 59
         [$totalNumber, $result] = parent::executeQuery($sql, $columns, "", ['%' . $query . '%'], $n, $database, $numberPerPage);
60 60
         $entryArray = [];
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                 $tag->getEntryId(),
66 66
                 str_format(localize("bookword", $post->count), $post->count),
67 67
                 "text",
68
-                [ new LinkNavigation($tag->getUri())]
68
+                [new LinkNavigation($tag->getUri())]
69 69
             ));
70 70
         }
71 71
         return [$entryArray, $totalNumber];
Please login to merge, or discard this patch.