Test Setup Failed
Pull Request — master (#424)
by
unknown
03:11
created
lib/Base.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,13 +99,13 @@
 block discarded – undo
99 99
 
100 100
     // -DC- Add image directory
101 101
     public static function getImgDirectory ($database = NULL) {
102
-    	global $config;
103
-    	if (self::isMultipleDatabaseEnabled ()) {
104
-    		if (is_null ($database)) $database = GetUrlParam (DB, 0);
105
-    		$array = array_values ($config['image_directory']);
106
-    		return  $array[$database];
107
-    	}
108
-    	return $config['image_directory'];
102
+        global $config;
103
+        if (self::isMultipleDatabaseEnabled ()) {
104
+            if (is_null ($database)) $database = GetUrlParam (DB, 0);
105
+            $array = array_values ($config['image_directory']);
106
+            return  $array[$database];
107
+        }
108
+        return $config['image_directory'];
109 109
     }
110 110
 
111 111
     public static function getDbFileName ($database = NULL) {
Please login to merge, or discard this patch.
fetch.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     // -DC- Add png type
43 43
     if ($book && ($type == 'jpg' || $type == 'png' || empty ($config['calibre_internal_directory']))) {
44
-    	  if ($type == 'jpg' || $type == 'png') {
44
+            if ($type == 'jpg' || $type == 'png') {
45 45
             $file = $book->getFilePath($type);
46 46
         } else {
47 47
             $file = $book->getFilePath($type, $idData);
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
 
55 55
     switch ($type)
56 56
     {
57
-    		// -DC- Add png type
57
+            // -DC- Add png type
58 58
         case 'jpg':
59 59
         case 'png':
60
-        		if ($type == 'jpg') {
61
-          	  header('Content-Type: image/jpeg');
62
-        		}
63
-        		else {
64
-        			header('Content-Type: image/png');
65
-        		}
60
+                if ($type == 'jpg') {
61
+                header('Content-Type: image/jpeg');
62
+                }
63
+                else {
64
+                    header('Content-Type: image/png');
65
+                }
66 66
             //by default, we don't cache
67 67
             $thumbnailCacheFullpath = null;
68 68
             if ( isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '' ) {
Please login to merge, or discard this patch.
lib/Tag.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@
 block discarded – undo
43 43
     }
44 44
 
45 45
     public static function getAllTags() {
46
-    	global $config;
46
+        global $config;
47 47
 
48
-    	$sql = self::SQL_ALL_TAGS;
49
-    	$sortField = $config['calibre_database_field_sort'];
50
-    	if (!empty($sortField)) {
51
-    		$sql = str_replace('tags.name', 'tags.' . $sortField, $sql);
52
-    	}
48
+        $sql = self::SQL_ALL_TAGS;
49
+        $sortField = $config['calibre_database_field_sort'];
50
+        if (!empty($sortField)) {
51
+            $sql = str_replace('tags.name', 'tags.' . $sortField, $sql);
52
+        }
53 53
 
54 54
         return Base::getEntryArrayWithBookNumber ($sql, self::TAG_COLUMNS, array (), "Tag");
55 55
     }
Please login to merge, or discard this patch.
lib/Book.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     private $coverFileName = NULL;
110 110
 
111 111
     public function __construct($line) {
112
-    	global $config;
112
+        global $config;
113 113
 
114 114
         $this->id = $line->id;
115 115
         $this->title = $line->title;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         // -DC- Init relative or full path
121 121
         $this->path = $line->path;
122 122
         if (!is_dir($this->path)) {
123
-        	$this->path = Base::getDbDirectory() . $line->path;
123
+            $this->path = Base::getDbDirectory() . $line->path;
124 124
         }
125 125
         $this->seriesIndex = $line->series_index;
126 126
         $this->comment = $line->comment;
@@ -132,48 +132,48 @@  discard block
 block discarded – undo
132 132
         //    $this->hasCover = 0;
133 133
         //}
134 134
         if ($this->hasCover) {
135
-        	if (!empty($config['calibre_database_field_cover'])) {
136
-        		$imgDirectory = Base::getImgDirectory();
137
-        		$this->coverFileName = $line->cover;
138
-        		if (!file_exists($this->coverFileName)) {
139
-        			$this->coverFileName = NULL;
140
-        		}
141
-        		if (empty($this->coverFileName)) {
142
-        			$this->coverFileName = sprintf('%s%s', $imgDirectory, $line->cover);
143
-        			if (!file_exists($this->coverFileName)) {
144
-        				$this->coverFileName = NULL;
145
-        			}
146
-        		}
147
-        		if (empty($this->coverFileName)) {
148
-        			// Try with the epub file name
149
-        			$data = $this->getDataFormat('EPUB');
150
-        			if ($data) {
151
-        				$this->coverFileName = sprintf('%s%s/%s', $imgDirectory, $data->name, $line->cover);
152
-        				if (!file_exists($this->coverFileName)) {
153
-        					$this->coverFileName = NULL;
154
-        				}
155
-        				if (empty($this->coverFileName)) {
156
-        					$this->coverFileName = sprintf('%s%s.jpg', $imgDirectory, $data->name);
157
-        					if (!file_exists($this->coverFileName)) {
158
-        						$this->coverFileName = NULL;
159
-        					}
160
-        				}
161
-        			}
162
-        		}
163
-        	}
164
-        	// Else try with default cover file name
165
-        	if (empty($this->coverFileName)) {
166
-        		$cover = $this->getFilePath("jpg");
167
-        		if ($cover === false || !file_exists($cover)) {
168
-        			$cover = $this->getFilePath("png");
169
-        		}
170
-        		if ($cover === false || !file_exists($cover)) {
171
-        			$this->hasCover = 0;
172
-        		}
173
-        		else {
174
-        			$this->coverFileName = $cover;
175
-        		}
176
-        	}
135
+            if (!empty($config['calibre_database_field_cover'])) {
136
+                $imgDirectory = Base::getImgDirectory();
137
+                $this->coverFileName = $line->cover;
138
+                if (!file_exists($this->coverFileName)) {
139
+                    $this->coverFileName = NULL;
140
+                }
141
+                if (empty($this->coverFileName)) {
142
+                    $this->coverFileName = sprintf('%s%s', $imgDirectory, $line->cover);
143
+                    if (!file_exists($this->coverFileName)) {
144
+                        $this->coverFileName = NULL;
145
+                    }
146
+                }
147
+                if (empty($this->coverFileName)) {
148
+                    // Try with the epub file name
149
+                    $data = $this->getDataFormat('EPUB');
150
+                    if ($data) {
151
+                        $this->coverFileName = sprintf('%s%s/%s', $imgDirectory, $data->name, $line->cover);
152
+                        if (!file_exists($this->coverFileName)) {
153
+                            $this->coverFileName = NULL;
154
+                        }
155
+                        if (empty($this->coverFileName)) {
156
+                            $this->coverFileName = sprintf('%s%s.jpg', $imgDirectory, $data->name);
157
+                            if (!file_exists($this->coverFileName)) {
158
+                                $this->coverFileName = NULL;
159
+                            }
160
+                        }
161
+                    }
162
+                }
163
+            }
164
+            // Else try with default cover file name
165
+            if (empty($this->coverFileName)) {
166
+                $cover = $this->getFilePath("jpg");
167
+                if ($cover === false || !file_exists($cover)) {
168
+                    $cover = $this->getFilePath("png");
169
+                }
170
+                if ($cover === false || !file_exists($cover)) {
171
+                    $this->hasCover = 0;
172
+                }
173
+                else {
174
+                    $this->coverFileName = $cover;
175
+                }
176
+            }
177 177
         }
178 178
         $this->rating = $line->rating;
179 179
     }
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
     // -DC- Get customisable book columns
182 182
     private static function getBookColumns()
183 183
     {
184
-    	global $config;
184
+        global $config;
185 185
 
186
-    	$res = self::BOOK_COLUMNS;
187
-    	if (!empty($config['calibre_database_field_cover'])) {
188
-    		$res = str_replace('has_cover,', 'has_cover, ' . $config['calibre_database_field_cover'] . ',', $res);
189
-    	}
186
+        $res = self::BOOK_COLUMNS;
187
+        if (!empty($config['calibre_database_field_cover'])) {
188
+            $res = str_replace('has_cover,', 'has_cover, ' . $config['calibre_database_field_cover'] . ',', $res);
189
+        }
190 190
 
191
-    	return $res;
191
+        return $res;
192 192
     }
193 193
 
194 194
     public function getEntryId() {
@@ -417,26 +417,26 @@  discard block
 block discarded – undo
417 417
         {
418 418
             return $this->path.'/'.$file;
419 419
         }*/
420
-    	if ($extension == "jpg" || $extension == "png") {
421
-    		if (empty($this->coverFileName)) {
422
-    			return $this->path . '/cover.' . $extension;
423
-    		}
424
-    		else {
425
-    			$ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION));
426
-    			if ($ext == $extension) {
427
-    				return $this->coverFileName;
428
-    			}
429
-    		}
430
-    		return false;
431
-    	}
432
-    	else {
433
-    		$data = $this->getDataById($idData);
434
-    		if (!$data) {
435
-    			return NULL;
436
-    		}
437
-    		$file = $data->name . "." . strtolower($data->format);
438
-    		return $this->path . '/' . $file;
439
-    	}
420
+        if ($extension == "jpg" || $extension == "png") {
421
+            if (empty($this->coverFileName)) {
422
+                return $this->path . '/cover.' . $extension;
423
+            }
424
+            else {
425
+                $ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION));
426
+                if ($ext == $extension) {
427
+                    return $this->coverFileName;
428
+                }
429
+            }
430
+            return false;
431
+        }
432
+        else {
433
+            $data = $this->getDataById($idData);
434
+            if (!$data) {
435
+                return NULL;
436
+            }
437
+            $file = $data->name . "." . strtolower($data->format);
438
+            return $this->path . '/' . $file;
439
+        }
440 440
     }
441 441
 
442 442
     public function getUpdatedEpub($idData)
@@ -507,24 +507,24 @@  discard block
 block discarded – undo
507 507
 
508 508
         // Draw the image
509 509
         if ($inType == 'png') {
510
-        	$src_img = imagecreatefrompng($file);
510
+            $src_img = imagecreatefrompng($file);
511 511
         }
512 512
         else {
513
-        	$src_img = imagecreatefromjpeg($file);
513
+            $src_img = imagecreatefromjpeg($file);
514 514
         }
515 515
         $dst_img = imagecreatetruecolor($nw,$nh);
516 516
         if (!imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h)) {
517
-        	return false;
517
+            return false;
518 518
         }
519 519
         if ($inType == 'png') {
520
-        	if (!imagepng($dst_img, $outputfile, 9)) {
521
-        		return false;
522
-        	}
520
+            if (!imagepng($dst_img, $outputfile, 9)) {
521
+                return false;
522
+            }
523 523
         }
524 524
         else {
525
-        	if (!imagejpeg($dst_img, $outputfile, 80)) {
526
-        		return false;
527
-        	}
525
+            if (!imagejpeg($dst_img, $outputfile, 80)) {
526
+                return false;
527
+            }
528 528
         }
529 529
         imagedestroy($src_img);
530 530
         imagedestroy($dst_img);
@@ -537,18 +537,18 @@  discard block
 block discarded – undo
537 537
         $linkArray = array();
538 538
 
539 539
         if ($this->hasCover) {
540
-        	// -DC- Use cover file name
541
-        	//array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL));
542
-        	//array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL));
543
-        	$ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION));
544
-        	if ($ext == 'png') {
545
-        		array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_IMAGE_TYPE, "cover.png", NULL));
546
-        		array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_THUMBNAIL_TYPE, "cover.png", NULL));
547
-        	}
548
-        	else {
549
-        		array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL));
550
-        		array_push($linkArray, Data::getLink($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL));
551
-        	}
540
+            // -DC- Use cover file name
541
+            //array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL));
542
+            //array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_THUMBNAIL_TYPE, 'cover.jpg', NULL));
543
+            $ext = strtolower(pathinfo($this->coverFileName, PATHINFO_EXTENSION));
544
+            if ($ext == 'png') {
545
+                array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_IMAGE_TYPE, "cover.png", NULL));
546
+                array_push($linkArray, Data::getLink($this, "png", "image/png", Link::OPDS_THUMBNAIL_TYPE, "cover.png", NULL));
547
+            }
548
+            else {
549
+                array_push($linkArray, Data::getLink($this, 'jpg', 'image/jpeg', Link::OPDS_IMAGE_TYPE, 'cover.jpg', NULL));
550
+                array_push($linkArray, Data::getLink($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL));
551
+            }
552 552
         }
553 553
 
554 554
         foreach ($this->getDatas() as $data)
@@ -588,15 +588,15 @@  discard block
 block discarded – undo
588 588
         $nBooks = parent::executeQuerySingle('select count(*) from books');
589 589
         $result = array();
590 590
         $entry = new Entry(localize('allbooks.title'),
591
-                          self::ALL_BOOKS_ID,
592
-                          str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text',
593
-                          array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks);
591
+                            self::ALL_BOOKS_ID,
592
+                            str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text',
593
+                            array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks);
594 594
         array_push($result, $entry);
595 595
         if ($config['cops_recentbooks_limit'] > 0) {
596 596
             $entry = new Entry(localize('recent.title'),
597
-                              self::ALL_RECENT_BOOKS_ID,
598
-                              str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text',
599
-                              array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']);
597
+                                self::ALL_RECENT_BOOKS_ID,
598
+                                str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text',
599
+                                array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']);
600 600
             array_push($result, $entry);
601 601
         }
602 602
         return $result;
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     }
640 640
 
641 641
     public static function getBookById($bookId) {
642
-    	$result = parent::getDb()->prepare('select ' . self::getBookColumns() . '
642
+        $result = parent::getDb()->prepare('select ' . self::getBookColumns() . '
643 643
 from books ' . self::SQL_BOOKS_LEFT_JOIN . '
644 644
 where books.id = ?');
645 645
         $result->execute(array($bookId));
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
     }
653 653
 
654 654
     public static function getBookByDataId($dataId) {
655
-    	$result = parent::getDb()->prepare('select ' . self::getBookColumns() . ', data.name, data.format
655
+        $result = parent::getDb()->prepare('select ' . self::getBookColumns() . ', data.name, data.format
656 656
 from data, books ' . self::SQL_BOOKS_LEFT_JOIN . '
657 657
 where data.book = books.id and data.id = ?');
658 658
         $result->execute(array($dataId));
@@ -671,10 +671,10 @@  discard block
 block discarded – undo
671 671
         $i = 0;
672 672
         $critArray = array();
673 673
         foreach (array(PageQueryResult::SCOPE_AUTHOR,
674
-                       PageQueryResult::SCOPE_TAG,
675
-                       PageQueryResult::SCOPE_SERIES,
676
-                       PageQueryResult::SCOPE_PUBLISHER,
677
-                       PageQueryResult::SCOPE_BOOK) as $key) {
674
+                        PageQueryResult::SCOPE_TAG,
675
+                        PageQueryResult::SCOPE_SERIES,
676
+                        PageQueryResult::SCOPE_PUBLISHER,
677
+                        PageQueryResult::SCOPE_BOOK) as $key) {
678 678
             if (in_array($key, getCurrentOption('ignored_categories')) ||
679 679
                 (!array_key_exists($key, $query) && !array_key_exists('all', $query))) {
680 680
                 $critArray[$i] = self::BAD_SEARCH;
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
     public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL) {
722 722
         /* @var $totalNumber integer */
723 723
         /* @var $result PDOStatement */
724
-    	list($totalNumber, $result) = parent::executeQuery($query, self::getBookColumns(), self::getFilterString(), $params, $n, $database, $numberPerPage);
724
+        list($totalNumber, $result) = parent::executeQuery($query, self::getBookColumns(), self::getFilterString(), $params, $n, $database, $numberPerPage);
725 725
 
726 726
         $entryArray = array();
727 727
         while ($post = $result->fetchObject())
Please login to merge, or discard this patch.