@@ -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 | } |
@@ -14,8 +14,9 @@ |
||
14 | 14 | $this->idPage = Book::getEntryIdByLetter ($this->idGet); |
15 | 15 | |
16 | 16 | $count = $this->totalNumber; |
17 | - if ($count == -1) |
|
18 | - $count = count ($this->entryArray); |
|
17 | + if ($count == -1) { |
|
18 | + $count = count ($this->entryArray); |
|
19 | + } |
|
19 | 20 | |
20 | 21 | $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("bookword", $count), $count), $this->idGet); |
21 | 22 | } |
@@ -8,10 +8,15 @@ |
||
8 | 8 | |
9 | 9 | class LinkNavigation extends Link |
10 | 10 | { |
11 | - public function __construct($phref, $prel = NULL, $ptitle = NULL) { |
|
11 | + public function __construct($phref, $prel = NULL, $ptitle = NULL) |
|
12 | + { |
|
12 | 13 | parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
13 | - if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
|
14 | - if (!preg_match ("#^\?(.*)#", $this->href) && !empty ($this->href)) $this->href = "?" . $this->href; |
|
14 | + if (!is_null (GetUrlParam (DB))) { |
|
15 | + $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
|
16 | + } |
|
17 | + if (!preg_match ("#^\?(.*)#", $this->href) && !empty ($this->href)) { |
|
18 | + $this->href = "?" . $this->href; |
|
19 | + } |
|
15 | 20 | if (preg_match ("/(bookdetail|getJSON).php/", parent::getScriptName())) { |
16 | 21 | $this->href = "index.php" . $this->href; |
17 | 22 | } else { |
@@ -31,7 +31,8 @@ discard block |
||
31 | 31 | Publisher::ALL_PUBLISHERS_ID => 'images/publisher.png' |
32 | 32 | ); |
33 | 33 | |
34 | - public function getUpdatedTime () { |
|
34 | + public function getUpdatedTime () |
|
35 | + { |
|
35 | 36 | if (!is_null ($this->localUpdated)) { |
36 | 37 | return date (DATE_ATOM, $this->localUpdated); |
37 | 38 | } |
@@ -41,7 +42,8 @@ discard block |
||
41 | 42 | return date (DATE_ATOM, self::$updated); |
42 | 43 | } |
43 | 44 | |
44 | - public function getNavLink () { |
|
45 | + public function getNavLink () |
|
46 | + { |
|
45 | 47 | foreach ($this->linkArray as $link) { |
46 | 48 | /* @var $link LinkNavigation */ |
47 | 49 | |
@@ -52,7 +54,8 @@ discard block |
||
52 | 54 | return "#"; |
53 | 55 | } |
54 | 56 | |
55 | - public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pclass = "", $pcount = 0) { |
|
57 | + public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pclass = "", $pcount = 0) |
|
58 | + { |
|
56 | 59 | global $config; |
57 | 60 | $this->title = $ptitle; |
58 | 61 | $this->id = $pid; |
@@ -62,10 +65,8 @@ discard block |
||
62 | 65 | $this->className = $pclass; |
63 | 66 | $this->numberOfElement = $pcount; |
64 | 67 | |
65 | - if ($config['cops_show_icons'] == 1) |
|
66 | - { |
|
67 | - foreach (self::$icons as $reg => $image) |
|
68 | - { |
|
68 | + if ($config['cops_show_icons'] == 1) { |
|
69 | + foreach (self::$icons as $reg => $image) { |
|
69 | 70 | if (preg_match ("/" . $reg . "/", $pid)) { |
70 | 71 | array_push ($this->linkArray, new Link (getUrlWithVersion ($image), "image/png", Link::OPDS_THUMBNAIL_TYPE)); |
71 | 72 | break; |
@@ -73,6 +74,8 @@ discard block |
||
73 | 74 | } |
74 | 75 | } |
75 | 76 | |
76 | - if (!is_null (GetUrlParam (DB))) $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id); |
|
77 | + if (!is_null (GetUrlParam (DB))) { |
|
78 | + $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id); |
|
79 | + } |
|
77 | 80 | } |
78 | 81 | } |
@@ -149,7 +149,9 @@ discard block |
||
149 | 149 | $errors = libxml_get_errors(); |
150 | 150 | |
151 | 151 | foreach ($errors as $error) { |
152 | - if ($error->code == 801) return false; |
|
152 | + if ($error->code == 801) { |
|
153 | + return false; |
|
154 | + } |
|
153 | 155 | } |
154 | 156 | return true; |
155 | 157 | } |
@@ -175,7 +177,9 @@ discard block |
||
175 | 177 | } |
176 | 178 | */ |
177 | 179 | |
178 | - if (!are_libxml_errors_ok ()) $output = 'HTML code not valid.'; |
|
180 | + if (!are_libxml_errors_ok ()) { |
|
181 | + $output = 'HTML code not valid.'; |
|
182 | + } |
|
179 | 183 | |
180 | 184 | libxml_use_internal_errors(false); |
181 | 185 | return $output; |
@@ -235,7 +239,9 @@ discard block |
||
235 | 239 | |
236 | 240 | // set default to 1 for any without q factor |
237 | 241 | foreach ($langs as $lang => $val) { |
238 | - if ($val === '') $langs[$lang] = 1; |
|
242 | + if ($val === '') { |
|
243 | + $langs[$lang] = 1; |
|
244 | + } |
|
239 | 245 | } |
240 | 246 | |
241 | 247 | // sort list based on value |
@@ -257,8 +263,7 @@ discard block |
||
257 | 263 | $lang = 'en'; |
258 | 264 | if (!empty($config['cops_language'])) { |
259 | 265 | $lang = $config['cops_language']; |
260 | - } |
|
261 | - elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
266 | + } elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
262 | 267 | $langs = getAcceptLanguages(); |
263 | 268 | } |
264 | 269 | //echo var_dump($langs); |
@@ -284,12 +289,15 @@ discard block |
||
284 | 289 | function localize($phrase, $count=-1, $reset=false) |
285 | 290 | { |
286 | 291 | global $config; |
287 | - if ($count == 0) |
|
288 | - $phrase .= '.none'; |
|
289 | - if ($count == 1) |
|
290 | - $phrase .= '.one'; |
|
291 | - if ($count > 1) |
|
292 | - $phrase .= '.many'; |
|
292 | + if ($count == 0) { |
|
293 | + $phrase .= '.none'; |
|
294 | + } |
|
295 | + if ($count == 1) { |
|
296 | + $phrase .= '.one'; |
|
297 | + } |
|
298 | + if ($count > 1) { |
|
299 | + $phrase .= '.many'; |
|
300 | + } |
|
293 | 301 | |
294 | 302 | /* Static keyword is used to ensure the file is loaded only once */ |
295 | 303 | static $translations = NULL; |
@@ -21,13 +21,11 @@ |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | if(!is_null($config['cops_basic_authentication']) && |
24 | - is_array($config['cops_basic_authentication'])) |
|
25 | -{ |
|
24 | + is_array($config['cops_basic_authentication'])) { |
|
26 | 25 | if (!isset($_SERVER['PHP_AUTH_USER']) || |
27 | 26 | (isset($_SERVER['PHP_AUTH_USER']) && |
28 | 27 | ($_SERVER['PHP_AUTH_USER']!=$config['cops_basic_authentication']['username'] || |
29 | - $_SERVER['PHP_AUTH_PW'] != $config['cops_basic_authentication']['password']))) |
|
30 | - { |
|
28 | + $_SERVER['PHP_AUTH_PW'] != $config['cops_basic_authentication']['password']))) { |
|
31 | 29 | header('WWW-Authenticate: Basic realm="COPS Authentication"'); |
32 | 30 | header('HTTP/1.0 401 Unauthorized'); |
33 | 31 | echo 'This site is password protected'; |
@@ -237,8 +237,7 @@ |
||
237 | 237 | $db = new PDO('sqlite:' . Base::getDbFileName($i)); |
238 | 238 | $result = $db->prepare('select books.path || "/" || data.name || "." || lower (format) as fullpath from data join books on data.book = books.id'); |
239 | 239 | $result->execute(); |
240 | - while ($post = $result->fetchObject()) |
|
241 | - { |
|
240 | + while ($post = $result->fetchObject()) { |
|
242 | 241 | if (!is_file (Base::getDbDirectory($i) . $post->fullpath)) { |
243 | 242 | echo '<p>' . Base::getDbDirectory($i) . $post->fullpath . '</p>'; |
244 | 243 | } |
@@ -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 |
@@ -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 |