@@ -55,7 +55,7 @@ discard block |
||
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 |
||
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 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if ($post = $result->fetchObject()) { |
58 | 58 | return new CustomColumn ($id, $post->name, $this); |
59 | 59 | } |
60 | - return NULL; |
|
60 | + return null; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | protected function getAllCustomValuesFromDatabase() |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if ($post = $result->fetchObject()) { |
93 | 93 | return new CustomColumn($post->id, $post->name, $this); |
94 | 94 | } |
95 | - return new CustomColumn(NULL, localize("customcolumn.enum.unknown"), $this); |
|
95 | + return new CustomColumn(null, localize("customcolumn.enum.unknown"), $this); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public function isSearchable() |
@@ -8,12 +8,12 @@ |
||
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 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function InitializeContent () |
12 | 12 | { |
13 | - $customId = getURLParam ("custom", NULL); |
|
13 | + $customId = getURLParam ("custom", null); |
|
14 | 14 | $custom = CustomColumn::createCustom ($customId, $this->idGet); |
15 | 15 | $this->idPage = $custom->getEntryId (); |
16 | 16 | $this->title = $custom->value; |
@@ -8,7 +8,7 @@ |
||
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(); |
@@ -37,146 +37,146 @@ discard block |
||
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 |
||
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 | } |
@@ -37,23 +37,27 @@ discard block |
||
37 | 37 | |
38 | 38 | private static $db = NULL; |
39 | 39 | |
40 | - public static function isMultipleDatabaseEnabled () { |
|
40 | + public static function isMultipleDatabaseEnabled () |
|
41 | + { |
|
41 | 42 | global $config; |
42 | 43 | return is_array ($config['calibre_directory']); |
43 | 44 | } |
44 | 45 | |
45 | - public static function useAbsolutePath () { |
|
46 | + public static function useAbsolutePath () |
|
47 | + { |
|
46 | 48 | global $config; |
47 | 49 | $path = self::getDbDirectory(); |
48 | 50 | return preg_match ('/^\//', $path) || // Linux / |
49 | 51 | preg_match ('/^\w\:/', $path); // Windows X: |
50 | 52 | } |
51 | 53 | |
52 | - public static function noDatabaseSelected () { |
|
54 | + public static function noDatabaseSelected () |
|
55 | + { |
|
53 | 56 | return self::isMultipleDatabaseEnabled () && is_null (GetUrlParam (DB)); |
54 | 57 | } |
55 | 58 | |
56 | - public static function getDbList () { |
|
59 | + public static function getDbList () |
|
60 | + { |
|
57 | 61 | global $config; |
58 | 62 | if (self::isMultipleDatabaseEnabled ()) { |
59 | 63 | return $config['calibre_directory']; |
@@ -62,7 +66,8 @@ discard block |
||
62 | 66 | } |
63 | 67 | } |
64 | 68 | |
65 | - public static function getDbNameList () { |
|
69 | + public static function getDbNameList () |
|
70 | + { |
|
66 | 71 | global $config; |
67 | 72 | if (self::isMultipleDatabaseEnabled ()) { |
68 | 73 | return array_keys ($config['calibre_directory']); |
@@ -71,10 +76,13 @@ discard block |
||
71 | 76 | } |
72 | 77 | } |
73 | 78 | |
74 | - public static function getDbName ($database = NULL) { |
|
79 | + public static function getDbName ($database = NULL) |
|
80 | + { |
|
75 | 81 | global $config; |
76 | 82 | if (self::isMultipleDatabaseEnabled ()) { |
77 | - if (is_null ($database)) $database = GetUrlParam (DB, 0); |
|
83 | + if (is_null ($database)) { |
|
84 | + $database = GetUrlParam (DB, 0); |
|
85 | + } |
|
78 | 86 | if (!is_null($database) && !preg_match('/^\d+$/', $database)) { |
79 | 87 | self::error ($database); |
80 | 88 | } |
@@ -84,10 +92,13 @@ discard block |
||
84 | 92 | return ""; |
85 | 93 | } |
86 | 94 | |
87 | - public static function getDbDirectory ($database = NULL) { |
|
95 | + public static function getDbDirectory ($database = NULL) |
|
96 | + { |
|
88 | 97 | global $config; |
89 | 98 | if (self::isMultipleDatabaseEnabled ()) { |
90 | - if (is_null ($database)) $database = GetUrlParam (DB, 0); |
|
99 | + if (is_null ($database)) { |
|
100 | + $database = GetUrlParam (DB, 0); |
|
101 | + } |
|
91 | 102 | if (!is_null($database) && !preg_match('/^\d+$/', $database)) { |
92 | 103 | self::error ($database); |
93 | 104 | } |
@@ -98,18 +109,21 @@ discard block |
||
98 | 109 | } |
99 | 110 | |
100 | 111 | |
101 | - public static function getDbFileName ($database = NULL) { |
|
112 | + public static function getDbFileName ($database = NULL) |
|
113 | + { |
|
102 | 114 | return self::getDbDirectory ($database) .'metadata.db'; |
103 | 115 | } |
104 | 116 | |
105 | - private static function error ($database) { |
|
117 | + private static function error ($database) |
|
118 | + { |
|
106 | 119 | if (php_sapi_name() != "cli") { |
107 | 120 | header("location: checkconfig.php?err=1"); |
108 | 121 | } |
109 | 122 | throw new Exception("Database <{$database}> not found."); |
110 | 123 | } |
111 | 124 | |
112 | - public static function getDb ($database = NULL) { |
|
125 | + public static function getDb ($database = NULL) |
|
126 | + { |
|
113 | 127 | if (is_null (self::$db)) { |
114 | 128 | try { |
115 | 129 | if (is_readable (self::getDbFileName ($database))) { |
@@ -127,7 +141,8 @@ discard block |
||
127 | 141 | return self::$db; |
128 | 142 | } |
129 | 143 | |
130 | - public static function checkDatabaseAvailability () { |
|
144 | + public static function checkDatabaseAvailability () |
|
145 | + { |
|
131 | 146 | if (self::noDatabaseSelected ()) { |
132 | 147 | for ($i = 0; $i < count (self::getDbList ()); $i++) { |
133 | 148 | self::getDb ($i); |
@@ -139,33 +154,38 @@ discard block |
||
139 | 154 | return true; |
140 | 155 | } |
141 | 156 | |
142 | - public static function clearDb () { |
|
157 | + public static function clearDb () |
|
158 | + { |
|
143 | 159 | self::$db = NULL; |
144 | 160 | } |
145 | 161 | |
146 | - public static function executeQuerySingle ($query, $database = NULL) { |
|
162 | + public static function executeQuerySingle ($query, $database = NULL) |
|
163 | + { |
|
147 | 164 | return self::getDb ($database)->query($query)->fetchColumn(); |
148 | 165 | } |
149 | 166 | |
150 | - public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
|
167 | + public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) |
|
168 | + { |
|
151 | 169 | if (!$numberOfString) { |
152 | 170 | $numberOfString = $table . ".alphabetical"; |
153 | 171 | } |
154 | 172 | $count = self::executeQuerySingle ('select count(*) from ' . $table); |
155 | - if ($count == 0) return NULL; |
|
173 | + if ($count == 0) { |
|
174 | + return NULL; |
|
175 | + } |
|
156 | 176 | $entry = new Entry (localize($table . ".title"), $id, |
157 | 177 | str_format (localize($numberOfString, $count), $count), "text", |
158 | 178 | array ( new LinkNavigation ("?page=".$pageId)), "", $count); |
159 | 179 | return $entry; |
160 | 180 | } |
161 | 181 | |
162 | - public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) { |
|
182 | + public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) |
|
183 | + { |
|
163 | 184 | /* @var $result PDOStatement */ |
164 | 185 | |
165 | 186 | list (, $result) = self::executeQuery ($query, $columns, "", $params, -1); |
166 | 187 | $entryArray = array(); |
167 | - while ($post = $result->fetchObject ()) |
|
168 | - { |
|
188 | + while ($post = $result->fetchObject ()) { |
|
169 | 189 | /* @var $instance Author|Tag|Serie|Publisher */ |
170 | 190 | |
171 | 191 | $instance = new $category ($post); |
@@ -181,7 +201,8 @@ discard block |
||
181 | 201 | return $entryArray; |
182 | 202 | } |
183 | 203 | |
184 | - public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
|
204 | + public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) |
|
205 | + { |
|
185 | 206 | $totalResult = -1; |
186 | 207 | |
187 | 208 | if (useNormAndUp ()) { |
@@ -193,8 +214,7 @@ discard block |
||
193 | 214 | $numberPerPage = getCurrentOption ("max_item_per_page"); |
194 | 215 | } |
195 | 216 | |
196 | - if ($numberPerPage != -1 && $n != -1) |
|
197 | - { |
|
217 | + if ($numberPerPage != -1 && $n != -1) { |
|
198 | 218 | // First check total number of results |
199 | 219 | $result = self::getDb ($database)->prepare (str_format ($query, "count(*)", $filter)); |
200 | 220 | $result->execute ($params); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | const COMPATIBILITY_XML_ALDIKO = "aldiko"; |
37 | 37 | |
38 | - private static $db = NULL; |
|
38 | + private static $db = null; |
|
39 | 39 | |
40 | 40 | public static function isMultipleDatabaseEnabled () { |
41 | 41 | global $config; |
@@ -71,7 +71,7 @@ discard block |
||
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 | 76 | if (self::isMultipleDatabaseEnabled ()) { |
77 | 77 | if (is_null ($database)) $database = GetUrlParam (DB, 0); |
@@ -84,7 +84,7 @@ discard block |
||
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 | 89 | if (self::isMultipleDatabaseEnabled ()) { |
90 | 90 | if (is_null ($database)) $database = GetUrlParam (DB, 0); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | - public static function getDbFileName ($database = NULL) { |
|
101 | + public static function getDbFileName ($database = null) { |
|
102 | 102 | return self::getDbDirectory ($database) .'metadata.db'; |
103 | 103 | } |
104 | 104 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | throw new Exception("Database <{$database}> not found."); |
110 | 110 | } |
111 | 111 | |
112 | - public static function getDb ($database = NULL) { |
|
112 | + public static function getDb ($database = null) { |
|
113 | 113 | if (is_null (self::$db)) { |
114 | 114 | try { |
115 | 115 | if (is_readable (self::getDbFileName ($database))) { |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | public static function clearDb () { |
143 | - self::$db = NULL; |
|
143 | + self::$db = null; |
|
144 | 144 | } |
145 | 145 | |
146 | - public static function executeQuerySingle ($query, $database = NULL) { |
|
146 | + public static function executeQuerySingle ($query, $database = null) { |
|
147 | 147 | return self::getDb ($database)->query($query)->fetchColumn(); |
148 | 148 | } |
149 | 149 | |
150 | - public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
|
150 | + public static function getCountGeneric($table, $id, $pageId, $numberOfString = null) { |
|
151 | 151 | if (!$numberOfString) { |
152 | 152 | $numberOfString = $table . ".alphabetical"; |
153 | 153 | } |
154 | 154 | $count = self::executeQuerySingle ('select count(*) from ' . $table); |
155 | - if ($count == 0) return NULL; |
|
155 | + if ($count == 0) return null; |
|
156 | 156 | $entry = new Entry (localize($table . ".title"), $id, |
157 | 157 | str_format (localize($numberOfString, $count), $count), "text", |
158 | 158 | array ( new LinkNavigation ("?page=".$pageId)), "", $count); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | return $entryArray; |
182 | 182 | } |
183 | 183 | |
184 | - public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
|
184 | + public static function executeQuery($query, $columns, $filter, $params, $n, $database = null, $numberPerPage = null) { |
|
185 | 185 | $totalResult = -1; |
186 | 186 | |
187 | 187 | if (useNormAndUp ()) { |
@@ -30,7 +30,7 @@ |
||
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 |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | public $facetGroup; |
22 | 22 | public $activeFacet; |
23 | 23 | |
24 | - public function __construct($phref, $ptype, $prel = NULL, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
|
24 | + public function __construct($phref, $ptype, $prel = NULL, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) |
|
25 | + { |
|
25 | 26 | $this->href = $phref; |
26 | 27 | $this->type = $ptype; |
27 | 28 | $this->rel = $prel; |
@@ -30,11 +31,13 @@ discard block |
||
30 | 31 | $this->activeFacet = $pactiveFacet; |
31 | 32 | } |
32 | 33 | |
33 | - public function hrefXhtml () { |
|
34 | + public function hrefXhtml () |
|
35 | + { |
|
34 | 36 | return $this->href; |
35 | 37 | } |
36 | 38 | |
37 | - public function getScriptName() { |
|
39 | + public function getScriptName() |
|
40 | + { |
|
38 | 41 | $parts = explode('/', $_SERVER["SCRIPT_NAME"]); |
39 | 42 | return $parts[count($parts) - 1]; |
40 | 43 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public $facetGroup; |
22 | 22 | public $activeFacet; |
23 | 23 | |
24 | - public function __construct($phref, $ptype, $prel = NULL, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
|
24 | + public function __construct($phref, $ptype, $prel = null, $ptitle = null, $pfacetGroup = null, $pactiveFacet = false) { |
|
25 | 25 | $this->href = $phref; |
26 | 26 | $this->type = $ptype; |
27 | 27 | $this->rel = $prel; |
@@ -8,7 +8,7 @@ |
||
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(); |
@@ -8,8 +8,8 @@ |
||
8 | 8 | |
9 | 9 | class PageAbout extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | - $this->title = localize ("about.title"); |
|
13 | + $this->title = localize("about.title"); |
|
14 | 14 | } |
15 | 15 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $id = $date->format("Y-m-d"); |
50 | 50 | |
51 | 51 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
52 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($id))); |
|
52 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($id))); |
|
53 | 53 | |
54 | 54 | $entry = new Entry($date->format(localize("customcolumn.date.format")), $this->getEntryId($id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
55 | 55 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function getDescription() |
63 | 63 | { |
64 | 64 | $desc = $this->getDatabaseDescription(); |
65 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
65 | + if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
66 | 66 | return $desc; |
67 | 67 | } |
68 | 68 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | return new CustomColumn($date->format("Y-m-d"), $date->format(localize("customcolumn.date.format")), $this); |
79 | 79 | } |
80 | - return new CustomColumn(NULL, localize("customcolumn.date.unknown"), $this); |
|
80 | + return new CustomColumn(null, localize("customcolumn.date.unknown"), $this); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | public function isSearchable() |
@@ -55,7 +55,9 @@ |
||
55 | 55 | public function getDescription() |
56 | 56 | { |
57 | 57 | $desc = $this->getDatabaseDescription(); |
58 | - if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
58 | + if ($desc === NULL || empty($desc)) { |
|
59 | + $desc = str_format(localize("customcolumn.description"), $this->getTitle()); |
|
60 | + } |
|
59 | 61 | return $desc; |
60 | 62 | } |
61 | 63 |
@@ -78,7 +78,8 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - public function __construct($pid, $pquery, $pn) { |
|
81 | + public function __construct($pid, $pquery, $pn) |
|
82 | + { |
|
82 | 83 | global $config; |
83 | 84 | |
84 | 85 | $this->idGet = $pid; |
@@ -111,23 +112,33 @@ discard block |
||
111 | 112 | } |
112 | 113 | if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) { |
113 | 114 | $series = Serie::getCount(); |
114 | - if (!is_null ($series)) array_push ($this->entryArray, $series); |
|
115 | + if (!is_null ($series)) { |
|
116 | + array_push ($this->entryArray, $series); |
|
117 | + } |
|
115 | 118 | } |
116 | 119 | if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) { |
117 | 120 | $publisher = Publisher::getCount(); |
118 | - if (!is_null ($publisher)) array_push ($this->entryArray, $publisher); |
|
121 | + if (!is_null ($publisher)) { |
|
122 | + array_push ($this->entryArray, $publisher); |
|
123 | + } |
|
119 | 124 | } |
120 | 125 | if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) { |
121 | 126 | $tags = Tag::getCount(); |
122 | - if (!is_null ($tags)) array_push ($this->entryArray, $tags); |
|
127 | + if (!is_null ($tags)) { |
|
128 | + array_push ($this->entryArray, $tags); |
|
129 | + } |
|
123 | 130 | } |
124 | 131 | if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) { |
125 | 132 | $rating = Rating::getCount(); |
126 | - if (!is_null ($rating)) array_push ($this->entryArray, $rating); |
|
133 | + if (!is_null ($rating)) { |
|
134 | + array_push ($this->entryArray, $rating); |
|
135 | + } |
|
127 | 136 | } |
128 | 137 | if (!in_array ("language", getCurrentOption ('ignored_categories'))) { |
129 | 138 | $languages = Language::getCount(); |
130 | - if (!is_null ($languages)) array_push ($this->entryArray, $languages); |
|
139 | + if (!is_null ($languages)) { |
|
140 | + array_push ($this->entryArray, $languages); |
|
141 | + } |
|
131 | 142 | } |
132 | 143 | foreach ($config['cops_calibre_custom_column'] as $lookup) { |
133 | 144 | $customColumn = CustomColumnType::createByLookup($lookup); |
@@ -137,7 +148,9 @@ discard block |
||
137 | 148 | } |
138 | 149 | $this->entryArray = array_merge ($this->entryArray, Book::getCount()); |
139 | 150 | |
140 | - if (Base::isMultipleDatabaseEnabled ()) $this->title = Base::getDbName (); |
|
151 | + if (Base::isMultipleDatabaseEnabled ()) { |
|
152 | + $this->title = Base::getDbName (); |
|
153 | + } |
|
141 | 154 | } |
142 | 155 | } |
143 | 156 | |
@@ -173,8 +186,12 @@ discard block |
||
173 | 186 | |
174 | 187 | public function containsBook () |
175 | 188 | { |
176 | - if (count ($this->entryArray) == 0) return false; |
|
177 | - if (get_class ($this->entryArray [0]) == "EntryBook") return true; |
|
189 | + if (count ($this->entryArray) == 0) { |
|
190 | + return false; |
|
191 | + } |
|
192 | + if (get_class ($this->entryArray [0]) == "EntryBook") { |
|
193 | + return true; |
|
194 | + } |
|
178 | 195 | return false; |
179 | 196 | } |
180 | 197 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if (($this->n) * getCurrentOption ("max_item_per_page") < $this->totalNumber) { |
155 | 155 | return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", localize ("paging.next.alternate")); |
156 | 156 | } |
157 | - return NULL; |
|
157 | + return null; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | public function getPrevLink () |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if ($this->n > 1) { |
164 | 164 | return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", localize ("paging.previous.alternate")); |
165 | 165 | } |
166 | - return NULL; |
|
166 | + return null; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | public function getMaxPage () |
@@ -24,55 +24,55 @@ discard block |
||
24 | 24 | /* @var Entry[] */ |
25 | 25 | public $entryArray = array(); |
26 | 26 | |
27 | - public static function getPage ($pageId, $id, $query, $n) |
|
27 | + public static function getPage($pageId, $id, $query, $n) |
|
28 | 28 | { |
29 | 29 | switch ($pageId) { |
30 | 30 | case Base::PAGE_ALL_AUTHORS : |
31 | - return new PageAllAuthors ($id, $query, $n); |
|
31 | + return new PageAllAuthors($id, $query, $n); |
|
32 | 32 | case Base::PAGE_AUTHORS_FIRST_LETTER : |
33 | - return new PageAllAuthorsLetter ($id, $query, $n); |
|
33 | + return new PageAllAuthorsLetter($id, $query, $n); |
|
34 | 34 | case Base::PAGE_AUTHOR_DETAIL : |
35 | - return new PageAuthorDetail ($id, $query, $n); |
|
35 | + return new PageAuthorDetail($id, $query, $n); |
|
36 | 36 | case Base::PAGE_ALL_TAGS : |
37 | - return new PageAllTags ($id, $query, $n); |
|
37 | + return new PageAllTags($id, $query, $n); |
|
38 | 38 | case Base::PAGE_TAG_DETAIL : |
39 | - return new PageTagDetail ($id, $query, $n); |
|
39 | + return new PageTagDetail($id, $query, $n); |
|
40 | 40 | case Base::PAGE_ALL_LANGUAGES : |
41 | - return new PageAllLanguages ($id, $query, $n); |
|
41 | + return new PageAllLanguages($id, $query, $n); |
|
42 | 42 | case Base::PAGE_LANGUAGE_DETAIL : |
43 | - return new PageLanguageDetail ($id, $query, $n); |
|
43 | + return new PageLanguageDetail($id, $query, $n); |
|
44 | 44 | case Base::PAGE_ALL_CUSTOMS : |
45 | - return new PageAllCustoms ($id, $query, $n); |
|
45 | + return new PageAllCustoms($id, $query, $n); |
|
46 | 46 | case Base::PAGE_CUSTOM_DETAIL : |
47 | - return new PageCustomDetail ($id, $query, $n); |
|
47 | + return new PageCustomDetail($id, $query, $n); |
|
48 | 48 | case Base::PAGE_ALL_RATINGS : |
49 | - return new PageAllRating ($id, $query, $n); |
|
49 | + return new PageAllRating($id, $query, $n); |
|
50 | 50 | case Base::PAGE_RATING_DETAIL : |
51 | - return new PageRatingDetail ($id, $query, $n); |
|
51 | + return new PageRatingDetail($id, $query, $n); |
|
52 | 52 | case Base::PAGE_ALL_SERIES : |
53 | - return new PageAllSeries ($id, $query, $n); |
|
53 | + return new PageAllSeries($id, $query, $n); |
|
54 | 54 | case Base::PAGE_ALL_BOOKS : |
55 | - return new PageAllBooks ($id, $query, $n); |
|
55 | + return new PageAllBooks($id, $query, $n); |
|
56 | 56 | case Base::PAGE_ALL_BOOKS_LETTER: |
57 | - return new PageAllBooksLetter ($id, $query, $n); |
|
57 | + return new PageAllBooksLetter($id, $query, $n); |
|
58 | 58 | case Base::PAGE_ALL_RECENT_BOOKS : |
59 | - return new PageRecentBooks ($id, $query, $n); |
|
59 | + return new PageRecentBooks($id, $query, $n); |
|
60 | 60 | case Base::PAGE_SERIE_DETAIL : |
61 | - return new PageSerieDetail ($id, $query, $n); |
|
61 | + return new PageSerieDetail($id, $query, $n); |
|
62 | 62 | case Base::PAGE_OPENSEARCH_QUERY : |
63 | - return new PageQueryResult ($id, $query, $n); |
|
63 | + return new PageQueryResult($id, $query, $n); |
|
64 | 64 | case Base::PAGE_BOOK_DETAIL : |
65 | - return new PageBookDetail ($id, $query, $n); |
|
65 | + return new PageBookDetail($id, $query, $n); |
|
66 | 66 | case Base::PAGE_ALL_PUBLISHERS: |
67 | - return new PageAllPublishers ($id, $query, $n); |
|
67 | + return new PageAllPublishers($id, $query, $n); |
|
68 | 68 | case Base::PAGE_PUBLISHER_DETAIL : |
69 | - return new PagePublisherDetail ($id, $query, $n); |
|
69 | + return new PagePublisherDetail($id, $query, $n); |
|
70 | 70 | case Base::PAGE_ABOUT : |
71 | - return new PageAbout ($id, $query, $n); |
|
71 | + return new PageAbout($id, $query, $n); |
|
72 | 72 | case Base::PAGE_CUSTOMIZE : |
73 | - return new PageCustomize ($id, $query, $n); |
|
73 | + return new PageCustomize($id, $query, $n); |
|
74 | 74 | default: |
75 | - $page = new Page ($id, $query, $n); |
|
75 | + $page = new Page($id, $query, $n); |
|
76 | 76 | $page->idPage = "cops:catalog"; |
77 | 77 | return $page; |
78 | 78 | } |
@@ -85,96 +85,96 @@ discard block |
||
85 | 85 | $this->query = $pquery; |
86 | 86 | $this->n = $pn; |
87 | 87 | $this->favicon = $config['cops_icon']; |
88 | - $this->authorName = empty($config['cops_author_name']) ? utf8_encode('Sébastien Lucas') : $config['cops_author_name']; |
|
89 | - $this->authorUri = empty($config['cops_author_uri']) ? 'http://blog.slucas.fr' : $config['cops_author_uri']; |
|
90 | - $this->authorEmail = empty($config['cops_author_email']) ? '[email protected]' : $config['cops_author_email']; |
|
88 | + $this->authorName = empty($config['cops_author_name'])? utf8_encode('Sébastien Lucas'):$config['cops_author_name']; |
|
89 | + $this->authorUri = empty($config['cops_author_uri'])?'http://blog.slucas.fr':$config['cops_author_uri']; |
|
90 | + $this->authorEmail = empty($config['cops_author_email'])?'[email protected]':$config['cops_author_email']; |
|
91 | 91 | } |
92 | 92 | |
93 | - public function InitializeContent () |
|
93 | + public function InitializeContent() |
|
94 | 94 | { |
95 | 95 | global $config; |
96 | 96 | $this->title = $config['cops_title_default']; |
97 | 97 | $this->subtitle = $config['cops_subtitle_default']; |
98 | - if (Base::noDatabaseSelected ()) { |
|
98 | + if (Base::noDatabaseSelected()) { |
|
99 | 99 | $i = 0; |
100 | - foreach (Base::getDbNameList () as $key) { |
|
101 | - $nBooks = Book::getBookCount ($i); |
|
102 | - array_push ($this->entryArray, new Entry ($key, "cops:{$i}:catalog", |
|
103 | - str_format (localize ("bookword", $nBooks), $nBooks), "text", |
|
104 | - array ( new LinkNavigation ("?" . DB . "={$i}")), "", $nBooks)); |
|
100 | + foreach (Base::getDbNameList() as $key) { |
|
101 | + $nBooks = Book::getBookCount($i); |
|
102 | + array_push($this->entryArray, new Entry($key, "cops:{$i}:catalog", |
|
103 | + str_format(localize("bookword", $nBooks), $nBooks), "text", |
|
104 | + array(new LinkNavigation("?" . DB . "={$i}")), "", $nBooks)); |
|
105 | 105 | $i++; |
106 | - Base::clearDb (); |
|
106 | + Base::clearDb(); |
|
107 | 107 | } |
108 | 108 | } else { |
109 | - if (!in_array (PageQueryResult::SCOPE_AUTHOR, getCurrentOption ('ignored_categories'))) { |
|
110 | - array_push ($this->entryArray, Author::getCount()); |
|
109 | + if (!in_array(PageQueryResult::SCOPE_AUTHOR, getCurrentOption('ignored_categories'))) { |
|
110 | + array_push($this->entryArray, Author::getCount()); |
|
111 | 111 | } |
112 | - if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) { |
|
112 | + if (!in_array(PageQueryResult::SCOPE_SERIES, getCurrentOption('ignored_categories'))) { |
|
113 | 113 | $series = Serie::getCount(); |
114 | - if (!is_null ($series)) array_push ($this->entryArray, $series); |
|
114 | + if (!is_null($series)) array_push($this->entryArray, $series); |
|
115 | 115 | } |
116 | - if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) { |
|
116 | + if (!in_array(PageQueryResult::SCOPE_PUBLISHER, getCurrentOption('ignored_categories'))) { |
|
117 | 117 | $publisher = Publisher::getCount(); |
118 | - if (!is_null ($publisher)) array_push ($this->entryArray, $publisher); |
|
118 | + if (!is_null($publisher)) array_push($this->entryArray, $publisher); |
|
119 | 119 | } |
120 | - if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) { |
|
120 | + if (!in_array(PageQueryResult::SCOPE_TAG, getCurrentOption('ignored_categories'))) { |
|
121 | 121 | $tags = Tag::getCount(); |
122 | - if (!is_null ($tags)) array_push ($this->entryArray, $tags); |
|
122 | + if (!is_null($tags)) array_push($this->entryArray, $tags); |
|
123 | 123 | } |
124 | - if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) { |
|
124 | + if (!in_array(PageQueryResult::SCOPE_RATING, getCurrentOption('ignored_categories'))) { |
|
125 | 125 | $rating = Rating::getCount(); |
126 | - if (!is_null ($rating)) array_push ($this->entryArray, $rating); |
|
126 | + if (!is_null($rating)) array_push($this->entryArray, $rating); |
|
127 | 127 | } |
128 | - if (!in_array ("language", getCurrentOption ('ignored_categories'))) { |
|
128 | + if (!in_array("language", getCurrentOption('ignored_categories'))) { |
|
129 | 129 | $languages = Language::getCount(); |
130 | - if (!is_null ($languages)) array_push ($this->entryArray, $languages); |
|
130 | + if (!is_null($languages)) array_push($this->entryArray, $languages); |
|
131 | 131 | } |
132 | 132 | foreach ($config['cops_calibre_custom_column'] as $lookup) { |
133 | 133 | $customColumn = CustomColumnType::createByLookup($lookup); |
134 | - if (!is_null ($customColumn) && $customColumn->isSearchable()) { |
|
135 | - array_push ($this->entryArray, $customColumn->getCount()); |
|
134 | + if (!is_null($customColumn) && $customColumn->isSearchable()) { |
|
135 | + array_push($this->entryArray, $customColumn->getCount()); |
|
136 | 136 | } |
137 | 137 | } |
138 | - $this->entryArray = array_merge ($this->entryArray, Book::getCount()); |
|
138 | + $this->entryArray = array_merge($this->entryArray, Book::getCount()); |
|
139 | 139 | |
140 | - if (Base::isMultipleDatabaseEnabled ()) $this->title = Base::getDbName (); |
|
140 | + if (Base::isMultipleDatabaseEnabled()) $this->title = Base::getDbName(); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | - public function isPaginated () |
|
144 | + public function isPaginated() |
|
145 | 145 | { |
146 | - return (getCurrentOption ("max_item_per_page") != -1 && |
|
146 | + return (getCurrentOption("max_item_per_page") != -1 && |
|
147 | 147 | $this->totalNumber != -1 && |
148 | - $this->totalNumber > getCurrentOption ("max_item_per_page")); |
|
148 | + $this->totalNumber > getCurrentOption("max_item_per_page")); |
|
149 | 149 | } |
150 | 150 | |
151 | - public function getNextLink () |
|
151 | + public function getNextLink() |
|
152 | 152 | { |
153 | - $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ()); |
|
154 | - if (($this->n) * getCurrentOption ("max_item_per_page") < $this->totalNumber) { |
|
155 | - return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", localize ("paging.next.alternate")); |
|
153 | + $currentUrl = preg_replace("/\&n=.*?$/", "", "?" . getQueryString()); |
|
154 | + if (($this->n) * getCurrentOption("max_item_per_page") < $this->totalNumber) { |
|
155 | + return new LinkNavigation($currentUrl . "&n=" . ($this->n + 1), "next", localize("paging.next.alternate")); |
|
156 | 156 | } |
157 | 157 | return NULL; |
158 | 158 | } |
159 | 159 | |
160 | - public function getPrevLink () |
|
160 | + public function getPrevLink() |
|
161 | 161 | { |
162 | - $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ()); |
|
162 | + $currentUrl = preg_replace("/\&n=.*?$/", "", "?" . getQueryString()); |
|
163 | 163 | if ($this->n > 1) { |
164 | - return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", localize ("paging.previous.alternate")); |
|
164 | + return new LinkNavigation($currentUrl . "&n=" . ($this->n - 1), "previous", localize("paging.previous.alternate")); |
|
165 | 165 | } |
166 | 166 | return NULL; |
167 | 167 | } |
168 | 168 | |
169 | - public function getMaxPage () |
|
169 | + public function getMaxPage() |
|
170 | 170 | { |
171 | - return ceil ($this->totalNumber / getCurrentOption ("max_item_per_page")); |
|
171 | + return ceil($this->totalNumber / getCurrentOption("max_item_per_page")); |
|
172 | 172 | } |
173 | 173 | |
174 | - public function containsBook () |
|
174 | + public function containsBook() |
|
175 | 175 | { |
176 | - if (count ($this->entryArray) == 0) return false; |
|
177 | - if (get_class ($this->entryArray [0]) == "EntryBook") return true; |
|
176 | + if (count($this->entryArray) == 0) return false; |
|
177 | + if (get_class($this->entryArray [0]) == "EntryBook") return true; |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | } |