@@ -62,6 +62,9 @@ discard block |
||
62 | 62 | return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%")); |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $query |
|
67 | + */ |
|
65 | 68 | public static function getAuthorsForSearch($query) { |
66 | 69 | return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%")); |
67 | 70 | } |
@@ -70,6 +73,9 @@ discard block |
||
70 | 73 | return self::getEntryArray (self::SQL_ALL_AUTHORS, array ()); |
71 | 74 | } |
72 | 75 | |
76 | + /** |
|
77 | + * @param string $query |
|
78 | + */ |
|
73 | 79 | public static function getEntryArray ($query, $params) { |
74 | 80 | return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author"); |
75 | 81 | } |
@@ -58,6 +58,9 @@ discard block |
||
58 | 58 | $_SERVER['REDIRECT_STATUS'] = 404; |
59 | 59 | } |
60 | 60 | |
61 | +/** |
|
62 | + * @param string $name |
|
63 | + */ |
|
61 | 64 | function getURLParam ($name, $default = NULL) { |
62 | 65 | if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != "") { |
63 | 66 | return $_GET[$name]; |
@@ -97,6 +100,11 @@ discard block |
||
97 | 100 | return $url . "?v=" . VERSION; |
98 | 101 | } |
99 | 102 | |
103 | +/** |
|
104 | + * @param string $xml |
|
105 | + * |
|
106 | + * @return string |
|
107 | + */ |
|
100 | 108 | function xml2xhtml($xml) { |
101 | 109 | return preg_replace_callback('#<(\w+)([^>]*)\s*/>#s', create_function('$m', ' |
102 | 110 | $xhtml_tags = array("br", "hr", "input", "frame", "img", "area", "link", "col", "base", "basefont", "param"); |
@@ -310,6 +318,9 @@ discard block |
||
310 | 318 | return $phrase; |
311 | 319 | } |
312 | 320 | |
321 | +/** |
|
322 | + * @param string $paramName |
|
323 | + */ |
|
313 | 324 | function addURLParameter($urlParams, $paramName, $paramValue) { |
314 | 325 | if (empty ($urlParams)) { |
315 | 326 | $urlParams = ""; |
@@ -374,6 +385,9 @@ discard block |
||
374 | 385 | |
375 | 386 | class LinkNavigation extends Link |
376 | 387 | { |
388 | + /** |
|
389 | + * @param string $prel |
|
390 | + */ |
|
377 | 391 | public function __construct($phref, $prel = NULL, $ptitle = NULL) { |
378 | 392 | parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
379 | 393 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
@@ -388,6 +402,9 @@ discard block |
||
388 | 402 | |
389 | 403 | class LinkFacet extends Link |
390 | 404 | { |
405 | + /** |
|
406 | + * @param string $phref |
|
407 | + */ |
|
391 | 408 | public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
392 | 409 | parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); |
393 | 410 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
@@ -467,6 +484,12 @@ discard block |
||
467 | 484 | { |
468 | 485 | public $book; |
469 | 486 | |
487 | + /** |
|
488 | + * @param string $pid |
|
489 | + * @param string $pcontent |
|
490 | + * @param string $pcontentType |
|
491 | + * @param Book $pbook |
|
492 | + */ |
|
470 | 493 | public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) { |
471 | 494 | parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray); |
472 | 495 | $this->book = $pbook; |
@@ -1040,6 +1063,9 @@ discard block |
||
1040 | 1063 | |
1041 | 1064 | class PageCustomize extends Page |
1042 | 1065 | { |
1066 | + /** |
|
1067 | + * @param string $key |
|
1068 | + */ |
|
1043 | 1069 | private function isChecked ($key, $testedValue = 1) { |
1044 | 1070 | $value = getCurrentOption ($key); |
1045 | 1071 | if (is_array ($value)) { |
@@ -1054,6 +1080,9 @@ discard block |
||
1054 | 1080 | return ""; |
1055 | 1081 | } |
1056 | 1082 | |
1083 | + /** |
|
1084 | + * @param string $key |
|
1085 | + */ |
|
1057 | 1086 | private function isSelected ($key, $value) { |
1058 | 1087 | if (getCurrentOption ($key) == $value) { |
1059 | 1088 | return "selected='selected'"; |
@@ -1197,6 +1226,9 @@ discard block |
||
1197 | 1226 | } |
1198 | 1227 | } |
1199 | 1228 | |
1229 | + /** |
|
1230 | + * @param integer $database |
|
1231 | + */ |
|
1200 | 1232 | public static function getDbName ($database = NULL) { |
1201 | 1233 | global $config; |
1202 | 1234 | if (self::isMultipleDatabaseEnabled ()) { |
@@ -1210,6 +1242,9 @@ discard block |
||
1210 | 1242 | return ""; |
1211 | 1243 | } |
1212 | 1244 | |
1245 | + /** |
|
1246 | + * @return string |
|
1247 | + */ |
|
1213 | 1248 | public static function getDbDirectory ($database = NULL) { |
1214 | 1249 | global $config; |
1215 | 1250 | if (self::isMultipleDatabaseEnabled ()) { |
@@ -1269,10 +1304,18 @@ discard block |
||
1269 | 1304 | self::$db = NULL; |
1270 | 1305 | } |
1271 | 1306 | |
1307 | + /** |
|
1308 | + * @param string $query |
|
1309 | + */ |
|
1272 | 1310 | public static function executeQuerySingle ($query, $database = NULL) { |
1273 | 1311 | return self::getDb ($database)->query($query)->fetchColumn(); |
1274 | 1312 | } |
1275 | 1313 | |
1314 | + /** |
|
1315 | + * @param string $table |
|
1316 | + * @param string $id |
|
1317 | + * @param string $numberOfString |
|
1318 | + */ |
|
1276 | 1319 | public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
1277 | 1320 | if (!$numberOfString) { |
1278 | 1321 | $numberOfString = $table . ".alphabetical"; |
@@ -1285,6 +1328,10 @@ discard block |
||
1285 | 1328 | return $entry; |
1286 | 1329 | } |
1287 | 1330 | |
1331 | + /** |
|
1332 | + * @param string $columns |
|
1333 | + * @param string $category |
|
1334 | + */ |
|
1288 | 1335 | public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) { |
1289 | 1336 | list (, $result) = self::executeQuery ($query, $columns, "", $params, -1); |
1290 | 1337 | $entryArray = array(); |
@@ -1303,6 +1350,9 @@ discard block |
||
1303 | 1350 | return $entryArray; |
1304 | 1351 | } |
1305 | 1352 | |
1353 | + /** |
|
1354 | + * @param string $filter |
|
1355 | + */ |
|
1306 | 1356 | public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
1307 | 1357 | $totalResult = -1; |
1308 | 1358 |
@@ -289,6 +289,11 @@ discard block |
||
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
292 | + /** |
|
293 | + * @param string $format |
|
294 | + * |
|
295 | + * @return boolean |
|
296 | + */ |
|
292 | 297 | public function getDataFormat ($format) { |
293 | 298 | $reduced = array_filter ($this->getDatas (), function ($data) use ($format) { |
294 | 299 | return $data->format == $format; |
@@ -296,6 +301,10 @@ discard block |
||
296 | 301 | return reset ($reduced); |
297 | 302 | } |
298 | 303 | |
304 | + /** |
|
305 | + * @param string $extension |
|
306 | + * @param integer $idData |
|
307 | + */ |
|
299 | 308 | public function getFilePath ($extension, $idData = NULL, $relative = false) |
300 | 309 | { |
301 | 310 | if ($extension == "jpg") |
@@ -355,6 +364,9 @@ discard block |
||
355 | 364 | } |
356 | 365 | } |
357 | 366 | |
367 | + /** |
|
368 | + * @param string $outputfile |
|
369 | + */ |
|
358 | 370 | public function getThumbnail ($width, $height, $outputfile = NULL) { |
359 | 371 | if (is_null ($width) && is_null ($height)) { |
360 | 372 | return false; |
@@ -428,6 +440,9 @@ discard block |
||
428 | 440 | $this->getLinkArray (), $this); |
429 | 441 | } |
430 | 442 | |
443 | + /** |
|
444 | + * @param integer $database |
|
445 | + */ |
|
431 | 446 | public static function getBookCount($database = NULL) { |
432 | 447 | return parent::executeQuerySingle ('select count(*) from books', $database); |
433 | 448 | } |
@@ -493,6 +508,9 @@ discard block |
||
493 | 508 | return NULL; |
494 | 509 | } |
495 | 510 | |
511 | + /** |
|
512 | + * @param integer $dataId |
|
513 | + */ |
|
496 | 514 | public static function getBookByDataId($dataId) { |
497 | 515 | $result = parent::getDb ()->prepare('select ' . self::BOOK_COLUMNS . ', data.name, data.format |
498 | 516 | from data, books ' . self::SQL_BOOKS_LEFT_JOIN . ' |
@@ -509,6 +527,10 @@ discard block |
||
509 | 527 | return NULL; |
510 | 528 | } |
511 | 529 | |
530 | + /** |
|
531 | + * @param integer $database |
|
532 | + * @param integer $numberPerPage |
|
533 | + */ |
|
512 | 534 | public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
513 | 535 | $i = 0; |
514 | 536 | $critArray = array (); |
@@ -553,6 +575,9 @@ discard block |
||
553 | 575 | return $entryArray; |
554 | 576 | } |
555 | 577 | |
578 | + /** |
|
579 | + * @param integer $numberPerPage |
|
580 | + */ |
|
556 | 581 | public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { |
557 | 582 | return self::getEntryArray (self::SQL_BOOKS_BY_FIRST_LETTER, array ($letter . "%"), $n, $database, $numberPerPage); |
558 | 583 | } |
@@ -139,6 +139,9 @@ discard block |
||
139 | 139 | return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title); |
140 | 140 | } |
141 | 141 | |
142 | + /** |
|
143 | + * @param Book $book |
|
144 | + */ |
|
142 | 145 | public static function getDataByBook ($book) { |
143 | 146 | $out = array (); |
144 | 147 | $result = parent::getDb ()->prepare('select id, format, name |
@@ -152,6 +155,9 @@ discard block |
||
152 | 155 | return $out; |
153 | 156 | } |
154 | 157 | |
158 | + /** |
|
159 | + * @param string $urlParam |
|
160 | + */ |
|
155 | 161 | public static function handleThumbnailLink ($urlParam, $height) { |
156 | 162 | global $config; |
157 | 163 | |
@@ -171,6 +177,10 @@ discard block |
||
171 | 177 | return $urlParam; |
172 | 178 | } |
173 | 179 | |
180 | + /** |
|
181 | + * @param string $type |
|
182 | + * @param string $filename |
|
183 | + */ |
|
174 | 184 | public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) |
175 | 185 | { |
176 | 186 | global $config; |
@@ -38,6 +38,9 @@ |
||
38 | 38 | return self::getEntryArray (self::SQL_ALL_RATINGS, array ()); |
39 | 39 | } |
40 | 40 | |
41 | + /** |
|
42 | + * @param string $query |
|
43 | + */ |
|
41 | 44 | public static function getEntryArray ($query, $params) { |
42 | 45 | list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1); |
43 | 46 | $entryArray = array(); |
@@ -16,6 +16,10 @@ |
||
16 | 16 | return False; |
17 | 17 | } |
18 | 18 | |
19 | +/** |
|
20 | + * @param integer|null $idData |
|
21 | + * @param string|null $emailDest |
|
22 | + */ |
|
19 | 23 | function checkRequest ($idData, $emailDest) { |
20 | 24 | if (empty ($idData)) { |
21 | 25 | return 'No data sent.'; |
@@ -47,6 +47,9 @@ |
||
47 | 47 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param integer $numberPerPage |
|
52 | + */ |
|
50 | 53 | public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
51 | 54 | $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
52 | 55 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
@@ -26,6 +26,9 @@ discard block |
||
26 | 26 | unlink (TEST_FEED); |
27 | 27 | } |
28 | 28 | |
29 | + /** |
|
30 | + * @param string $relax |
|
31 | + */ |
|
29 | 32 | function jingValidateSchema($feed, $relax = OPDS_RELAX_NG) { |
30 | 33 | $path = ""; |
31 | 34 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
@@ -57,6 +60,9 @@ discard block |
||
57 | 60 | return true; |
58 | 61 | } |
59 | 62 | |
63 | + /** |
|
64 | + * @param string $feed |
|
65 | + */ |
|
60 | 66 | function opdsCompleteValidation ($feed) { |
61 | 67 | return $this->jingValidateSchema($feed) && $this->opdsValidator($feed); |
62 | 68 | } |
@@ -189,6 +189,10 @@ |
||
189 | 189 | $this->assertEquals (14, count($filtered)); |
190 | 190 | } |
191 | 191 | |
192 | + /** |
|
193 | + * @param string $src |
|
194 | + * @param string $out |
|
195 | + */ |
|
192 | 196 | public function normalSearch ($src, $out) |
193 | 197 | { |
194 | 198 | $driver = $this; |