Passed
Push — master ( 0cbb2e...6335df )
by Sébastien
12:28 queued 10:49
created
lib/Tag.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -20,44 +20,44 @@
 block discarded – undo
20 20
         $this->name = $post->name;
21 21
     }
22 22
 
23
-    public function getUri () {
24
-        return "?page=".parent::PAGE_TAG_DETAIL."&id=$this->id";
23
+    public function getUri() {
24
+        return "?page=" . parent::PAGE_TAG_DETAIL . "&id=$this->id";
25 25
     }
26 26
 
27
-    public function getEntryId () {
28
-        return self::ALL_TAGS_ID.":".$this->id;
27
+    public function getEntryId() {
28
+        return self::ALL_TAGS_ID . ":" . $this->id;
29 29
     }
30 30
 
31 31
     public static function getCount() {
32 32
         // str_format (localize("tags.alphabetical", count(array))
33
-        return parent::getCountGeneric ("tags", self::ALL_TAGS_ID, parent::PAGE_ALL_TAGS);
33
+        return parent::getCountGeneric("tags", self::ALL_TAGS_ID, parent::PAGE_ALL_TAGS);
34 34
     }
35 35
 
36
-    public static function getTagById ($tagId) {
37
-        $result = parent::getDb ()->prepare('select id, name  from tags where id = ?');
38
-        $result->execute (array ($tagId));
39
-        if ($post = $result->fetchObject ()) {
40
-            return new Tag ($post);
36
+    public static function getTagById($tagId) {
37
+        $result = parent::getDb()->prepare('select id, name  from tags where id = ?');
38
+        $result->execute(array($tagId));
39
+        if ($post = $result->fetchObject()) {
40
+            return new Tag($post);
41 41
         }
42 42
         return NULL;
43 43
     }
44 44
 
45 45
     public static function getAllTags() {
46
-        return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag");
46
+        return Base::getEntryArrayWithBookNumber(self::SQL_ALL_TAGS, self::TAG_COLUMNS, array(), "Tag");
47 47
     }
48 48
 
49 49
     public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) {
50
-        $columns  = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count";
50
+        $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count";
51 51
         $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name';
52
-        list ($totalNumber, $result) = parent::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), $n, $database, $numberPerPage);
52
+        list ($totalNumber, $result) = parent::executeQuery($sql, $columns, "", array('%' . $query . '%'), $n, $database, $numberPerPage);
53 53
         $entryArray = array();
54
-        while ($post = $result->fetchObject ())
54
+        while ($post = $result->fetchObject())
55 55
         {
56
-            $tag = new Tag ($post);
57
-            array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (),
58
-                str_format (localize("bookword", $post->count), $post->count), "text",
59
-                array ( new LinkNavigation ($tag->getUri ()))));
56
+            $tag = new Tag($post);
57
+            array_push($entryArray, new Entry($tag->name, $tag->getEntryId(),
58
+                str_format(localize("bookword", $post->count), $post->count), "text",
59
+                array(new LinkNavigation($tag->getUri()))));
60 60
         }
61
-        return array ($entryArray, $totalNumber);
61
+        return array($entryArray, $totalNumber);
62 62
     }
63 63
 }
Please login to merge, or discard this patch.
lib/PageCustomize.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
 
9 9
 class PageCustomize extends Page
10 10
 {
11
-    private function isChecked ($key, $testedValue = 1) {
12
-        $value = getCurrentOption ($key);
13
-        if (is_array ($value)) {
14
-            if (in_array ($testedValue, $value)) {
11
+    private function isChecked($key, $testedValue = 1) {
12
+        $value = getCurrentOption($key);
13
+        if (is_array($value)) {
14
+            if (in_array($testedValue, $value)) {
15 15
                 return "checked='checked'";
16 16
             }
17 17
         } else {
@@ -22,29 +22,29 @@  discard block
 block discarded – undo
22 22
         return "";
23 23
     }
24 24
 
25
-    private function isSelected ($key, $value) {
26
-        if (getCurrentOption ($key) == $value) {
25
+    private function isSelected($key, $value) {
26
+        if (getCurrentOption($key) == $value) {
27 27
             return "selected='selected'";
28 28
         }
29 29
         return "";
30 30
     }
31 31
 
32
-    private function getStyleList () {
33
-        $result = array ();
34
-        foreach (glob ("templates/" . getCurrentTemplate () . "/styles/style-*.css") as $filename) {
35
-            if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) {
36
-                array_push ($result, $m [1]);
32
+    private function getStyleList() {
33
+        $result = array();
34
+        foreach (glob("templates/" . getCurrentTemplate() . "/styles/style-*.css") as $filename) {
35
+            if (preg_match('/styles\/style-(.*?)\.css/', $filename, $m)) {
36
+                array_push($result, $m [1]);
37 37
             }
38 38
         }
39 39
         return $result;
40 40
     }
41 41
 
42
-    public function InitializeContent ()
42
+    public function InitializeContent()
43 43
     {
44
-        $this->title = localize ("customize.title");
45
-        $this->entryArray = array ();
44
+        $this->title = localize("customize.title");
45
+        $this->entryArray = array();
46 46
 
47
-        $ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR,
47
+        $ignoredBaseArray = array(PageQueryResult::SCOPE_AUTHOR,
48 48
                                    PageQueryResult::SCOPE_TAG,
49 49
                                    PageQueryResult::SCOPE_SERIES,
50 50
                                    PageQueryResult::SCOPE_PUBLISHER,
@@ -52,49 +52,49 @@  discard block
 block discarded – undo
52 52
                                    "language");
53 53
 
54 54
         $content = "";
55
-        array_push ($this->entryArray, new Entry ("Template", "",
55
+        array_push($this->entryArray, new Entry("Template", "",
56 56
                                         "<span style='cursor: pointer;' onclick='$.cookie(\"template\", \"bootstrap\", { expires: 365 });window.location=$(\".headleft\").attr(\"href\");'>Click to switch to Bootstrap</span>", "text",
57
-                                        array ()));
57
+                                        array()));
58 58
         if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
59 59
             $content .= '<select id="style" onchange="updateCookie (this);">';
60
-            foreach ($this-> getStyleList () as $filename) {
61
-                $content .= "<option value='{$filename}' " . $this->isSelected ("style", $filename) . ">{$filename}</option>";
60
+            foreach ($this-> getStyleList() as $filename) {
61
+                $content .= "<option value='{$filename}' " . $this->isSelected("style", $filename) . ">{$filename}</option>";
62 62
             }
63 63
             $content .= '</select>';
64 64
         } else {
65
-            foreach ($this-> getStyleList () as $filename) {
66
-                $content .= "<input type='radio' onchange='updateCookieFromCheckbox (this);' id='style-{$filename}' name='style' value='{$filename}' " . $this->isChecked ("style", $filename) . " /><label for='style-{$filename}'> {$filename} </label>";
65
+            foreach ($this-> getStyleList() as $filename) {
66
+                $content .= "<input type='radio' onchange='updateCookieFromCheckbox (this);' id='style-{$filename}' name='style' value='{$filename}' " . $this->isChecked("style", $filename) . " /><label for='style-{$filename}'> {$filename} </label>";
67 67
             }
68 68
         }
69
-        array_push ($this->entryArray, new Entry (localize ("customize.style"), "",
69
+        array_push($this->entryArray, new Entry(localize("customize.style"), "",
70 70
                                         $content, "text",
71
-                                        array ()));
72
-        if (!useServerSideRendering ()) {
73
-            $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" ' . $this->isChecked ("use_fancyapps") . ' />';
74
-            array_push ($this->entryArray, new Entry (localize ("customize.fancybox"), "",
71
+                                        array()));
72
+        if (!useServerSideRendering()) {
73
+            $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" ' . $this->isChecked("use_fancyapps") . ' />';
74
+            array_push($this->entryArray, new Entry(localize("customize.fancybox"), "",
75 75
                                             $content, "text",
76
-                                            array ()));
76
+                                            array()));
77 77
         }
78
-        $content = '<input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="' . getCurrentOption ("max_item_per_page") . '" min="-1" max="1200" pattern="^[-+]?[0-9]+$" />';
79
-        array_push ($this->entryArray, new Entry (localize ("customize.paging"), "",
78
+        $content = '<input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="' . getCurrentOption("max_item_per_page") . '" min="-1" max="1200" pattern="^[-+]?[0-9]+$" />';
79
+        array_push($this->entryArray, new Entry(localize("customize.paging"), "",
80 80
                                         $content, "text",
81
-                                        array ()));
82
-        $content = '<input type="text" onchange="updateCookie (this);" id="email" value="' . getCurrentOption ("email") . '" />';
83
-        array_push ($this->entryArray, new Entry (localize ("customize.email"), "",
81
+                                        array()));
82
+        $content = '<input type="text" onchange="updateCookie (this);" id="email" value="' . getCurrentOption("email") . '" />';
83
+        array_push($this->entryArray, new Entry(localize("customize.email"), "",
84 84
                                         $content, "text",
85
-                                        array ()));
86
-        $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="html_tag_filter" ' . $this->isChecked ("html_tag_filter") . ' />';
87
-        array_push ($this->entryArray, new Entry (localize ("customize.filter"), "",
85
+                                        array()));
86
+        $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="html_tag_filter" ' . $this->isChecked("html_tag_filter") . ' />';
87
+        array_push($this->entryArray, new Entry(localize("customize.filter"), "",
88 88
                                         $content, "text",
89
-                                        array ()));
89
+                                        array()));
90 90
         $content = "";
91 91
         foreach ($ignoredBaseArray as $key) {
92
-            $keyPlural = preg_replace ('/(ss)$/', 's', $key . "s");
93
-            $content .=  '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $this->isChecked ("ignored_categories", $key) . ' > ' . localize ("{$keyPlural}.title") . '</input> ';
92
+            $keyPlural = preg_replace('/(ss)$/', 's', $key . "s");
93
+            $content .= '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $this->isChecked("ignored_categories", $key) . ' > ' . localize("{$keyPlural}.title") . '</input> ';
94 94
         }
95 95
 
96
-        array_push ($this->entryArray, new Entry (localize ("customize.ignored"), "",
96
+        array_push($this->entryArray, new Entry(localize("customize.ignored"), "",
97 97
                                         $content, "text",
98
-                                        array ()));
98
+                                        array()));
99 99
     }
100 100
 }
Please login to merge, or discard this patch.
lib/CustomColumnTypeBool.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
     // PHP pre 5.6 does not support const arrays
12 12
     private $BOOLEAN_NAMES = array(
13 13
         -1 => "customcolumn.boolean.unknown", // localize("customcolumn.boolean.unknown")
14
-        00 => "customcolumn.boolean.no",      // localize("customcolumn.boolean.no")
15
-        +1 => "customcolumn.boolean.yes",     // localize("customcolumn.boolean.yes")
14
+        00 => "customcolumn.boolean.no", // localize("customcolumn.boolean.no")
15
+        +1 => "customcolumn.boolean.yes", // localize("customcolumn.boolean.yes")
16 16
     );
17 17
 
18 18
     protected function __construct($pcustomId)
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $entryArray = array();
61 61
         while ($post = $result->fetchObject()) {
62 62
             $entryPContent = str_format(localize("bookword", $post->count), $post->count);
63
-            $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id)));
63
+            $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id)));
64 64
 
65 65
             $entry = new Entry(localize($this->BOOLEAN_NAMES[$post->id]), $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count);
66 66
 
Please login to merge, or discard this patch.
lib/EntryBook.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,27 +20,27 @@
 block discarded – undo
20 20
      * @param Book $pbook
21 21
      */
22 22
     public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) {
23
-        parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
23
+        parent::__construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
24 24
         $this->book = $pbook;
25 25
         $this->localUpdated = $pbook->timestamp;
26 26
     }
27 27
 
28
-    public function getCoverThumbnail () {
28
+    public function getCoverThumbnail() {
29 29
         foreach ($this->linkArray as $link) {
30 30
             /* @var $link LinkNavigation */
31 31
 
32 32
             if ($link->rel == Link::OPDS_THUMBNAIL_TYPE)
33
-                return $link->hrefXhtml ();
33
+                return $link->hrefXhtml();
34 34
         }
35 35
         return null;
36 36
     }
37 37
 
38
-    public function getCover () {
38
+    public function getCover() {
39 39
         foreach ($this->linkArray as $link) {
40 40
             /* @var $link LinkNavigation */
41 41
 
42 42
             if ($link->rel == Link::OPDS_IMAGE_TYPE)
43
-                return $link->hrefXhtml ();
43
+                return $link->hrefXhtml();
44 44
         }
45 45
         return null;
46 46
     }
Please login to merge, or discard this patch.
lib/CustomColumnTypeText.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         while ($post = $result->fetchObject())
71 71
         {
72 72
             $entryPContent = str_format(localize("bookword", $post->count), $post->count);
73
-            $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id)));
73
+            $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id)));
74 74
 
75 75
             $entry = new Entry($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count);
76 76
 
Please login to merge, or discard this patch.
lib/CustomColumnTypeEnumeration.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $result = $this->getDb()->prepare(str_format("SELECT id, value AS name FROM {0} WHERE id = ?", $this->getTableName()));
56 56
         $result->execute(array($id));
57 57
         if ($post = $result->fetchObject()) {
58
-            return new CustomColumn ($id, $post->name, $this);
58
+            return new CustomColumn($id, $post->name, $this);
59 59
         }
60 60
         return NULL;
61 61
     }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
         $entryArray = array();
70 70
         while ($post = $result->fetchObject()) {
71 71
             $entryPContent = str_format(localize("bookword", $post->count), $post->count);
72
-            $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id)));
72
+            $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id)));
73 73
 
74
-            $entry = new Entry ($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count);
74
+            $entry = new Entry($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count);
75 75
 
76 76
             array_push($entryArray, $entry);
77 77
         }
Please login to merge, or discard this patch.
lib/PageCustomDetail.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
 
9 9
 class PageCustomDetail extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13
-        $customId = getURLParam ("custom", NULL);
14
-        $custom = CustomColumn::createCustom ($customId, $this->idGet);
15
-        $this->idPage = $custom->getEntryId ();
13
+        $customId = getURLParam("custom", NULL);
14
+        $custom = CustomColumn::createCustom($customId, $this->idGet);
15
+        $this->idPage = $custom->getEntryId();
16 16
         $this->title = $custom->value;
17
-        list ($this->entryArray, $this->totalNumber) = Book::getBooksByCustom ($custom, $this->idGet, $this->n);
17
+        list ($this->entryArray, $this->totalNumber) = Book::getBooksByCustom($custom, $this->idGet, $this->n);
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
lib/PageAllPublishers.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 PageAllPublishers extends Page
10 10
 {
11
-    public function InitializeContent ()
11
+    public function InitializeContent()
12 12
     {
13 13
         $this->title = localize("publishers.title");
14 14
         $this->entryArray = Publisher::getAllPublishers();
Please login to merge, or discard this patch.
lib/Base.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -37,146 +37,146 @@  discard block
 block discarded – undo
37 37
 
38 38
     private static $db = NULL;
39 39
 
40
-    public static function isMultipleDatabaseEnabled () {
40
+    public static function isMultipleDatabaseEnabled() {
41 41
         global $config;
42
-        return is_array ($config['calibre_directory']);
42
+        return is_array($config['calibre_directory']);
43 43
     }
44 44
 
45
-    public static function useAbsolutePath () {
45
+    public static function useAbsolutePath() {
46 46
         global $config;
47 47
         $path = self::getDbDirectory();
48
-        return preg_match ('/^\//', $path) || // Linux /
49
-               preg_match ('/^\w\:/', $path); // Windows X:
48
+        return preg_match('/^\//', $path) || // Linux /
49
+               preg_match('/^\w\:/', $path); // Windows X:
50 50
     }
51 51
 
52
-    public static function noDatabaseSelected () {
53
-        return self::isMultipleDatabaseEnabled () && is_null (GetUrlParam (DB));
52
+    public static function noDatabaseSelected() {
53
+        return self::isMultipleDatabaseEnabled() && is_null(GetUrlParam(DB));
54 54
     }
55 55
 
56
-    public static function getDbList () {
56
+    public static function getDbList() {
57 57
         global $config;
58
-        if (self::isMultipleDatabaseEnabled ()) {
58
+        if (self::isMultipleDatabaseEnabled()) {
59 59
             return $config['calibre_directory'];
60 60
         } else {
61
-            return array ("" => $config['calibre_directory']);
61
+            return array("" => $config['calibre_directory']);
62 62
         }
63 63
     }
64 64
 
65
-    public static function getDbNameList () {
65
+    public static function getDbNameList() {
66 66
         global $config;
67
-        if (self::isMultipleDatabaseEnabled ()) {
68
-            return array_keys ($config['calibre_directory']);
67
+        if (self::isMultipleDatabaseEnabled()) {
68
+            return array_keys($config['calibre_directory']);
69 69
         } else {
70
-            return array ("");
70
+            return array("");
71 71
         }
72 72
     }
73 73
 
74
-    public static function getDbName ($database = NULL) {
74
+    public static function getDbName($database = NULL) {
75 75
         global $config;
76
-        if (self::isMultipleDatabaseEnabled ()) {
77
-            if (is_null ($database)) $database = GetUrlParam (DB, 0);
76
+        if (self::isMultipleDatabaseEnabled()) {
77
+            if (is_null($database)) $database = GetUrlParam(DB, 0);
78 78
             if (!is_null($database) && !preg_match('/^\d+$/', $database)) {
79
-                self::error ($database);
79
+                self::error($database);
80 80
             }
81
-            $array = array_keys ($config['calibre_directory']);
81
+            $array = array_keys($config['calibre_directory']);
82 82
             return  $array[$database];
83 83
         }
84 84
         return "";
85 85
     }
86 86
 
87
-    public static function getDbDirectory ($database = NULL) {
87
+    public static function getDbDirectory($database = NULL) {
88 88
         global $config;
89
-        if (self::isMultipleDatabaseEnabled ()) {
90
-            if (is_null ($database)) $database = GetUrlParam (DB, 0);
89
+        if (self::isMultipleDatabaseEnabled()) {
90
+            if (is_null($database)) $database = GetUrlParam(DB, 0);
91 91
             if (!is_null($database) && !preg_match('/^\d+$/', $database)) {
92
-                self::error ($database);
92
+                self::error($database);
93 93
             }
94
-            $array = array_values ($config['calibre_directory']);
94
+            $array = array_values($config['calibre_directory']);
95 95
             return  $array[$database];
96 96
         }
97 97
         return $config['calibre_directory'];
98 98
     }
99 99
 
100 100
 
101
-    public static function getDbFileName ($database = NULL) {
102
-        return self::getDbDirectory ($database) .'metadata.db';
101
+    public static function getDbFileName($database = NULL) {
102
+        return self::getDbDirectory($database) . 'metadata.db';
103 103
     }
104 104
 
105
-    private static function error ($database) {
105
+    private static function error($database) {
106 106
         if (php_sapi_name() != "cli") {
107 107
             header("location: checkconfig.php?err=1");
108 108
         }
109 109
         throw new Exception("Database <{$database}> not found.");
110 110
     }
111 111
 
112
-    public static function getDb ($database = NULL) {
113
-        if (is_null (self::$db)) {
112
+    public static function getDb($database = NULL) {
113
+        if (is_null(self::$db)) {
114 114
             try {
115
-                if (is_readable (self::getDbFileName ($database))) {
116
-                    self::$db = new PDO('sqlite:'. self::getDbFileName ($database));
117
-                    if (useNormAndUp ()) {
118
-                        self::$db->sqliteCreateFunction ('normAndUp', 'normAndUp', 1);
115
+                if (is_readable(self::getDbFileName($database))) {
116
+                    self::$db = new PDO('sqlite:' . self::getDbFileName($database));
117
+                    if (useNormAndUp()) {
118
+                        self::$db->sqliteCreateFunction('normAndUp', 'normAndUp', 1);
119 119
                     }
120 120
                 } else {
121
-                    self::error ($database);
121
+                    self::error($database);
122 122
                 }
123 123
             } catch (Exception $e) {
124
-                self::error ($database);
124
+                self::error($database);
125 125
             }
126 126
         }
127 127
         return self::$db;
128 128
     }
129 129
 
130
-    public static function checkDatabaseAvailability () {
131
-        if (self::noDatabaseSelected ()) {
132
-            for ($i = 0; $i < count (self::getDbList ()); $i++) {
133
-                self::getDb ($i);
134
-                self::clearDb ();
130
+    public static function checkDatabaseAvailability() {
131
+        if (self::noDatabaseSelected()) {
132
+            for ($i = 0; $i < count(self::getDbList()); $i++) {
133
+                self::getDb($i);
134
+                self::clearDb();
135 135
             }
136 136
         } else {
137
-            self::getDb ();
137
+            self::getDb();
138 138
         }
139 139
         return true;
140 140
     }
141 141
 
142
-    public static function clearDb () {
142
+    public static function clearDb() {
143 143
         self::$db = NULL;
144 144
     }
145 145
 
146
-    public static function executeQuerySingle ($query, $database = NULL) {
147
-        return self::getDb ($database)->query($query)->fetchColumn();
146
+    public static function executeQuerySingle($query, $database = NULL) {
147
+        return self::getDb($database)->query($query)->fetchColumn();
148 148
     }
149 149
 
150 150
     public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) {
151 151
         if (!$numberOfString) {
152 152
             $numberOfString = $table . ".alphabetical";
153 153
         }
154
-        $count = self::executeQuerySingle ('select count(*) from ' . $table);
154
+        $count = self::executeQuerySingle('select count(*) from ' . $table);
155 155
         if ($count == 0) return NULL;
156
-        $entry = new Entry (localize($table . ".title"), $id,
157
-            str_format (localize($numberOfString, $count), $count), "text",
158
-            array ( new LinkNavigation ("?page=".$pageId)), "", $count);
156
+        $entry = new Entry(localize($table . ".title"), $id,
157
+            str_format(localize($numberOfString, $count), $count), "text",
158
+            array(new LinkNavigation("?page=" . $pageId)), "", $count);
159 159
         return $entry;
160 160
     }
161 161
 
162
-    public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) {
162
+    public static function getEntryArrayWithBookNumber($query, $columns, $params, $category) {
163 163
         /* @var $result PDOStatement */
164 164
 
165
-        list (, $result) = self::executeQuery ($query, $columns, "", $params, -1);
165
+        list (, $result) = self::executeQuery($query, $columns, "", $params, -1);
166 166
         $entryArray = array();
167
-        while ($post = $result->fetchObject ())
167
+        while ($post = $result->fetchObject())
168 168
         {
169 169
             /* @var $instance Author|Tag|Serie|Publisher */
170 170
 
171
-            $instance = new $category ($post);
171
+            $instance = new $category($post);
172 172
             if (property_exists($post, "sort")) {
173 173
                 $title = $post->sort;
174 174
             } else {
175 175
                 $title = $post->name;
176 176
             }
177
-            array_push ($entryArray, new Entry ($title, $instance->getEntryId (),
178
-                str_format (localize("bookword", $post->count), $post->count), "text",
179
-                array ( new LinkNavigation ($instance->getUri ())), "", $post->count));
177
+            array_push($entryArray, new Entry($title, $instance->getEntryId(),
178
+                str_format(localize("bookword", $post->count), $post->count), "text",
179
+                array(new LinkNavigation($instance->getUri())), "", $post->count));
180 180
         }
181 181
         return $entryArray;
182 182
     }
@@ -184,30 +184,30 @@  discard block
 block discarded – undo
184 184
     public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) {
185 185
         $totalResult = -1;
186 186
 
187
-        if (useNormAndUp ()) {
187
+        if (useNormAndUp()) {
188 188
             $query = preg_replace("/upper/", "normAndUp", $query);
189 189
             $columns = preg_replace("/upper/", "normAndUp", $columns);
190 190
         }
191 191
 
192
-        if (is_null ($numberPerPage)) {
193
-            $numberPerPage = getCurrentOption ("max_item_per_page");
192
+        if (is_null($numberPerPage)) {
193
+            $numberPerPage = getCurrentOption("max_item_per_page");
194 194
         }
195 195
 
196 196
         if ($numberPerPage != -1 && $n != -1)
197 197
         {
198 198
             // First check total number of results
199
-            $result = self::getDb ($database)->prepare (str_format ($query, "count(*)", $filter));
200
-            $result->execute ($params);
201
-            $totalResult = $result->fetchColumn ();
199
+            $result = self::getDb($database)->prepare(str_format($query, "count(*)", $filter));
200
+            $result->execute($params);
201
+            $totalResult = $result->fetchColumn();
202 202
 
203 203
             // Next modify the query and params
204 204
             $query .= " limit ?, ?";
205
-            array_push ($params, ($n - 1) * $numberPerPage, $numberPerPage);
205
+            array_push($params, ($n - 1) * $numberPerPage, $numberPerPage);
206 206
         }
207 207
 
208
-        $result = self::getDb ($database)->prepare(str_format ($query, $columns, $filter));
209
-        $result->execute ($params);
210
-        return array ($totalResult, $result);
208
+        $result = self::getDb($database)->prepare(str_format($query, $columns, $filter));
209
+        $result->execute($params);
210
+        return array($totalResult, $result);
211 211
     }
212 212
 
213 213
 }
Please login to merge, or discard this patch.