Test Setup Failed
Push — master ( 9fbeaf...6ecf0d )
by Sébastien
03:30 queued 33s
created
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.
lib/Link.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         $this->activeFacet = $pactiveFacet;
31 31
     }
32 32
 
33
-    public function hrefXhtml () {
33
+    public function hrefXhtml() {
34 34
         return $this->href;
35 35
     }
36 36
 
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.