@@ -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 = ""; |
@@ -371,6 +382,9 @@ discard block |
||
| 371 | 382 | return $this->href; |
| 372 | 383 | } |
| 373 | 384 | |
| 385 | + /** |
|
| 386 | + * @return string |
|
| 387 | + */ |
|
| 374 | 388 | public function getScriptName() { |
| 375 | 389 | $parts = explode('/', $_SERVER["SCRIPT_NAME"]); |
| 376 | 390 | return $parts[count($parts) - 1]; |
@@ -379,6 +393,9 @@ discard block |
||
| 379 | 393 | |
| 380 | 394 | class LinkNavigation extends Link |
| 381 | 395 | { |
| 396 | + /** |
|
| 397 | + * @param string $prel |
|
| 398 | + */ |
|
| 382 | 399 | public function __construct($phref, $prel = NULL, $ptitle = NULL) { |
| 383 | 400 | parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
| 384 | 401 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
@@ -393,6 +410,9 @@ discard block |
||
| 393 | 410 | |
| 394 | 411 | class LinkFacet extends Link |
| 395 | 412 | { |
| 413 | + /** |
|
| 414 | + * @param string $phref |
|
| 415 | + */ |
|
| 396 | 416 | public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { |
| 397 | 417 | parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); |
| 398 | 418 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
@@ -472,6 +492,12 @@ discard block |
||
| 472 | 492 | { |
| 473 | 493 | public $book; |
| 474 | 494 | |
| 495 | + /** |
|
| 496 | + * @param string $pid |
|
| 497 | + * @param string $pcontent |
|
| 498 | + * @param string $pcontentType |
|
| 499 | + * @param Book $pbook |
|
| 500 | + */ |
|
| 475 | 501 | public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) { |
| 476 | 502 | parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray); |
| 477 | 503 | $this->book = $pbook; |
@@ -1045,6 +1071,9 @@ discard block |
||
| 1045 | 1071 | |
| 1046 | 1072 | class PageCustomize extends Page |
| 1047 | 1073 | { |
| 1074 | + /** |
|
| 1075 | + * @param string $key |
|
| 1076 | + */ |
|
| 1048 | 1077 | private function isChecked ($key, $testedValue = 1) { |
| 1049 | 1078 | $value = getCurrentOption ($key); |
| 1050 | 1079 | if (is_array ($value)) { |
@@ -1059,6 +1088,9 @@ discard block |
||
| 1059 | 1088 | return ""; |
| 1060 | 1089 | } |
| 1061 | 1090 | |
| 1091 | + /** |
|
| 1092 | + * @param string $key |
|
| 1093 | + */ |
|
| 1062 | 1094 | private function isSelected ($key, $value) { |
| 1063 | 1095 | if (getCurrentOption ($key) == $value) { |
| 1064 | 1096 | return "selected='selected'"; |
@@ -1202,6 +1234,9 @@ discard block |
||
| 1202 | 1234 | } |
| 1203 | 1235 | } |
| 1204 | 1236 | |
| 1237 | + /** |
|
| 1238 | + * @param integer $database |
|
| 1239 | + */ |
|
| 1205 | 1240 | public static function getDbName ($database = NULL) { |
| 1206 | 1241 | global $config; |
| 1207 | 1242 | if (self::isMultipleDatabaseEnabled ()) { |
@@ -1215,6 +1250,9 @@ discard block |
||
| 1215 | 1250 | return ""; |
| 1216 | 1251 | } |
| 1217 | 1252 | |
| 1253 | + /** |
|
| 1254 | + * @return string |
|
| 1255 | + */ |
|
| 1218 | 1256 | public static function getDbDirectory ($database = NULL) { |
| 1219 | 1257 | global $config; |
| 1220 | 1258 | if (self::isMultipleDatabaseEnabled ()) { |
@@ -1274,10 +1312,18 @@ discard block |
||
| 1274 | 1312 | self::$db = NULL; |
| 1275 | 1313 | } |
| 1276 | 1314 | |
| 1315 | + /** |
|
| 1316 | + * @param string $query |
|
| 1317 | + */ |
|
| 1277 | 1318 | public static function executeQuerySingle ($query, $database = NULL) { |
| 1278 | 1319 | return self::getDb ($database)->query($query)->fetchColumn(); |
| 1279 | 1320 | } |
| 1280 | 1321 | |
| 1322 | + /** |
|
| 1323 | + * @param string $table |
|
| 1324 | + * @param string $id |
|
| 1325 | + * @param string $numberOfString |
|
| 1326 | + */ |
|
| 1281 | 1327 | public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { |
| 1282 | 1328 | if (!$numberOfString) { |
| 1283 | 1329 | $numberOfString = $table . ".alphabetical"; |
@@ -1290,6 +1336,10 @@ discard block |
||
| 1290 | 1336 | return $entry; |
| 1291 | 1337 | } |
| 1292 | 1338 | |
| 1339 | + /** |
|
| 1340 | + * @param string $columns |
|
| 1341 | + * @param string $category |
|
| 1342 | + */ |
|
| 1293 | 1343 | public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) { |
| 1294 | 1344 | list (, $result) = self::executeQuery ($query, $columns, "", $params, -1); |
| 1295 | 1345 | $entryArray = array(); |
@@ -1308,6 +1358,9 @@ discard block |
||
| 1308 | 1358 | return $entryArray; |
| 1309 | 1359 | } |
| 1310 | 1360 | |
| 1361 | + /** |
|
| 1362 | + * @param string $filter |
|
| 1363 | + */ |
|
| 1311 | 1364 | public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { |
| 1312 | 1365 | $totalResult = -1; |
| 1313 | 1366 | |