Completed
Push — master ( 306060...2234f3 )
by Markus
03:46
created
lib/Publisher.php 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,25 +17,30 @@  discard block
 block discarded – undo
17 17
     public $id;
18 18
     public $name;
19 19
 
20
-    public function __construct($post) {
20
+    public function __construct($post)
21
+    {
21 22
         $this->id = $post->id;
22 23
         $this->name = $post->name;
23 24
     }
24 25
 
25
-    public function getUri () {
26
+    public function getUri ()
27
+    {
26 28
         return "?page=".parent::PAGE_PUBLISHER_DETAIL."&id=$this->id";
27 29
     }
28 30
 
29
-    public function getEntryId () {
31
+    public function getEntryId ()
32
+    {
30 33
         return self::ALL_PUBLISHERS_ID.":".$this->id;
31 34
     }
32 35
 
33
-    public static function getCount() {
36
+    public static function getCount()
37
+    {
34 38
         // str_format (localize("publishers.alphabetical", count(array))
35 39
         return parent::getCountGeneric ("publishers", self::ALL_PUBLISHERS_ID, parent::PAGE_ALL_PUBLISHERS);
36 40
     }
37 41
 
38
-    public static function getPublisherByBookId ($bookId) {
42
+    public static function getPublisherByBookId ($bookId)
43
+    {
39 44
         $result = parent::getDb ()->prepare('select publishers.id as id, name
40 45
 from books_publishers_link, publishers
41 46
 where publishers.id = publisher and book = ?');
@@ -46,7 +51,8 @@  discard block
 block discarded – undo
46 51
         return NULL;
47 52
     }
48 53
 
49
-    public static function getPublisherById ($publisherId) {
54
+    public static function getPublisherById ($publisherId)
55
+    {
50 56
         $result = parent::getDb ()->prepare('select id, name
51 57
 from publishers where id = ?');
52 58
         $result->execute (array ($publisherId));
@@ -56,11 +62,13 @@  discard block
 block discarded – undo
56 62
         return NULL;
57 63
     }
58 64
 
59
-    public static function getAllPublishers() {
65
+    public static function getAllPublishers()
66
+    {
60 67
         return Base::getEntryArrayWithBookNumber (self::SQL_ALL_PUBLISHERS, self::PUBLISHERS_COLUMNS, array (), "Publisher");
61 68
     }
62 69
 
63
-    public static function getAllPublishersByQuery($query) {
70
+    public static function getAllPublishersByQuery($query)
71
+    {
64 72
         return Base::getEntryArrayWithBookNumber (self::SQL_PUBLISHERS_FOR_SEARCH, self::PUBLISHERS_COLUMNS, array ('%' . $query . '%'), "Publisher");
65 73
     }
66 74
 }
Please login to merge, or discard this patch.
lib/Tag.php 1 patch
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,25 +15,30 @@  discard block
 block discarded – undo
15 15
     public $id;
16 16
     public $name;
17 17
 
18
-    public function __construct($post) {
18
+    public function __construct($post)
19
+    {
19 20
         $this->id = $post->id;
20 21
         $this->name = $post->name;
21 22
     }
22 23
 
23
-    public function getUri () {
24
+    public function getUri ()
25
+    {
24 26
         return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id";
25 27
     }
26 28
 
27
-    public function getEntryId () {
29
+    public function getEntryId ()
30
+    {
28 31
         return self::ALL_TAGS_ID.":".$this->id;
29 32
     }
30 33
 
31
-    public static function getCount() {
34
+    public static function getCount()
35
+    {
32 36
         // str_format (localize("tags.alphabetical", count(array))
33 37
         return parent::getCountGeneric ("tags", self::ALL_TAGS_ID, parent::PAGE_ALL_TAGS);
34 38
     }
35 39
 
36
-    public static function getTagById ($tagId) {
40
+    public static function getTagById ($tagId)
41
+    {
37 42
         $result = parent::getDb ()->prepare('select id, name  from tags where id = ?');
38 43
         $result->execute (array ($tagId));
39 44
         if ($post = $result->fetchObject ()) {
@@ -42,17 +47,18 @@  discard block
 block discarded – undo
42 47
         return NULL;
43 48
     }
44 49
 
45
-    public static function getAllTags() {
50
+    public static function getAllTags()
51
+    {
46 52
         return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag");
47 53
     }
48 54
 
49
-    public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) {
55
+    public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL)
56
+    {
50 57
         $columns  = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count";
51 58
         $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name';
52 59
         list ($totalNumber, $result) = parent::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), $n, $database, $numberPerPage);
53 60
         $entryArray = array();
54
-        while ($post = $result->fetchObject ())
55
-        {
61
+        while ($post = $result->fetchObject ()) {
56 62
             $tag = new Tag ($post);
57 63
             array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (),
58 64
                 str_format (localize("bookword", $post->count), $post->count), "text",
Please login to merge, or discard this patch.
lib/PageAllBooks.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
         $this->title = localize ("allbooks.title");
14 14
         if (getCurrentOption ("titles_split_first_letter") == 1) {
15 15
             $this->entryArray = Book::getAllBooks();
16
-        }
17
-        else {
16
+        } else {
18 17
             list ($this->entryArray, $this->totalNumber) = Book::getBooks ($this->n);
19 18
         }
20 19
         $this->idPage = Book::ALL_BOOKS_ID;
Please login to merge, or discard this patch.
lib/LinkFacet.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,12 @@
 block discarded – undo
8 8
 
9 9
 class LinkFacet extends Link
10 10
 {
11
-    public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) {
11
+    public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE)
12
+    {
12 13
         parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet);
13
-        if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB));
14
+        if (!is_null (GetUrlParam (DB))) {
15
+            $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB));
16
+        }
14 17
         $this->href = parent::getScriptName() . $this->href;
15 18
     }
16 19
 }
Please login to merge, or discard this patch.
lib/PageCustomize.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,8 @@  discard block
 block discarded – undo
8 8
 
9 9
 class PageCustomize extends Page
10 10
 {
11
-    private function isChecked ($key, $testedValue = 1) {
11
+    private function isChecked ($key, $testedValue = 1)
12
+    {
12 13
         $value = getCurrentOption ($key);
13 14
         if (is_array ($value)) {
14 15
             if (in_array ($testedValue, $value)) {
@@ -22,14 +23,16 @@  discard block
 block discarded – undo
22 23
         return "";
23 24
     }
24 25
 
25
-    private function isSelected ($key, $value) {
26
+    private function isSelected ($key, $value)
27
+    {
26 28
         if (getCurrentOption ($key) == $value) {
27 29
             return "selected='selected'";
28 30
         }
29 31
         return "";
30 32
     }
31 33
 
32
-    private function getStyleList () {
34
+    private function getStyleList ()
35
+    {
33 36
         $result = array ();
34 37
         foreach (glob ("templates/" . getCurrentTemplate () . "/styles/style-*.css") as $filename) {
35 38
             if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) {
Please login to merge, or discard this patch.
lib/PageAllAuthors.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
         $this->title = localize ("allbooks.title");
14 14
         if (getCurrentOption ("titles_split_first_letter") == 1) {
15 15
             $this->entryArray = Book::getAllBooks();
16
-        }
17
-        else {
16
+        } else {
18 17
             list ($this->entryArray, $this->totalNumber) = Book::getBooks ($this->n);
19 18
         }
20 19
         $this->idPage = Book::ALL_BOOKS_ID;
Please login to merge, or discard this patch.
fetch.php 1 patch
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.
base.php 1 patch
Braces   +19 added lines, -11 removed lines patch added patch discarded remove patch
@@ -149,7 +149,9 @@  discard block
 block discarded – undo
149 149
     $errors = libxml_get_errors();
150 150
 
151 151
     foreach ($errors as $error) {
152
-        if ($error->code == 801) return false;
152
+        if ($error->code == 801) {
153
+            return false;
154
+        }
153 155
     }
154 156
     return true;
155 157
 }
@@ -175,7 +177,9 @@  discard block
 block discarded – undo
175 177
     }
176 178
     */
177 179
 
178
-    if (!are_libxml_errors_ok ()) $output = 'HTML code not valid.';
180
+    if (!are_libxml_errors_ok ()) {
181
+        $output = 'HTML code not valid.';
182
+    }
179 183
 
180 184
     libxml_use_internal_errors(false);
181 185
     return $output;
@@ -235,7 +239,9 @@  discard block
 block discarded – undo
235 239
 
236 240
             // set default to 1 for any without q factor
237 241
             foreach ($langs as $lang => $val) {
238
-                if ($val === '') $langs[$lang] = 1;
242
+                if ($val === '') {
243
+                    $langs[$lang] = 1;
244
+                }
239 245
             }
240 246
 
241 247
             // sort list based on value
@@ -257,8 +263,7 @@  discard block
 block discarded – undo
257 263
     $lang = 'en';
258 264
     if (!empty($config['cops_language'])) {
259 265
         $lang = $config['cops_language'];
260
-    }
261
-    elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
266
+    } elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
262 267
         $langs = getAcceptLanguages();
263 268
     }
264 269
     //echo var_dump($langs);
@@ -284,12 +289,15 @@  discard block
 block discarded – undo
284 289
 function localize($phrase, $count=-1, $reset=false)
285 290
 {
286 291
     global $config;
287
-    if ($count == 0)
288
-        $phrase .= '.none';
289
-    if ($count == 1)
290
-        $phrase .= '.one';
291
-    if ($count > 1)
292
-        $phrase .= '.many';
292
+    if ($count == 0) {
293
+            $phrase .= '.none';
294
+    }
295
+    if ($count == 1) {
296
+            $phrase .= '.one';
297
+    }
298
+    if ($count > 1) {
299
+            $phrase .= '.many';
300
+    }
293 301
 
294 302
     /* Static keyword is used to ensure the file is loaded only once */
295 303
     static $translations = NULL;
Please login to merge, or discard this patch.
checkconfig.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -237,8 +237,7 @@
 block discarded – undo
237 237
                 $db = new PDO('sqlite:' . Base::getDbFileName($i));
238 238
                 $result = $db->prepare('select books.path || "/" || data.name || "." || lower (format) as fullpath from data join books on data.book = books.id');
239 239
                 $result->execute();
240
-                while ($post = $result->fetchObject())
241
-                {
240
+                while ($post = $result->fetchObject()) {
242 241
                     if (!is_file (Base::getDbDirectory($i) . $post->fullpath)) {
243 242
                         echo '<p>' . Base::getDbDirectory($i) . $post->fullpath . '</p>';
244 243
                     }
Please login to merge, or discard this patch.