@@ -60,6 +60,9 @@ discard block |
||
| 60 | 60 | return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%")); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | + /** |
|
| 64 | + * @param string $query |
|
| 65 | + */ |
|
| 63 | 66 | public static function getAuthorsForSearch($query) { |
| 64 | 67 | return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%")); |
| 65 | 68 | } |
@@ -68,6 +71,9 @@ discard block |
||
| 68 | 71 | return self::getEntryArray (self::SQL_ALL_AUTHORS, array ()); |
| 69 | 72 | } |
| 70 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $query |
|
| 76 | + */ |
|
| 71 | 77 | public static function getEntryArray ($query, $params) { |
| 72 | 78 | return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author"); |
| 73 | 79 | } |
@@ -60,6 +60,9 @@ discard block |
||
| 60 | 60 | $_SERVER['REDIRECT_STATUS'] = 404; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | +/** |
|
| 64 | + * @param string $name |
|
| 65 | + */ |
|
| 63 | 66 | function getURLParam ($name, $default = NULL) { |
| 64 | 67 | if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != "") { |
| 65 | 68 | return $_GET[$name]; |
@@ -95,6 +98,11 @@ discard block |
||
| 95 | 98 | return $url . "?v=" . VERSION; |
| 96 | 99 | } |
| 97 | 100 | |
| 101 | +/** |
|
| 102 | + * @param string $xml |
|
| 103 | + * |
|
| 104 | + * @return string |
|
| 105 | + */ |
|
| 98 | 106 | function xml2xhtml($xml) { |
| 99 | 107 | return preg_replace_callback('#<(\w+)([^>]*)\s*/>#s', create_function('$m', ' |
| 100 | 108 | $xhtml_tags = array("br", "hr", "input", "frame", "img", "area", "link", "col", "base", "basefont", "param"); |
@@ -308,6 +316,9 @@ discard block |
||
| 308 | 316 | return $phrase; |
| 309 | 317 | } |
| 310 | 318 | |
| 319 | +/** |
|
| 320 | + * @param string $paramName |
|
| 321 | + */ |
|
| 311 | 322 | function addURLParameter($urlParams, $paramName, $paramValue) { |
| 312 | 323 | if (empty ($urlParams)) { |
| 313 | 324 | $urlParams = ""; |
@@ -369,6 +380,9 @@ discard block |
||
| 369 | 380 | return $this->href; |
| 370 | 381 | } |
| 371 | 382 | |
| 383 | + /** |
|
| 384 | + * @return string |
|
| 385 | + */ |
|
| 372 | 386 | public function getScriptName() { |
| 373 | 387 | $parts = explode('/', $_SERVER["SCRIPT_NAME"]); |
| 374 | 388 | return $parts[count($parts) - 1]; |
@@ -377,6 +391,9 @@ discard block |
||
| 377 | 391 | |
| 378 | 392 | class LinkNavigation extends Link |
| 379 | 393 | { |
| 394 | + /** |
|
| 395 | + * @param string $prel |
|
| 396 | + */ |
|
| 380 | 397 | public function __construct($phref, $prel = NULL, $ptitle = NULL) { |
| 381 | 398 | parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
| 382 | 399 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
@@ -391,6 +408,9 @@ discard block |
||
| 391 | 408 | |
| 392 | 409 | class LinkFacet extends Link |
| 393 | 410 | { |
| 411 | + /** |
|
| 412 | + * @param string $phref |
|
| 413 | + */ |
|
| 394 | 414 | public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
| 395 | 415 | parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); |
| 396 | 416 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
@@ -471,6 +491,12 @@ discard block |
||
| 471 | 491 | { |
| 472 | 492 | public $book; |
| 473 | 493 | |
| 494 | + /** |
|
| 495 | + * @param string $pid |
|
| 496 | + * @param string $pcontent |
|
| 497 | + * @param string $pcontentType |
|
| 498 | + * @param Book $pbook |
|
| 499 | + */ |
|
| 474 | 500 | public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) { |
| 475 | 501 | parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray); |
| 476 | 502 | $this->book = $pbook; |
@@ -1044,6 +1070,9 @@ discard block |
||
| 1044 | 1070 | |
| 1045 | 1071 | class PageCustomize extends Page |
| 1046 | 1072 | { |
| 1073 | + /** |
|
| 1074 | + * @param string $key |
|
| 1075 | + */ |
|
| 1047 | 1076 | private function isChecked ($key, $testedValue = 1) { |
| 1048 | 1077 | $value = getCurrentOption ($key); |
| 1049 | 1078 | if (is_array ($value)) { |
@@ -1058,6 +1087,9 @@ discard block |
||
| 1058 | 1087 | return ""; |
| 1059 | 1088 | } |
| 1060 | 1089 | |
| 1090 | + /** |
|
| 1091 | + * @param string $key |
|
| 1092 | + */ |
|
| 1061 | 1093 | private function isSelected ($key, $value) { |
| 1062 | 1094 | if (getCurrentOption ($key) == $value) { |
| 1063 | 1095 | return "selected='selected'"; |
@@ -1214,6 +1246,9 @@ discard block |
||
| 1214 | 1246 | return ""; |
| 1215 | 1247 | } |
| 1216 | 1248 | |
| 1249 | + /** |
|
| 1250 | + * @return string |
|
| 1251 | + */ |
|
| 1217 | 1252 | public static function getDbDirectory ($database = NULL) { |
| 1218 | 1253 | global $config; |
| 1219 | 1254 | if (self::isMultipleDatabaseEnabled ()) { |
@@ -1273,10 +1308,18 @@ discard block |
||
| 1273 | 1308 | self::$db = NULL; |
| 1274 | 1309 | } |
| 1275 | 1310 | |
| 1311 | + /** |
|
| 1312 | + * @param string $query |
|
| 1313 | + */ |
|
| 1276 | 1314 | public static function executeQuerySingle ($query, $database = NULL) { |
| 1277 | 1315 | return self::getDb ($database)->query($query)->fetchColumn(); |
| 1278 | 1316 | } |
| 1279 | 1317 | |
| 1318 | + /** |
|
| 1319 | + * @param string $table |
|
| 1320 | + * @param string $id |
|
| 1321 | + * @param string $numberOfString |
|
| 1322 | + */ |
|
| 1280 | 1323 | public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
| 1281 | 1324 | if (!$numberOfString) { |
| 1282 | 1325 | $numberOfString = $table . ".alphabetical"; |
@@ -1289,6 +1332,10 @@ discard block |
||
| 1289 | 1332 | return $entry; |
| 1290 | 1333 | } |
| 1291 | 1334 | |
| 1335 | + /** |
|
| 1336 | + * @param string $columns |
|
| 1337 | + * @param string $category |
|
| 1338 | + */ |
|
| 1292 | 1339 | public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) { |
| 1293 | 1340 | list (, $result) = self::executeQuery ($query, $columns, "", $params, -1); |
| 1294 | 1341 | $entryArray = array(); |
@@ -1307,6 +1354,9 @@ discard block |
||
| 1307 | 1354 | return $entryArray; |
| 1308 | 1355 | } |
| 1309 | 1356 | |
| 1357 | + /** |
|
| 1358 | + * @param string $filter |
|
| 1359 | + */ |
|
| 1310 | 1360 | public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
| 1311 | 1361 | $totalResult = -1; |
| 1312 | 1362 | |
@@ -287,6 +287,9 @@ discard block |
||
| 287 | 287 | return reset ($reduced); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | + /** |
|
| 291 | + * @param string $extension |
|
| 292 | + */ |
|
| 290 | 293 | public function getFilePath ($extension, $idData = NULL, $relative = false) |
| 291 | 294 | { |
| 292 | 295 | if ($extension == "jpg") |
@@ -419,6 +422,9 @@ discard block |
||
| 419 | 422 | $this->getLinkArray (), $this); |
| 420 | 423 | } |
| 421 | 424 | |
| 425 | + /** |
|
| 426 | + * @param integer $database |
|
| 427 | + */ |
|
| 422 | 428 | public static function getBookCount($database = NULL) { |
| 423 | 429 | return parent::executeQuerySingle ('select count(*) from books', $database); |
| 424 | 430 | } |
@@ -500,6 +506,10 @@ discard block |
||
| 500 | 506 | return NULL; |
| 501 | 507 | } |
| 502 | 508 | |
| 509 | + /** |
|
| 510 | + * @param integer $database |
|
| 511 | + * @param integer $numberPerPage |
|
| 512 | + */ |
|
| 503 | 513 | public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
| 504 | 514 | $i = 0; |
| 505 | 515 | $critArray = array (); |
@@ -544,6 +554,9 @@ discard block |
||
| 544 | 554 | return $entryArray; |
| 545 | 555 | } |
| 546 | 556 | |
| 557 | + /** |
|
| 558 | + * @param integer $numberPerPage |
|
| 559 | + */ |
|
| 547 | 560 | public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { |
| 548 | 561 | return self::getEntryArray (self::SQL_BOOKS_BY_FIRST_LETTER, array ($letter . "%"), $n, $database, $numberPerPage); |
| 549 | 562 | } |
@@ -141,6 +141,9 @@ discard block |
||
| 141 | 141 | return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | + /** |
|
| 145 | + * @param Book $book |
|
| 146 | + */ |
|
| 144 | 147 | public static function getDataByBook ($book) { |
| 145 | 148 | $out = array (); |
| 146 | 149 | $result = parent::getDb ()->prepare('select id, format, name |
@@ -154,6 +157,9 @@ discard block |
||
| 154 | 157 | return $out; |
| 155 | 158 | } |
| 156 | 159 | |
| 160 | + /** |
|
| 161 | + * @param string $urlParam |
|
| 162 | + */ |
|
| 157 | 163 | public static function handleThumbnailLink ($urlParam, $height) { |
| 158 | 164 | global $config; |
| 159 | 165 | |
@@ -173,6 +179,10 @@ discard block |
||
| 173 | 179 | return $urlParam; |
| 174 | 180 | } |
| 175 | 181 | |
| 182 | + /** |
|
| 183 | + * @param string $type |
|
| 184 | + * @param string $filename |
|
| 185 | + */ |
|
| 176 | 186 | public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) |
| 177 | 187 | { |
| 178 | 188 | global $config; |
@@ -36,6 +36,9 @@ |
||
| 36 | 36 | return self::getEntryArray (self::SQL_ALL_RATINGS, array ()); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | + /** |
|
| 40 | + * @param string $query |
|
| 41 | + */ |
|
| 39 | 42 | public static function getEntryArray ($query, $params) { |
| 40 | 43 | list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1); |
| 41 | 44 | $entryArray = array(); |
@@ -45,6 +45,9 @@ |
||
| 45 | 45 | return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag"); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | + /** |
|
| 49 | + * @param integer $numberPerPage |
|
| 50 | + */ |
|
| 48 | 51 | public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { |
| 49 | 52 | $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count"; |
| 50 | 53 | $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name'; |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | /** |
| 164 | 164 | * Replaces a Unicode character using the transliteration database. |
| 165 | 165 | * |
| 166 | - * @param $ord |
|
| 166 | + * @param integer $ord |
|
| 167 | 167 | * An ordinal Unicode character code. |
| 168 | 168 | * @param $unknown |
| 169 | 169 | * Replacement string for characters that do not have a suitable ASCII |