| @@ -64,6 +64,9 @@ discard block | ||
| 64 | 64 | $_SERVER['REDIRECT_STATUS'] = 404; | 
| 65 | 65 | } | 
| 66 | 66 | |
| 67 | +/** | |
| 68 | + * @param string $name | |
| 69 | + */ | |
| 67 | 70 | function getURLParam($name, $default = NULL) | 
| 68 | 71 |  { | 
| 69 | 72 |      if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != '') { | 
| @@ -104,6 +107,11 @@ discard block | ||
| 104 | 107 | return $url . '?v=' . VERSION; | 
| 105 | 108 | } | 
| 106 | 109 | |
| 110 | +/** | |
| 111 | + * @param string $xml | |
| 112 | + * | |
| 113 | + * @return string | |
| 114 | + */ | |
| 107 | 115 | function xml2xhtml($xml) | 
| 108 | 116 |  { | 
| 109 | 117 |      return preg_replace_callback('#<(\w+)([^>]*)\s*/>#s', function($m) { | 
| @@ -326,6 +334,9 @@ discard block | ||
| 326 | 334 | return $phrase; | 
| 327 | 335 | } | 
| 328 | 336 | |
| 337 | +/** | |
| 338 | + * @param string $paramName | |
| 339 | + */ | |
| 329 | 340 | function addURLParameter($urlParams, $paramName, $paramValue) | 
| 330 | 341 |  { | 
| 331 | 342 |      if (empty ($urlParams)) { | 
| @@ -32,9 +32,9 @@ discard block | ||
| 32 | 32 | // Generate the function for the template | 
| 33 | 33 | $template = new doT (); | 
| 34 | 34 |      $dot = $template->template ($page, array ('bookdetail' => $bookdetail, | 
| 35 | - 'header' => $header, | |
| 36 | - 'footer' => $footer, | |
| 37 | - 'main' => $main)); | |
| 35 | + 'header' => $header, | |
| 36 | + 'footer' => $footer, | |
| 37 | + 'main' => $main)); | |
| 38 | 38 | // If there is a syntax error in the function created | 
| 39 | 39 | // $dot will be equal to FALSE | 
| 40 | 40 |      if (!$dot) { | 
| @@ -125,7 +125,7 @@ discard block | ||
| 125 | 125 | case LIBXML_ERR_WARNING: | 
| 126 | 126 | $return .= 'Warning ' . $error->code . ': '; | 
| 127 | 127 | break; | 
| 128 | - case LIBXML_ERR_ERROR: | |
| 128 | + case LIBXML_ERR_ERROR: | |
| 129 | 129 | $return .= 'Error ' . $error->code . ': '; | 
| 130 | 130 | break; | 
| 131 | 131 | case LIBXML_ERR_FATAL: | 
| @@ -134,8 +134,8 @@ discard block | ||
| 134 | 134 | } | 
| 135 | 135 | |
| 136 | 136 | $return .= trim($error->message) . | 
| 137 | - "\n Line: " . $error->line . | |
| 138 | - "\n Column: " . $error->column; | |
| 137 | + "\n Line: " . $error->line . | |
| 138 | + "\n Column: " . $error->column; | |
| 139 | 139 | |
| 140 | 140 |      if ($error->file) { | 
| 141 | 141 | $return .= "\n File: " . $error->file; | 
| @@ -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 | } | 
| @@ -84,6 +84,9 @@ discard block | ||
| 84 | 84 | return ""; | 
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | + /** | |
| 88 | + * @return string | |
| 89 | + */ | |
| 87 | 90 |      public static function getDbDirectory ($database = NULL) { | 
| 88 | 91 | global $config; | 
| 89 | 92 |          if (self::isMultipleDatabaseEnabled ()) { | 
| @@ -143,10 +146,18 @@ discard block | ||
| 143 | 146 | self::$db = NULL; | 
| 144 | 147 | } | 
| 145 | 148 | |
| 149 | + /** | |
| 150 | + * @param string $query | |
| 151 | + */ | |
| 146 | 152 |      public static function executeQuerySingle ($query, $database = NULL) { | 
| 147 | 153 | return self::getDb ($database)->query($query)->fetchColumn(); | 
| 148 | 154 | } | 
| 149 | 155 | |
| 156 | + /** | |
| 157 | + * @param string $table | |
| 158 | + * @param string $id | |
| 159 | + * @param string $numberOfString | |
| 160 | + */ | |
| 150 | 161 |      public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) { | 
| 151 | 162 |          if (!$numberOfString) { | 
| 152 | 163 | $numberOfString = $table . ".alphabetical"; | 
| @@ -159,6 +170,10 @@ discard block | ||
| 159 | 170 | return $entry; | 
| 160 | 171 | } | 
| 161 | 172 | |
| 173 | + /** | |
| 174 | + * @param string $columns | |
| 175 | + * @param string $category | |
| 176 | + */ | |
| 162 | 177 |      public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) { | 
| 163 | 178 | /* @var $result PDOStatement */ | 
| 164 | 179 | |
| @@ -181,6 +196,9 @@ discard block | ||
| 181 | 196 | return $entryArray; | 
| 182 | 197 | } | 
| 183 | 198 | |
| 199 | + /** | |
| 200 | + * @param string $filter | |
| 201 | + */ | |
| 184 | 202 |      public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { | 
| 185 | 203 | $totalResult = -1; | 
| 186 | 204 | |
| @@ -144,6 +144,9 @@ discard block | ||
| 144 | 144 | return 'index.php' . $urlParam; | 
| 145 | 145 | } | 
| 146 | 146 | |
| 147 | + /** | |
| 148 | + * @return string | |
| 149 | + */ | |
| 147 | 150 |      public function getTitle () { | 
| 148 | 151 | return $this->title; | 
| 149 | 152 | } | 
| @@ -331,6 +334,9 @@ discard block | ||
| 331 | 334 | return reset($reduced); | 
| 332 | 335 | } | 
| 333 | 336 | |
| 337 | + /** | |
| 338 | + * @param string $extension | |
| 339 | + */ | |
| 334 | 340 | public function getFilePath($extension, $idData = NULL, $relative = false) | 
| 335 | 341 |      { | 
| 336 | 342 | if ($extension == 'jpg') | 
| @@ -464,6 +470,9 @@ discard block | ||
| 464 | 470 | $this->getLinkArray(), $this); | 
| 465 | 471 | } | 
| 466 | 472 | |
| 473 | + /** | |
| 474 | + * @param integer $database | |
| 475 | + */ | |
| 467 | 476 |      public static function getBookCount($database = NULL) { | 
| 468 | 477 |          return parent::executeQuerySingle('select count(*) from books', $database); | 
| 469 | 478 | } | 
| @@ -512,7 +521,7 @@ discard block | ||
| 512 | 521 | } | 
| 513 | 522 | |
| 514 | 523 | /** | 
| 515 | - * @param $customColumn CustomColumn | |
| 524 | + * @param CustomColumn $customColumn CustomColumn | |
| 516 | 525 | * @param $id integer | 
| 517 | 526 | * @param $n integer | 
| 518 | 527 | * @return array | 
| @@ -552,6 +561,10 @@ discard block | ||
| 552 | 561 | return NULL; | 
| 553 | 562 | } | 
| 554 | 563 | |
| 564 | + /** | |
| 565 | + * @param integer $database | |
| 566 | + * @param integer $numberPerPage | |
| 567 | + */ | |
| 555 | 568 |      public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) { | 
| 556 | 569 | $i = 0; | 
| 557 | 570 | $critArray = array(); | 
| @@ -599,6 +612,9 @@ discard block | ||
| 599 | 612 | return $entryArray; | 
| 600 | 613 | } | 
| 601 | 614 | |
| 615 | + /** | |
| 616 | + * @param integer $numberPerPage | |
| 617 | + */ | |
| 602 | 618 |      public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) { | 
| 603 | 619 | return self::getEntryArray(self::SQL_BOOKS_BY_FIRST_LETTER, array($letter . '%'), $n, $database, $numberPerPage); | 
| 604 | 620 | } | 
| @@ -473,15 +473,15 @@ discard block | ||
| 473 | 473 |          $nBooks = parent::executeQuerySingle('select count(*) from books'); | 
| 474 | 474 | $result = array(); | 
| 475 | 475 |          $entry = new Entry(localize('allbooks.title'), | 
| 476 | - self::ALL_BOOKS_ID, | |
| 477 | -                          str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', | |
| 478 | -                          array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); | |
| 476 | + self::ALL_BOOKS_ID, | |
| 477 | +                            str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', | |
| 478 | +                            array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); | |
| 479 | 479 | array_push($result, $entry); | 
| 480 | 480 |          if ($config['cops_recentbooks_limit'] > 0) { | 
| 481 | 481 |              $entry = new Entry(localize('recent.title'), | 
| 482 | - self::ALL_RECENT_BOOKS_ID, | |
| 483 | -                              str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', | |
| 484 | -                              array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); | |
| 482 | + self::ALL_RECENT_BOOKS_ID, | |
| 483 | +                                str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', | |
| 484 | +                                array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); | |
| 485 | 485 | array_push($result, $entry); | 
| 486 | 486 | } | 
| 487 | 487 | return $result; | 
| @@ -556,10 +556,10 @@ discard block | ||
| 556 | 556 | $i = 0; | 
| 557 | 557 | $critArray = array(); | 
| 558 | 558 | foreach (array(PageQueryResult::SCOPE_AUTHOR, | 
| 559 | - PageQueryResult::SCOPE_TAG, | |
| 560 | - PageQueryResult::SCOPE_SERIES, | |
| 561 | - PageQueryResult::SCOPE_PUBLISHER, | |
| 562 | -                       PageQueryResult::SCOPE_BOOK) as $key) { | |
| 559 | + PageQueryResult::SCOPE_TAG, | |
| 560 | + PageQueryResult::SCOPE_SERIES, | |
| 561 | + PageQueryResult::SCOPE_PUBLISHER, | |
| 562 | +                        PageQueryResult::SCOPE_BOOK) as $key) { | |
| 563 | 563 |              if (in_array($key, getCurrentOption('ignored_categories')) || | 
| 564 | 564 |                  (!array_key_exists($key, $query) && !array_key_exists('all', $query))) { | 
| 565 | 565 | $critArray[$i] = self::BAD_SEARCH; | 
| @@ -39,6 +39,9 @@ discard block | ||
| 39 | 39 | /** @var null|Entry[] */ | 
| 40 | 40 | private $customValues = NULL; | 
| 41 | 41 | |
| 42 | + /** | |
| 43 | + * @param string $pdatatype | |
| 44 | + */ | |
| 42 | 45 | protected function __construct($pcustomId, $pdatatype) | 
| 43 | 46 |      { | 
| 44 | 47 | $this->columnTitle = self::getTitleByCustomID($pcustomId); | 
| @@ -147,7 +150,7 @@ discard block | ||
| 147 | 150 | /** | 
| 148 | 151 | * Encode a value of this column ready to be displayed in an HTML document | 
| 149 | 152 | * | 
| 150 | - * @param integer|string $value | |
| 153 | + * @param string $value | |
| 151 | 154 | * @return string | 
| 152 | 155 | */ | 
| 153 | 156 | public function encodeHTMLValue($value) | 
| @@ -277,7 +280,7 @@ discard block | ||
| 277 | 280 | /** | 
| 278 | 281 | * Get a CustomColumn for a specified (by ID) value | 
| 279 | 282 | * | 
| 280 | - * @param string|integer $id the id of the searched value | |
| 283 | + * @param integer $id the id of the searched value | |
| 281 | 284 | * @return CustomColumn | 
| 282 | 285 | */ | 
| 283 | 286 | abstract public function getCustom($id); | 
| @@ -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; | 
| @@ -105,7 +105,7 @@ | ||
| 105 | 105 |      public function getUpdatedFilenameKepub () { | 
| 106 | 106 | $str = $this->getUpdatedFilename () . ".kepub.epub"; | 
| 107 | 107 |          return str_replace(array(':', '#', '&'), | 
| 108 | -                           array('-', '-', ' '), $str ); | |
| 108 | +                            array('-', '-', ' '), $str ); | |
| 109 | 109 | } | 
| 110 | 110 | |
| 111 | 111 |      public function getDataLink ($rel, $title = NULL) { | 
| @@ -8,6 +8,9 @@ | ||
| 8 | 8 | |
| 9 | 9 | class LinkFacet extends Link | 
| 10 | 10 |  { | 
| 11 | + /** | |
| 12 | + * @param string $phref | |
| 13 | + */ | |
| 11 | 14 |      public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { | 
| 12 | 15 | parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); | 
| 13 | 16 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); | 
| @@ -8,6 +8,9 @@ | ||
| 8 | 8 | |
| 9 | 9 | class LinkNavigation extends Link | 
| 10 | 10 |  { | 
| 11 | + /** | |
| 12 | + * @param string $prel | |
| 13 | + */ | |
| 11 | 14 |      public function __construct($phref, $prel = NULL, $ptitle = NULL) { | 
| 12 | 15 | parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); | 
| 13 | 16 | if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); | 
| @@ -8,6 +8,9 @@ discard block | ||
| 8 | 8 | |
| 9 | 9 | class PageCustomize extends Page | 
| 10 | 10 |  { | 
| 11 | + /** | |
| 12 | + * @param string $key | |
| 13 | + */ | |
| 11 | 14 |      private function isChecked ($key, $testedValue = 1) { | 
| 12 | 15 | $value = getCurrentOption ($key); | 
| 13 | 16 |          if (is_array ($value)) { | 
| @@ -22,6 +25,9 @@ discard block | ||
| 22 | 25 | return ""; | 
| 23 | 26 | } | 
| 24 | 27 | |
| 28 | + /** | |
| 29 | + * @param string $key | |
| 30 | + */ | |
| 25 | 31 |      private function isSelected ($key, $value) { | 
| 26 | 32 |          if (getCurrentOption ($key) == $value) { | 
| 27 | 33 | return "selected='selected'"; | 
| @@ -45,11 +45,11 @@ | ||
| 45 | 45 | $this->entryArray = array (); | 
| 46 | 46 | |
| 47 | 47 | $ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR, | 
| 48 | - PageQueryResult::SCOPE_TAG, | |
| 49 | - PageQueryResult::SCOPE_SERIES, | |
| 50 | - PageQueryResult::SCOPE_PUBLISHER, | |
| 51 | - PageQueryResult::SCOPE_RATING, | |
| 52 | - "language"); | |
| 48 | + PageQueryResult::SCOPE_TAG, | |
| 49 | + PageQueryResult::SCOPE_SERIES, | |
| 50 | + PageQueryResult::SCOPE_PUBLISHER, | |
| 51 | + PageQueryResult::SCOPE_RATING, | |
| 52 | + "language"); | |
| 53 | 53 | |
| 54 | 54 | $content = ""; | 
| 55 | 55 |          array_push ($this->entryArray, new Entry ("Template", "", |