Completed
Push — master ( 865827...08e2eb )
by Markus
04:14
created
lib/CustomColumn.php 1 patch
Braces   +27 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,48 +14,58 @@  discard block
 block discarded – undo
14 14
     public $name;
15 15
     public $customId;
16 16
 
17
-    public function __construct($pid, $pname, $pcustomId) {
17
+    public function __construct($pid, $pname, $pcustomId)
18
+    {
18 19
         $this->id = $pid;
19 20
         $this->name = $pname;
20 21
         $this->customId = $pcustomId;
21 22
     }
22 23
 
23
-    public function getUri () {
24
+    public function getUri ()
25
+    {
24 26
         return "?page=".parent::PAGE_CUSTOM_DETAIL."&custom={$this->customId}&id={$this->id}";
25 27
     }
26 28
 
27
-    public function getEntryId () {
29
+    public function getEntryId ()
30
+    {
28 31
         return self::ALL_CUSTOMS_ID.":".$this->customId.":".$this->id;
29 32
     }
30 33
 
31
-    public static function getTableName ($customId) {
34
+    public static function getTableName ($customId)
35
+    {
32 36
         return "custom_column_{$customId}";
33 37
     }
34 38
 
35
-    public static function getTableLinkName ($customId) {
39
+    public static function getTableLinkName ($customId)
40
+    {
36 41
         return "books_custom_column_{$customId}_link";
37 42
     }
38 43
 
39
-    public static function getTableLinkColumn ($customId) {
44
+    public static function getTableLinkColumn ($customId)
45
+    {
40 46
         return "value";
41 47
     }
42 48
 
43
-    public static function getAllCustomsId ($customId) {
49
+    public static function getAllCustomsId ($customId)
50
+    {
44 51
         return self::ALL_CUSTOMS_ID . ":" . $customId;
45 52
     }
46 53
 
47
-    public static function getUriAllCustoms ($customId) {
54
+    public static function getUriAllCustoms ($customId)
55
+    {
48 56
         return "?page=" . parent::PAGE_ALL_CUSTOMS . "&custom={$customId}";
49 57
     }
50 58
 
51
-    public static function getAllTitle ($customId) {
59
+    public static function getAllTitle ($customId)
60
+    {
52 61
         $result = parent::getDb ()->prepare('select name from custom_columns where id = ?');
53 62
         $result->execute (array ($customId));
54 63
         $post = $result->fetchObject ();
55 64
         return $post->name;
56 65
     }
57 66
 
58
-    public static function getCustomId ($lookup) {
67
+    public static function getCustomId ($lookup)
68
+    {
59 69
         $result = parent::getDb ()->prepare('select id from custom_columns where label = ?');
60 70
         $result->execute (array ($lookup));
61 71
         if ($post = $result->fetchObject ()) {
@@ -64,7 +74,8 @@  discard block
 block discarded – undo
64 74
         return NULL;
65 75
     }
66 76
 
67
-    public static function getCount($customId) {
77
+    public static function getCount($customId)
78
+    {
68 79
         $nCustoms = parent::executeQuerySingle ('select count(*) from ' . self::getTableName ($customId));
69 80
         $entry = new Entry (self::getAllTitle ($customId), self::getAllCustomsId ($customId),
70 81
             str_format (localize("tags.alphabetical", $nCustoms), $nCustoms), "text",
@@ -72,7 +83,8 @@  discard block
 block discarded – undo
72 83
         return $entry;
73 84
     }
74 85
 
75
-    public static function getCustomById ($customId, $id) {
86
+    public static function getCustomById ($customId, $id)
87
+    {
76 88
         $result = parent::getDb ()->prepare('select id, value as name from ' . self::getTableName ($customId) . ' where id = ?');
77 89
         $result->execute (array ($id));
78 90
         if ($post = $result->fetchObject ()) {
@@ -81,15 +93,15 @@  discard block
 block discarded – undo
81 93
         return NULL;
82 94
     }
83 95
 
84
-    public static function getAllCustoms($customId) {
96
+    public static function getAllCustoms($customId)
97
+    {
85 98
         $result = parent::getDb ()->query(str_format ('select {0}.id as id, {0}.value as name, count(*) as count
86 99
 from {0}, {1}
87 100
 where {0}.id = {1}.{2}
88 101
 group by {0}.id, {0}.value
89 102
 order by {0}.value', self::getTableName ($customId), self::getTableLinkName ($customId), self::getTableLinkColumn ($customId)));
90 103
         $entryArray = array();
91
-        while ($post = $result->fetchObject ())
92
-        {
104
+        while ($post = $result->fetchObject ()) {
93 105
             $customColumn = new CustomColumn ($post->id, $post->name, $customId);
94 106
             array_push ($entryArray, new Entry ($customColumn->name, $customColumn->getEntryId (),
95 107
                 str_format (localize("bookword", $post->count), $post->count), "text",
Please login to merge, or discard this patch.
lib/Page.php 2 patches
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -22,55 +22,55 @@  discard block
 block discarded – undo
22 22
     public $totalNumber = -1;
23 23
     public $entryArray = array();
24 24
 
25
-    public static function getPage ($pageId, $id, $query, $n)
25
+    public static function getPage($pageId, $id, $query, $n)
26 26
     {
27 27
         switch ($pageId) {
28 28
             case Base::PAGE_ALL_AUTHORS :
29
-                return new PageAllAuthors ($id, $query, $n);
29
+                return new PageAllAuthors($id, $query, $n);
30 30
             case Base::PAGE_AUTHORS_FIRST_LETTER :
31
-                return new PageAllAuthorsLetter ($id, $query, $n);
31
+                return new PageAllAuthorsLetter($id, $query, $n);
32 32
             case Base::PAGE_AUTHOR_DETAIL :
33
-                return new PageAuthorDetail ($id, $query, $n);
33
+                return new PageAuthorDetail($id, $query, $n);
34 34
             case Base::PAGE_ALL_TAGS :
35
-                return new PageAllTags ($id, $query, $n);
35
+                return new PageAllTags($id, $query, $n);
36 36
             case Base::PAGE_TAG_DETAIL :
37
-                return new PageTagDetail ($id, $query, $n);
37
+                return new PageTagDetail($id, $query, $n);
38 38
             case Base::PAGE_ALL_LANGUAGES :
39
-                return new PageAllLanguages ($id, $query, $n);
39
+                return new PageAllLanguages($id, $query, $n);
40 40
             case Base::PAGE_LANGUAGE_DETAIL :
41
-                return new PageLanguageDetail ($id, $query, $n);
41
+                return new PageLanguageDetail($id, $query, $n);
42 42
             case Base::PAGE_ALL_CUSTOMS :
43
-                return new PageAllCustoms ($id, $query, $n);
43
+                return new PageAllCustoms($id, $query, $n);
44 44
             case Base::PAGE_CUSTOM_DETAIL :
45
-                return new PageCustomDetail ($id, $query, $n);
45
+                return new PageCustomDetail($id, $query, $n);
46 46
             case Base::PAGE_ALL_RATINGS :
47
-                return new PageAllRating ($id, $query, $n);
47
+                return new PageAllRating($id, $query, $n);
48 48
             case Base::PAGE_RATING_DETAIL :
49
-                return new PageRatingDetail ($id, $query, $n);
49
+                return new PageRatingDetail($id, $query, $n);
50 50
             case Base::PAGE_ALL_SERIES :
51
-                return new PageAllSeries ($id, $query, $n);
51
+                return new PageAllSeries($id, $query, $n);
52 52
             case Base::PAGE_ALL_BOOKS :
53
-                return new PageAllBooks ($id, $query, $n);
53
+                return new PageAllBooks($id, $query, $n);
54 54
             case Base::PAGE_ALL_BOOKS_LETTER:
55
-                return new PageAllBooksLetter ($id, $query, $n);
55
+                return new PageAllBooksLetter($id, $query, $n);
56 56
             case Base::PAGE_ALL_RECENT_BOOKS :
57
-                return new PageRecentBooks ($id, $query, $n);
57
+                return new PageRecentBooks($id, $query, $n);
58 58
             case Base::PAGE_SERIE_DETAIL :
59
-                return new PageSerieDetail ($id, $query, $n);
59
+                return new PageSerieDetail($id, $query, $n);
60 60
             case Base::PAGE_OPENSEARCH_QUERY :
61
-                return new PageQueryResult ($id, $query, $n);
61
+                return new PageQueryResult($id, $query, $n);
62 62
             case Base::PAGE_BOOK_DETAIL :
63
-                return new PageBookDetail ($id, $query, $n);
63
+                return new PageBookDetail($id, $query, $n);
64 64
             case Base::PAGE_ALL_PUBLISHERS:
65
-                return new PageAllPublishers ($id, $query, $n);
65
+                return new PageAllPublishers($id, $query, $n);
66 66
             case Base::PAGE_PUBLISHER_DETAIL :
67
-                return new PagePublisherDetail ($id, $query, $n);
67
+                return new PagePublisherDetail($id, $query, $n);
68 68
             case Base::PAGE_ABOUT :
69
-                return new PageAbout ($id, $query, $n);
69
+                return new PageAbout($id, $query, $n);
70 70
             case Base::PAGE_CUSTOMIZE :
71
-                return new PageCustomize ($id, $query, $n);
71
+                return new PageCustomize($id, $query, $n);
72 72
             default:
73
-                $page = new Page ($id, $query, $n);
73
+                $page = new Page($id, $query, $n);
74 74
                 $page->idPage = "cops:catalog";
75 75
                 return $page;
76 76
         }
@@ -83,96 +83,96 @@  discard block
 block discarded – undo
83 83
         $this->query = $pquery;
84 84
         $this->n = $pn;
85 85
         $this->favicon = $config['cops_icon'];
86
-        $this->authorName = empty($config['cops_author_name']) ? utf8_encode('Sébastien Lucas') : $config['cops_author_name'];
87
-        $this->authorUri = empty($config['cops_author_uri']) ? 'http://blog.slucas.fr' : $config['cops_author_uri'];
88
-        $this->authorEmail = empty($config['cops_author_email']) ? '[email protected]' : $config['cops_author_email'];
86
+        $this->authorName = empty($config['cops_author_name'])?utf8_encode('Sébastien Lucas'):$config['cops_author_name'];
87
+        $this->authorUri = empty($config['cops_author_uri'])?'http://blog.slucas.fr':$config['cops_author_uri'];
88
+        $this->authorEmail = empty($config['cops_author_email'])?'[email protected]':$config['cops_author_email'];
89 89
     }
90 90
 
91
-    public function InitializeContent ()
91
+    public function InitializeContent()
92 92
     {
93 93
         global $config;
94 94
         $this->title = $config['cops_title_default'];
95 95
         $this->subtitle = $config['cops_subtitle_default'];
96
-        if (Base::noDatabaseSelected ()) {
96
+        if (Base::noDatabaseSelected()) {
97 97
             $i = 0;
98
-            foreach (Base::getDbNameList () as $key) {
99
-                $nBooks = Book::getBookCount ($i);
100
-                array_push ($this->entryArray, new Entry ($key, "cops:{$i}:catalog",
101
-                                        str_format (localize ("bookword", $nBooks), $nBooks), "text",
102
-                                        array ( new LinkNavigation ("?" . DB . "={$i}")), "", $nBooks));
98
+            foreach (Base::getDbNameList() as $key) {
99
+                $nBooks = Book::getBookCount($i);
100
+                array_push($this->entryArray, new Entry($key, "cops:{$i}:catalog",
101
+                                        str_format(localize("bookword", $nBooks), $nBooks), "text",
102
+                                        array(new LinkNavigation("?" . DB . "={$i}")), "", $nBooks));
103 103
                 $i++;
104
-                Base::clearDb ();
104
+                Base::clearDb();
105 105
             }
106 106
         } else {
107
-            if (!in_array (PageQueryResult::SCOPE_AUTHOR, getCurrentOption ('ignored_categories'))) {
108
-                array_push ($this->entryArray, Author::getCount());
107
+            if (!in_array(PageQueryResult::SCOPE_AUTHOR, getCurrentOption('ignored_categories'))) {
108
+                array_push($this->entryArray, Author::getCount());
109 109
             }
110
-            if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) {
110
+            if (!in_array(PageQueryResult::SCOPE_SERIES, getCurrentOption('ignored_categories'))) {
111 111
                 $series = Serie::getCount();
112
-                if (!is_null ($series)) array_push ($this->entryArray, $series);
112
+                if (!is_null($series)) array_push($this->entryArray, $series);
113 113
             }
114
-            if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) {
114
+            if (!in_array(PageQueryResult::SCOPE_PUBLISHER, getCurrentOption('ignored_categories'))) {
115 115
                 $publisher = Publisher::getCount();
116
-                if (!is_null ($publisher)) array_push ($this->entryArray, $publisher);
116
+                if (!is_null($publisher)) array_push($this->entryArray, $publisher);
117 117
             }
118
-            if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) {
118
+            if (!in_array(PageQueryResult::SCOPE_TAG, getCurrentOption('ignored_categories'))) {
119 119
                 $tags = Tag::getCount();
120
-                if (!is_null ($tags)) array_push ($this->entryArray, $tags);
120
+                if (!is_null($tags)) array_push($this->entryArray, $tags);
121 121
             }
122
-            if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) {
122
+            if (!in_array(PageQueryResult::SCOPE_RATING, getCurrentOption('ignored_categories'))) {
123 123
                 $rating = Rating::getCount();
124
-                if (!is_null ($rating)) array_push ($this->entryArray, $rating);
124
+                if (!is_null($rating)) array_push($this->entryArray, $rating);
125 125
             }
126
-            if (!in_array ("language", getCurrentOption ('ignored_categories'))) {
126
+            if (!in_array("language", getCurrentOption('ignored_categories'))) {
127 127
                 $languages = Language::getCount();
128
-                if (!is_null ($languages)) array_push ($this->entryArray, $languages);
128
+                if (!is_null($languages)) array_push($this->entryArray, $languages);
129 129
             }
130 130
             foreach ($config['cops_calibre_custom_column'] as $lookup) {
131
-                $customId = CustomColumn::getCustomId ($lookup);
132
-                if (!is_null ($customId)) {
133
-                    array_push ($this->entryArray, CustomColumn::getCount($customId));
131
+                $customId = CustomColumn::getCustomId($lookup);
132
+                if (!is_null($customId)) {
133
+                    array_push($this->entryArray, CustomColumn::getCount($customId));
134 134
                 }
135 135
             }
136
-            $this->entryArray = array_merge ($this->entryArray, Book::getCount());
136
+            $this->entryArray = array_merge($this->entryArray, Book::getCount());
137 137
 
138
-            if (Base::isMultipleDatabaseEnabled ()) $this->title =  Base::getDbName ();
138
+            if (Base::isMultipleDatabaseEnabled()) $this->title = Base::getDbName();
139 139
         }
140 140
     }
141 141
 
142
-    public function isPaginated ()
142
+    public function isPaginated()
143 143
     {
144
-        return (getCurrentOption ("max_item_per_page") != -1 &&
144
+        return (getCurrentOption("max_item_per_page") != -1 &&
145 145
                 $this->totalNumber != -1 &&
146
-                $this->totalNumber > getCurrentOption ("max_item_per_page"));
146
+                $this->totalNumber > getCurrentOption("max_item_per_page"));
147 147
     }
148 148
 
149
-    public function getNextLink ()
149
+    public function getNextLink()
150 150
     {
151
-        $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ());
152
-        if (($this->n) * getCurrentOption ("max_item_per_page") < $this->totalNumber) {
153
-            return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", localize ("paging.next.alternate"));
151
+        $currentUrl = preg_replace("/\&n=.*?$/", "", "?" . getQueryString());
152
+        if (($this->n) * getCurrentOption("max_item_per_page") < $this->totalNumber) {
153
+            return new LinkNavigation($currentUrl . "&n=" . ($this->n + 1), "next", localize("paging.next.alternate"));
154 154
         }
155 155
         return NULL;
156 156
     }
157 157
 
158
-    public function getPrevLink ()
158
+    public function getPrevLink()
159 159
     {
160
-        $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ());
160
+        $currentUrl = preg_replace("/\&n=.*?$/", "", "?" . getQueryString());
161 161
         if ($this->n > 1) {
162
-            return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", localize ("paging.previous.alternate"));
162
+            return new LinkNavigation($currentUrl . "&n=" . ($this->n - 1), "previous", localize("paging.previous.alternate"));
163 163
         }
164 164
         return NULL;
165 165
     }
166 166
 
167
-    public function getMaxPage ()
167
+    public function getMaxPage()
168 168
     {
169
-        return ceil ($this->totalNumber / getCurrentOption ("max_item_per_page"));
169
+        return ceil($this->totalNumber / getCurrentOption("max_item_per_page"));
170 170
     }
171 171
 
172
-    public function containsBook ()
172
+    public function containsBook()
173 173
     {
174
-        if (count ($this->entryArray) == 0) return false;
175
-        if (get_class ($this->entryArray [0]) == "EntryBook") return true;
174
+        if (count($this->entryArray) == 0) return false;
175
+        if (get_class($this->entryArray [0]) == "EntryBook") return true;
176 176
         return false;
177 177
     }
178 178
 }
Please login to merge, or discard this patch.
Braces   +26 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,7 +76,8 @@  discard block
 block discarded – undo
76 76
         }
77 77
     }
78 78
 
79
-    public function __construct($pid, $pquery, $pn) {
79
+    public function __construct($pid, $pquery, $pn)
80
+    {
80 81
         global $config;
81 82
 
82 83
         $this->idGet = $pid;
@@ -109,23 +110,33 @@  discard block
 block discarded – undo
109 110
             }
110 111
             if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) {
111 112
                 $series = Serie::getCount();
112
-                if (!is_null ($series)) array_push ($this->entryArray, $series);
113
+                if (!is_null ($series)) {
114
+                    array_push ($this->entryArray, $series);
115
+                }
113 116
             }
114 117
             if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) {
115 118
                 $publisher = Publisher::getCount();
116
-                if (!is_null ($publisher)) array_push ($this->entryArray, $publisher);
119
+                if (!is_null ($publisher)) {
120
+                    array_push ($this->entryArray, $publisher);
121
+                }
117 122
             }
118 123
             if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) {
119 124
                 $tags = Tag::getCount();
120
-                if (!is_null ($tags)) array_push ($this->entryArray, $tags);
125
+                if (!is_null ($tags)) {
126
+                    array_push ($this->entryArray, $tags);
127
+                }
121 128
             }
122 129
             if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) {
123 130
                 $rating = Rating::getCount();
124
-                if (!is_null ($rating)) array_push ($this->entryArray, $rating);
131
+                if (!is_null ($rating)) {
132
+                    array_push ($this->entryArray, $rating);
133
+                }
125 134
             }
126 135
             if (!in_array ("language", getCurrentOption ('ignored_categories'))) {
127 136
                 $languages = Language::getCount();
128
-                if (!is_null ($languages)) array_push ($this->entryArray, $languages);
137
+                if (!is_null ($languages)) {
138
+                    array_push ($this->entryArray, $languages);
139
+                }
129 140
             }
130 141
             foreach ($config['cops_calibre_custom_column'] as $lookup) {
131 142
                 $customId = CustomColumn::getCustomId ($lookup);
@@ -135,7 +146,9 @@  discard block
 block discarded – undo
135 146
             }
136 147
             $this->entryArray = array_merge ($this->entryArray, Book::getCount());
137 148
 
138
-            if (Base::isMultipleDatabaseEnabled ()) $this->title =  Base::getDbName ();
149
+            if (Base::isMultipleDatabaseEnabled ()) {
150
+                $this->title =  Base::getDbName ();
151
+            }
139 152
         }
140 153
     }
141 154
 
@@ -171,8 +184,12 @@  discard block
 block discarded – undo
171 184
 
172 185
     public function containsBook ()
173 186
     {
174
-        if (count ($this->entryArray) == 0) return false;
175
-        if (get_class ($this->entryArray [0]) == "EntryBook") return true;
187
+        if (count ($this->entryArray) == 0) {
188
+            return false;
189
+        }
190
+        if (get_class ($this->entryArray [0]) == "EntryBook") {
191
+            return true;
192
+        }
176 193
         return false;
177 194
     }
178 195
 }
Please login to merge, or discard this patch.
lib/Data.php 1 patch
Braces   +42 added lines, -29 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@  discard block
 block discarded – undo
55 55
         'zip'   => 'application/zip'
56 56
     );
57 57
 
58
-    public function __construct($post, $book = null) {
58
+    public function __construct($post, $book = null)
59
+    {
59 60
         $this->id = $post->id;
60 61
         $this->name = $post->name;
61 62
         $this->format = $post->format;
@@ -64,19 +65,20 @@  discard block
 block discarded – undo
64 65
         $this->book = $book;
65 66
     }
66 67
 
67
-    public function isKnownType () {
68
+    public function isKnownType ()
69
+    {
68 70
         return array_key_exists ($this->extension, self::$mimetypes);
69 71
     }
70 72
 
71
-    public function getMimeType () {
73
+    public function getMimeType ()
74
+    {
72 75
         $result = "application/octet-stream";
73 76
         if ($this->isKnownType ()) {
74 77
             return self::$mimetypes [$this->extension];
75 78
         } elseif (function_exists('finfo_open') === true) {
76 79
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
77 80
 
78
-            if (is_resource($finfo) === true)
79
-            {
81
+            if (is_resource($finfo) === true) {
80 82
                 $result = finfo_file($finfo, $this->getLocalPath ());
81 83
             }
82 84
 
@@ -86,27 +88,33 @@  discard block
 block discarded – undo
86 88
         return $result;
87 89
     }
88 90
 
89
-    public function isEpubValidOnKobo () {
91
+    public function isEpubValidOnKobo ()
92
+    {
90 93
         return $this->format == "EPUB" || $this->format == "KEPUB";
91 94
     }
92 95
 
93
-    public function getFilename () {
96
+    public function getFilename ()
97
+    {
94 98
         return $this->name . "." . strtolower ($this->format);
95 99
     }
96 100
 
97
-    public function getUpdatedFilename () {
101
+    public function getUpdatedFilename ()
102
+    {
98 103
         return $this->book->getAuthorsSort () . " - " . $this->book->title;
99 104
     }
100 105
 
101
-    public function getUpdatedFilenameEpub () {
106
+    public function getUpdatedFilenameEpub ()
107
+    {
102 108
         return $this->getUpdatedFilename () . ".epub";
103 109
     }
104 110
 
105
-    public function getUpdatedFilenameKepub () {
111
+    public function getUpdatedFilenameKepub ()
112
+    {
106 113
         return $this->getUpdatedFilename () . ".kepub.epub";
107 114
     }
108 115
 
109
-    public function getDataLink ($rel, $title = NULL) {
116
+    public function getDataLink ($rel, $title = NULL)
117
+    {
110 118
         global $config;
111 119
 
112 120
         if ($rel == Link::OPDS_ACQUISITION_TYPE && $config['cops_use_url_rewriting'] == "1") {
@@ -116,19 +124,24 @@  discard block
 block discarded – undo
116 124
         return self::getLink ($this->book, $this->extension, $this->getMimeType (), $rel, $this->getFilename (), $this->id, $title);
117 125
     }
118 126
 
119
-    public function getHtmlLink () {
127
+    public function getHtmlLink ()
128
+    {
120 129
         return $this->getDataLink(Link::OPDS_ACQUISITION_TYPE)->href;
121 130
     }
122 131
 
123
-    public function getLocalPath () {
132
+    public function getLocalPath ()
133
+    {
124 134
         return $this->book->path . "/" . $this->getFilename ();
125 135
     }
126 136
 
127
-    public function getHtmlLinkWithRewriting ($title = NULL) {
137
+    public function getHtmlLinkWithRewriting ($title = NULL)
138
+    {
128 139
         global $config;
129 140
 
130 141
         $database = "";
131
-        if (!is_null (GetUrlParam (DB))) $database = GetUrlParam (DB) . "/";
142
+        if (!is_null (GetUrlParam (DB))) {
143
+            $database = GetUrlParam (DB) . "/";
144
+        }
132 145
 
133 146
         $href = "download/" . $this->id . "/" . $database;
134 147
 
@@ -142,28 +155,27 @@  discard block
 block discarded – undo
142 155
         return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title);
143 156
     }
144 157
 
145
-    public static function getDataByBook ($book) {
158
+    public static function getDataByBook ($book)
159
+    {
146 160
         $out = array ();
147 161
         $result = parent::getDb ()->prepare('select id, format, name
148 162
                                              from data where book = ?');
149 163
         $result->execute (array ($book->id));
150 164
 
151
-        while ($post = $result->fetchObject ())
152
-        {
165
+        while ($post = $result->fetchObject ()) {
153 166
             array_push ($out, new Data ($post, $book));
154 167
         }
155 168
         return $out;
156 169
     }
157 170
 
158
-    public static function handleThumbnailLink ($urlParam, $height) {
171
+    public static function handleThumbnailLink ($urlParam, $height)
172
+    {
159 173
         global $config;
160 174
 
161 175
         if (is_null ($height)) {
162 176
             if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) {
163 177
                 $height = $config['cops_opds_thumbnail_height'];
164
-            }
165
-            else
166
-            {
178
+            } else {
167 179
                 $height = $config['cops_html_thumbnail_height'];
168 180
             }
169 181
         }
@@ -182,14 +194,17 @@  discard block
 block discarded – undo
182 194
 
183 195
         if (Base::useAbsolutePath () ||
184 196
             $rel == Link::OPDS_THUMBNAIL_TYPE ||
185
-            ($type == "epub" && $config['cops_update_epub-metadata']))
186
-        {
187
-            if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type);
197
+            ($type == "epub" && $config['cops_update_epub-metadata'])) {
198
+            if ($type != "jpg") {
199
+                $urlParam = addURLParameter($urlParam, "type", $type);
200
+            }
188 201
             if ($rel == Link::OPDS_THUMBNAIL_TYPE) {
189 202
                 $urlParam = self::handleThumbnailLink($urlParam, $height);
190 203
             }
191 204
             $urlParam = addURLParameter($urlParam, "id", $book->id);
192
-            if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB));
205
+            if (!is_null (GetUrlParam (DB))) {
206
+                $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB));
207
+            }
193 208
             if ($config['cops_thumbnail_handling'] != "1" &&
194 209
                 !empty ($config['cops_thumbnail_handling']) &&
195 210
                 $rel == Link::OPDS_THUMBNAIL_TYPE) {
@@ -197,9 +212,7 @@  discard block
 block discarded – undo
197 212
             } else {
198 213
                 return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title);
199 214
             }
200
-        }
201
-        else
202
-        {
215
+        } else {
203 216
             return new Link (str_replace('%2F','/',rawurlencode ($book->path."/".$filename)), $mime, $rel, $title);
204 217
         }
205 218
     }
Please login to merge, or discard this patch.
lib/PageAllBooksLetter.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@
 block discarded – undo
8 8
 
9 9
 class PageAllBooksLetter extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        list ($this->entryArray, $this->totalNumber) = Book::getBooksByStartingLetter ($this->idGet, $this->n);
14
-        $this->idPage = Book::getEntryIdByLetter ($this->idGet);
13
+        list ($this->entryArray, $this->totalNumber) = Book::getBooksByStartingLetter($this->idGet, $this->n);
14
+        $this->idPage = Book::getEntryIdByLetter($this->idGet);
15 15
 
16 16
         $count = $this->totalNumber;
17 17
         if ($count == -1)
18
-            $count = count ($this->entryArray);
18
+            $count = count($this->entryArray);
19 19
 
20
-        $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("bookword", $count), $count), $this->idGet);
20
+        $this->title = str_format(localize("splitByLetter.letter"), str_format(localize("bookword", $count), $count), $this->idGet);
21 21
     }
22 22
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
         $this->idPage = Book::getEntryIdByLetter ($this->idGet);
15 15
 
16 16
         $count = $this->totalNumber;
17
-        if ($count == -1)
18
-            $count = count ($this->entryArray);
17
+        if ($count == -1) {
18
+                    $count = count ($this->entryArray);
19
+        }
19 20
 
20 21
         $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("bookword", $count), $count), $this->idGet);
21 22
     }
Please login to merge, or discard this patch.
lib/PageLanguageDetail.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 
9 9
 class PageLanguageDetail extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $language = Language::getLanguageById ($this->idGet);
14
-        $this->idPage = $language->getEntryId ();
13
+        $language = Language::getLanguageById($this->idGet);
14
+        $this->idPage = $language->getEntryId();
15 15
         $this->title = $language->lang_code;
16
-        list ($this->entryArray, $this->totalNumber) = Book::getBooksByLanguage ($this->idGet, $this->n);
16
+        list ($this->entryArray, $this->totalNumber) = Book::getBooksByLanguage($this->idGet, $this->n);
17 17
     }
18 18
 }
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/PageAllLanguages.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 PageAllLanguages extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13 13
         $this->title = localize("languages.title");
14 14
         $this->entryArray = Language::getAllLanguages();
Please login to merge, or discard this patch.
lib/EntryBook.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,23 +11,23 @@
 block discarded – undo
11 11
     public $book;
12 12
 
13 13
     public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) {
14
-        parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
14
+        parent::__construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
15 15
         $this->book = $pbook;
16 16
         $this->localUpdated = $pbook->timestamp;
17 17
     }
18 18
 
19
-    public function getCoverThumbnail () {
19
+    public function getCoverThumbnail() {
20 20
         foreach ($this->linkArray as $link) {
21 21
             if ($link->rel == Link::OPDS_THUMBNAIL_TYPE)
22
-                return $link->hrefXhtml ();
22
+                return $link->hrefXhtml();
23 23
         }
24 24
         return null;
25 25
     }
26 26
 
27
-    public function getCover () {
27
+    public function getCover() {
28 28
         foreach ($this->linkArray as $link) {
29 29
             if ($link->rel == Link::OPDS_IMAGE_TYPE)
30
-                return $link->hrefXhtml ();
30
+                return $link->hrefXhtml();
31 31
         }
32 32
         return null;
33 33
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,24 +10,29 @@
 block discarded – undo
10 10
 {
11 11
     public $book;
12 12
 
13
-    public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) {
13
+    public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook)
14
+    {
14 15
         parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
15 16
         $this->book = $pbook;
16 17
         $this->localUpdated = $pbook->timestamp;
17 18
     }
18 19
 
19
-    public function getCoverThumbnail () {
20
+    public function getCoverThumbnail ()
21
+    {
20 22
         foreach ($this->linkArray as $link) {
21
-            if ($link->rel == Link::OPDS_THUMBNAIL_TYPE)
22
-                return $link->hrefXhtml ();
23
+            if ($link->rel == Link::OPDS_THUMBNAIL_TYPE) {
24
+                            return $link->hrefXhtml ();
25
+            }
23 26
         }
24 27
         return null;
25 28
     }
26 29
 
27
-    public function getCover () {
30
+    public function getCover ()
31
+    {
28 32
         foreach ($this->linkArray as $link) {
29
-            if ($link->rel == Link::OPDS_IMAGE_TYPE)
30
-                return $link->hrefXhtml ();
33
+            if ($link->rel == Link::OPDS_IMAGE_TYPE) {
34
+                            return $link->hrefXhtml ();
35
+            }
31 36
         }
32 37
         return null;
33 38
     }
Please login to merge, or discard this patch.
lib/PageSerieDetail.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 
9 9
 class PageSerieDetail extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $serie = Serie::getSerieById ($this->idGet);
13
+        $serie = Serie::getSerieById($this->idGet);
14 14
         $this->title = $serie->name;
15
-        list ($this->entryArray, $this->totalNumber) = Book::getBooksBySeries ($this->idGet, $this->n);
16
-        $this->idPage = $serie->getEntryId ();
15
+        list ($this->entryArray, $this->totalNumber) = Book::getBooksBySeries($this->idGet, $this->n);
16
+        $this->idPage = $serie->getEntryId();
17 17
     }
18 18
 }
Please login to merge, or discard this patch.