@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - $expires = 60*60*24*14; |
|
| 22 | + $expires = 60 * 60 * 24 * 14; |
|
| 23 | 23 | header('Pragma: public'); |
| 24 | 24 | header('Cache-Control: maxage=' . $expires); |
| 25 | - header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT'); |
|
| 25 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT'); |
|
| 26 | 26 | $bookId = getURLParam('id', NULL); |
| 27 | 27 | $type = getURLParam('type', 'jpg'); |
| 28 | 28 | $idData = getURLParam('data', NULL); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | if (!$book) { |
| 36 | - notFound (); |
|
| 36 | + notFound(); |
|
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | header('Content-Type: image/jpeg'); |
| 56 | 56 | //by default, we don't cache |
| 57 | 57 | $thumbnailCacheFullpath = null; |
| 58 | - if ( isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '' ) { |
|
| 58 | + if (isset($config['cops_thumbnail_cache_directory']) && $config['cops_thumbnail_cache_directory'] !== '') { |
|
| 59 | 59 | $thumbnailCacheFullpath = $config['cops_thumbnail_cache_directory']; |
| 60 | 60 | //if multiple databases, add a subfolder with the database ID |
| 61 | - $thumbnailCacheFullpath .= !is_null(GetUrlParam (DB)) ? 'db-' . GetUrlParam (DB) . DIRECTORY_SEPARATOR : ''; |
|
| 61 | + $thumbnailCacheFullpath .= !is_null(GetUrlParam(DB))?'db-' . GetUrlParam(DB) . DIRECTORY_SEPARATOR:''; |
|
| 62 | 62 | //when there are lots of thumbnails, it's better to save files in subfolders, so if the book's uuid is |
| 63 | 63 | //"01234567-89ab-cdef-0123-456789abcdef", we will save the thumbnail in .../0/12/34567-89ab-cdef-0123-456789abcdef-... |
| 64 | 64 | $thumbnailCacheFullpath .= substr($book->uuid, 0, 1) . DIRECTORY_SEPARATOR . substr($book->uuid, 1, 2) . DIRECTORY_SEPARATOR; |
| 65 | 65 | //check if cache folder exists or create it |
| 66 | - if ( file_exists($thumbnailCacheFullpath) || mkdir($thumbnailCacheFullpath, 0700, true) ) { |
|
| 66 | + if (file_exists($thumbnailCacheFullpath) || mkdir($thumbnailCacheFullpath, 0700, true)) { |
|
| 67 | 67 | //we name the thumbnail from the book's uuid and it's dimensions (width and/or height) |
| 68 | 68 | $thumbnailCacheName = substr($book->uuid, 3) . '-' . getURLParam('width') . 'x' . getURLParam('height') . '.jpg'; |
| 69 | 69 | $thumbnailCacheFullpath = $thumbnailCacheFullpath . $thumbnailCacheName; |
@@ -73,20 +73,20 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( $thumbnailCacheFullpath !== null && file_exists($thumbnailCacheFullpath) ) { |
|
| 76 | + if ($thumbnailCacheFullpath !== null && file_exists($thumbnailCacheFullpath)) { |
|
| 77 | 77 | //return the already cached thumbnail |
| 78 | - readfile( $thumbnailCacheFullpath ); |
|
| 78 | + readfile($thumbnailCacheFullpath); |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if ($book->getThumbnail (getURLParam('width'), getURLParam('height'), $thumbnailCacheFullpath)) { |
|
| 82 | + if ($book->getThumbnail(getURLParam('width'), getURLParam('height'), $thumbnailCacheFullpath)) { |
|
| 83 | 83 | //if we don't cache the thumbnail, imagejpeg() in $book->getThumbnail() already return the image data |
| 84 | - if ( $thumbnailCacheFullpath === null ) { |
|
| 84 | + if ($thumbnailCacheFullpath === null) { |
|
| 85 | 85 | // The cover had to be resized |
| 86 | 86 | return; |
| 87 | 87 | } else { |
| 88 | 88 | //return the just cached thumbnail |
| 89 | - readfile( $thumbnailCacheFullpath ); |
|
| 89 | + readfile($thumbnailCacheFullpath); |
|
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -49,8 +49,7 @@ |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - switch ($type) |
|
| 53 | - { |
|
| 52 | + switch ($type) { |
|
| 54 | 53 | case 'jpg': |
| 55 | 54 | header('Content-Type: image/jpeg'); |
| 56 | 55 | //by default, we don't cache |
@@ -23,9 +23,9 @@ |
||
| 23 | 23 | header('Pragma: public'); |
| 24 | 24 | header('Cache-Control: maxage=' . $expires); |
| 25 | 25 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT'); |
| 26 | - $bookId = getURLParam('id', NULL); |
|
| 26 | + $bookId = getURLParam('id', null); |
|
| 27 | 27 | $type = getURLParam('type', 'jpg'); |
| 28 | - $idData = getURLParam('data', NULL); |
|
| 28 | + $idData = getURLParam('data', null); |
|
| 29 | 29 | if (is_null($bookId)) { |
| 30 | 30 | $book = Book::getBookByDataId($idData); |
| 31 | 31 | } else { |
@@ -37,14 +37,14 @@ |
||
| 37 | 37 | header('Content-Type:text/html;charset=utf-8'); |
| 38 | 38 | |
| 39 | 39 | $data = array('title' => $config['cops_title_default'], |
| 40 | - 'version' => VERSION, |
|
| 41 | - 'opds_url' => $config['cops_full_url'] . 'feed.php', |
|
| 42 | - 'customHeader' => '', |
|
| 43 | - 'template' => getCurrentTemplate(), |
|
| 44 | - 'server_side_rendering' => useServerSideRendering(), |
|
| 45 | - 'current_css' => getCurrentCss(), |
|
| 46 | - 'favico' => $config['cops_icon'], |
|
| 47 | - 'getjson_url' => 'getJSON.php?' . addURLParameter(getQueryString(), 'complete', 1)); |
|
| 40 | + 'version' => VERSION, |
|
| 41 | + 'opds_url' => $config['cops_full_url'] . 'feed.php', |
|
| 42 | + 'customHeader' => '', |
|
| 43 | + 'template' => getCurrentTemplate(), |
|
| 44 | + 'server_side_rendering' => useServerSideRendering(), |
|
| 45 | + 'current_css' => getCurrentCss(), |
|
| 46 | + 'favico' => $config['cops_icon'], |
|
| 47 | + 'getjson_url' => 'getJSON.php?' . addURLParameter(getQueryString(), 'complete', 1)); |
|
| 48 | 48 | if (preg_match('/Kindle/', $_SERVER['HTTP_USER_AGENT'])) { |
| 49 | 49 | $data['customHeader'] = '<style media="screen" type="text/css"> html { font-size: 75%; -webkit-text-size-adjust: 75%; -ms-text-size-adjust: 75%; }</style>'; |
| 50 | 50 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | } |
| 51 | 51 | $headcontent = file_get_contents('templates/' . getCurrentTemplate() . '/file.html'); |
| 52 | 52 | $template = new doT(); |
| 53 | - $dot = $template->template($headcontent, NULL); |
|
| 53 | + $dot = $template->template($headcontent, null); |
|
| 54 | 54 | echo($dot($data)); |
| 55 | 55 | ?><body> |
| 56 | 56 | <?php |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | header('Content-Type: text/html;charset=utf-8'); |
| 15 | 15 | |
| 16 | -$idData = getURLParam('data', NULL); |
|
| 16 | +$idData = getURLParam('data', null); |
|
| 17 | 17 | $add = 'data=' . $idData . '&'; |
| 18 | 18 | if (!is_null (GetUrlParam (DB))) { |
| 19 | 19 | $add .= DB . '=' . GetUrlParam (DB) . '&'; |
@@ -15,8 +15,8 @@ |
||
| 15 | 15 | |
| 16 | 16 | $idData = getURLParam('data', NULL); |
| 17 | 17 | $add = 'data=' . $idData . '&'; |
| 18 | -if (!is_null (GetUrlParam (DB))) { |
|
| 19 | - $add .= DB . '=' . GetUrlParam (DB) . '&'; |
|
| 18 | +if (!is_null(GetUrlParam(DB))) { |
|
| 19 | + $add .= DB . '=' . GetUrlParam(DB) . '&'; |
|
| 20 | 20 | } |
| 21 | 21 | $myBook = Book::getBookByDataId($idData); |
| 22 | 22 | |
@@ -72,11 +72,11 @@ |
||
| 72 | 72 | try { |
| 73 | 73 | $data = getComponentContent($book, $component, $add); |
| 74 | 74 | |
| 75 | - $expires = 60*60*24*14; |
|
| 75 | + $expires = 60 * 60 * 24 * 14; |
|
| 76 | 76 | header('Pragma: public'); |
| 77 | - header('Cache-Control: maxage='.$expires); |
|
| 78 | - header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT'); |
|
| 79 | - header ('Content-Type: ' . $book->componentContentType($component)); |
|
| 77 | + header('Cache-Control: maxage=' . $expires); |
|
| 78 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT'); |
|
| 79 | + header('Content-Type: ' . $book->componentContentType($component)); |
|
| 80 | 80 | echo $data; |
| 81 | 81 | } catch (Exception $e) { |
| 82 | 82 | error_log($e); |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -$idData = getURLParam('data', NULL); |
|
| 54 | +$idData = getURLParam('data', null); |
|
| 55 | 55 | $add = 'data=' . $idData . '&'; |
| 56 | 56 | if (!is_null(GetUrlParam(DB))) { |
| 57 | 57 | $add .= DB . '=' . GetUrlParam(DB) . '&'; |
@@ -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 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | <meta charset="utf-8"> |
| 27 | 27 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 28 | 28 | <title>COPS Configuration Check</title> |
| 29 | - <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" /> |
|
| 29 | + <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss()) ?>" media="screen" /> |
|
| 30 | 30 | </head> |
| 31 | 31 | <body> |
| 32 | 32 | <div class="container"> |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | <h2>Check if the rendering will be done on client side or server side</h2> |
| 152 | 152 | <h4> |
| 153 | 153 | <?php |
| 154 | - if (useServerSideRendering ()) { |
|
| 154 | + if (useServerSideRendering()) { |
|
| 155 | 155 | echo 'Server side rendering'; |
| 156 | 156 | } else { |
| 157 | 157 | echo 'Client side rendering'; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | <h2>Check if Calibre database path is not an URL</h2> |
| 168 | 168 | <h4> |
| 169 | 169 | <?php |
| 170 | - if (!preg_match ('#^http#', $database)) { |
|
| 170 | + if (!preg_match('#^http#', $database)) { |
|
| 171 | 171 | echo $name . ' OK'; |
| 172 | 172 | } else { |
| 173 | 173 | echo $name . ' Calibre path has to be local (no URL allowed)'; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | <h4> |
| 201 | 201 | <?php |
| 202 | 202 | try { |
| 203 | - $db = new PDO('sqlite:'. Base::getDbFileName($i)); |
|
| 203 | + $db = new PDO('sqlite:' . Base::getDbFileName($i)); |
|
| 204 | 204 | echo $name . ' OK'; |
| 205 | 205 | } catch (Exception $e) { |
| 206 | 206 | echo $name . ' If the file is readable, check your php configuration. Exception detail : ' . $e; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | <h4> |
| 214 | 214 | <?php |
| 215 | 215 | try { |
| 216 | - $db = new PDO('sqlite:'. Base::getDbFileName($i)); |
|
| 216 | + $db = new PDO('sqlite:' . Base::getDbFileName($i)); |
|
| 217 | 217 | $count = $db->query('select count(*) FROM sqlite_master WHERE type="table" AND name in ("books", "authors", "tags", "series")')->fetchColumn(); |
| 218 | 218 | if ($count == 4) { |
| 219 | 219 | echo $name . ' OK'; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $result->execute(); |
| 238 | 238 | while ($post = $result->fetchObject()) |
| 239 | 239 | { |
| 240 | - if (!is_file (Base::getDbDirectory($i) . $post->fullpath)) { |
|
| 240 | + if (!is_file(Base::getDbDirectory($i) . $post->fullpath)) { |
|
| 241 | 241 | echo '<p>' . Base::getDbDirectory($i) . $post->fullpath . '</p>'; |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | $err = getURLParam('err', -1); |
| 16 | 16 | $full = getURLParam('full'); |
| 17 | - $error = NULL; |
|
| 17 | + $error = null; |
|
| 18 | 18 | switch ($err) { |
| 19 | 19 | case 1 : |
| 20 | 20 | $error = 'Database error'; |
@@ -8,9 +8,9 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAllCustoms extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $customId = getURLParam ("custom", NULL); |
|
| 13 | + $customId = getURLParam("custom", NULL); |
|
| 14 | 14 | $columnType = CustomColumnType::createByCustomID($customId); |
| 15 | 15 | |
| 16 | 16 | $this->title = $columnType->getTitle(); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function InitializeContent () |
| 12 | 12 | { |
| 13 | - $customId = getURLParam ("custom", NULL); |
|
| 13 | + $customId = getURLParam ("custom", null); |
|
| 14 | 14 | $columnType = CustomColumnType::createByCustomID($customId); |
| 15 | 15 | |
| 16 | 16 | $this->title = $columnType->getTitle(); |
@@ -24,55 +24,55 @@ discard block |
||
| 24 | 24 | /* @var Entry[] */ |
| 25 | 25 | public $entryArray = array(); |
| 26 | 26 | |
| 27 | - public static function getPage ($pageId, $id, $query, $n) |
|
| 27 | + public static function getPage($pageId, $id, $query, $n) |
|
| 28 | 28 | { |
| 29 | 29 | switch ($pageId) { |
| 30 | 30 | case Base::PAGE_ALL_AUTHORS : |
| 31 | - return new PageAllAuthors ($id, $query, $n); |
|
| 31 | + return new PageAllAuthors($id, $query, $n); |
|
| 32 | 32 | case Base::PAGE_AUTHORS_FIRST_LETTER : |
| 33 | - return new PageAllAuthorsLetter ($id, $query, $n); |
|
| 33 | + return new PageAllAuthorsLetter($id, $query, $n); |
|
| 34 | 34 | case Base::PAGE_AUTHOR_DETAIL : |
| 35 | - return new PageAuthorDetail ($id, $query, $n); |
|
| 35 | + return new PageAuthorDetail($id, $query, $n); |
|
| 36 | 36 | case Base::PAGE_ALL_TAGS : |
| 37 | - return new PageAllTags ($id, $query, $n); |
|
| 37 | + return new PageAllTags($id, $query, $n); |
|
| 38 | 38 | case Base::PAGE_TAG_DETAIL : |
| 39 | - return new PageTagDetail ($id, $query, $n); |
|
| 39 | + return new PageTagDetail($id, $query, $n); |
|
| 40 | 40 | case Base::PAGE_ALL_LANGUAGES : |
| 41 | - return new PageAllLanguages ($id, $query, $n); |
|
| 41 | + return new PageAllLanguages($id, $query, $n); |
|
| 42 | 42 | case Base::PAGE_LANGUAGE_DETAIL : |
| 43 | - return new PageLanguageDetail ($id, $query, $n); |
|
| 43 | + return new PageLanguageDetail($id, $query, $n); |
|
| 44 | 44 | case Base::PAGE_ALL_CUSTOMS : |
| 45 | - return new PageAllCustoms ($id, $query, $n); |
|
| 45 | + return new PageAllCustoms($id, $query, $n); |
|
| 46 | 46 | case Base::PAGE_CUSTOM_DETAIL : |
| 47 | - return new PageCustomDetail ($id, $query, $n); |
|
| 47 | + return new PageCustomDetail($id, $query, $n); |
|
| 48 | 48 | case Base::PAGE_ALL_RATINGS : |
| 49 | - return new PageAllRating ($id, $query, $n); |
|
| 49 | + return new PageAllRating($id, $query, $n); |
|
| 50 | 50 | case Base::PAGE_RATING_DETAIL : |
| 51 | - return new PageRatingDetail ($id, $query, $n); |
|
| 51 | + return new PageRatingDetail($id, $query, $n); |
|
| 52 | 52 | case Base::PAGE_ALL_SERIES : |
| 53 | - return new PageAllSeries ($id, $query, $n); |
|
| 53 | + return new PageAllSeries($id, $query, $n); |
|
| 54 | 54 | case Base::PAGE_ALL_BOOKS : |
| 55 | - return new PageAllBooks ($id, $query, $n); |
|
| 55 | + return new PageAllBooks($id, $query, $n); |
|
| 56 | 56 | case Base::PAGE_ALL_BOOKS_LETTER: |
| 57 | - return new PageAllBooksLetter ($id, $query, $n); |
|
| 57 | + return new PageAllBooksLetter($id, $query, $n); |
|
| 58 | 58 | case Base::PAGE_ALL_RECENT_BOOKS : |
| 59 | - return new PageRecentBooks ($id, $query, $n); |
|
| 59 | + return new PageRecentBooks($id, $query, $n); |
|
| 60 | 60 | case Base::PAGE_SERIE_DETAIL : |
| 61 | - return new PageSerieDetail ($id, $query, $n); |
|
| 61 | + return new PageSerieDetail($id, $query, $n); |
|
| 62 | 62 | case Base::PAGE_OPENSEARCH_QUERY : |
| 63 | - return new PageQueryResult ($id, $query, $n); |
|
| 63 | + return new PageQueryResult($id, $query, $n); |
|
| 64 | 64 | case Base::PAGE_BOOK_DETAIL : |
| 65 | - return new PageBookDetail ($id, $query, $n); |
|
| 65 | + return new PageBookDetail($id, $query, $n); |
|
| 66 | 66 | case Base::PAGE_ALL_PUBLISHERS: |
| 67 | - return new PageAllPublishers ($id, $query, $n); |
|
| 67 | + return new PageAllPublishers($id, $query, $n); |
|
| 68 | 68 | case Base::PAGE_PUBLISHER_DETAIL : |
| 69 | - return new PagePublisherDetail ($id, $query, $n); |
|
| 69 | + return new PagePublisherDetail($id, $query, $n); |
|
| 70 | 70 | case Base::PAGE_ABOUT : |
| 71 | - return new PageAbout ($id, $query, $n); |
|
| 71 | + return new PageAbout($id, $query, $n); |
|
| 72 | 72 | case Base::PAGE_CUSTOMIZE : |
| 73 | - return new PageCustomize ($id, $query, $n); |
|
| 73 | + return new PageCustomize($id, $query, $n); |
|
| 74 | 74 | default: |
| 75 | - $page = new Page ($id, $query, $n); |
|
| 75 | + $page = new Page($id, $query, $n); |
|
| 76 | 76 | $page->idPage = "cops:catalog"; |
| 77 | 77 | return $page; |
| 78 | 78 | } |
@@ -85,96 +85,96 @@ discard block |
||
| 85 | 85 | $this->query = $pquery; |
| 86 | 86 | $this->n = $pn; |
| 87 | 87 | $this->favicon = $config['cops_icon']; |
| 88 | - $this->authorName = empty($config['cops_author_name']) ? utf8_encode('Sébastien Lucas') : $config['cops_author_name']; |
|
| 89 | - $this->authorUri = empty($config['cops_author_uri']) ? 'http://blog.slucas.fr' : $config['cops_author_uri']; |
|
| 90 | - $this->authorEmail = empty($config['cops_author_email']) ? '[email protected]' : $config['cops_author_email']; |
|
| 88 | + $this->authorName = empty($config['cops_author_name'])?utf8_encode('Sébastien Lucas'):$config['cops_author_name']; |
|
| 89 | + $this->authorUri = empty($config['cops_author_uri'])?'http://blog.slucas.fr':$config['cops_author_uri']; |
|
| 90 | + $this->authorEmail = empty($config['cops_author_email'])?'[email protected]':$config['cops_author_email']; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function InitializeContent () |
|
| 93 | + public function InitializeContent() |
|
| 94 | 94 | { |
| 95 | 95 | global $config; |
| 96 | 96 | $this->title = $config['cops_title_default']; |
| 97 | 97 | $this->subtitle = $config['cops_subtitle_default']; |
| 98 | - if (Base::noDatabaseSelected ()) { |
|
| 98 | + if (Base::noDatabaseSelected()) { |
|
| 99 | 99 | $i = 0; |
| 100 | - foreach (Base::getDbNameList () as $key) { |
|
| 101 | - $nBooks = Book::getBookCount ($i); |
|
| 102 | - array_push ($this->entryArray, new Entry ($key, "cops:{$i}:catalog", |
|
| 103 | - str_format (localize ("bookword", $nBooks), $nBooks), "text", |
|
| 104 | - array ( new LinkNavigation ("?" . DB . "={$i}")), "", $nBooks)); |
|
| 100 | + foreach (Base::getDbNameList() as $key) { |
|
| 101 | + $nBooks = Book::getBookCount($i); |
|
| 102 | + array_push($this->entryArray, new Entry($key, "cops:{$i}:catalog", |
|
| 103 | + str_format(localize("bookword", $nBooks), $nBooks), "text", |
|
| 104 | + array(new LinkNavigation("?" . DB . "={$i}")), "", $nBooks)); |
|
| 105 | 105 | $i++; |
| 106 | - Base::clearDb (); |
|
| 106 | + Base::clearDb(); |
|
| 107 | 107 | } |
| 108 | 108 | } else { |
| 109 | - if (!in_array (PageQueryResult::SCOPE_AUTHOR, getCurrentOption ('ignored_categories'))) { |
|
| 110 | - array_push ($this->entryArray, Author::getCount()); |
|
| 109 | + if (!in_array(PageQueryResult::SCOPE_AUTHOR, getCurrentOption('ignored_categories'))) { |
|
| 110 | + array_push($this->entryArray, Author::getCount()); |
|
| 111 | 111 | } |
| 112 | - if (!in_array (PageQueryResult::SCOPE_SERIES, getCurrentOption ('ignored_categories'))) { |
|
| 112 | + if (!in_array(PageQueryResult::SCOPE_SERIES, getCurrentOption('ignored_categories'))) { |
|
| 113 | 113 | $series = Serie::getCount(); |
| 114 | - if (!is_null ($series)) array_push ($this->entryArray, $series); |
|
| 114 | + if (!is_null($series)) array_push($this->entryArray, $series); |
|
| 115 | 115 | } |
| 116 | - if (!in_array (PageQueryResult::SCOPE_PUBLISHER, getCurrentOption ('ignored_categories'))) { |
|
| 116 | + if (!in_array(PageQueryResult::SCOPE_PUBLISHER, getCurrentOption('ignored_categories'))) { |
|
| 117 | 117 | $publisher = Publisher::getCount(); |
| 118 | - if (!is_null ($publisher)) array_push ($this->entryArray, $publisher); |
|
| 118 | + if (!is_null($publisher)) array_push($this->entryArray, $publisher); |
|
| 119 | 119 | } |
| 120 | - if (!in_array (PageQueryResult::SCOPE_TAG, getCurrentOption ('ignored_categories'))) { |
|
| 120 | + if (!in_array(PageQueryResult::SCOPE_TAG, getCurrentOption('ignored_categories'))) { |
|
| 121 | 121 | $tags = Tag::getCount(); |
| 122 | - if (!is_null ($tags)) array_push ($this->entryArray, $tags); |
|
| 122 | + if (!is_null($tags)) array_push($this->entryArray, $tags); |
|
| 123 | 123 | } |
| 124 | - if (!in_array (PageQueryResult::SCOPE_RATING, getCurrentOption ('ignored_categories'))) { |
|
| 124 | + if (!in_array(PageQueryResult::SCOPE_RATING, getCurrentOption('ignored_categories'))) { |
|
| 125 | 125 | $rating = Rating::getCount(); |
| 126 | - if (!is_null ($rating)) array_push ($this->entryArray, $rating); |
|
| 126 | + if (!is_null($rating)) array_push($this->entryArray, $rating); |
|
| 127 | 127 | } |
| 128 | - if (!in_array ("language", getCurrentOption ('ignored_categories'))) { |
|
| 128 | + if (!in_array("language", getCurrentOption('ignored_categories'))) { |
|
| 129 | 129 | $languages = Language::getCount(); |
| 130 | - if (!is_null ($languages)) array_push ($this->entryArray, $languages); |
|
| 130 | + if (!is_null($languages)) array_push($this->entryArray, $languages); |
|
| 131 | 131 | } |
| 132 | 132 | foreach ($config['cops_calibre_custom_column'] as $lookup) { |
| 133 | 133 | $customColumn = CustomColumnType::createByLookup($lookup); |
| 134 | - if (!is_null ($customColumn) && $customColumn->isSearchable()) { |
|
| 135 | - array_push ($this->entryArray, $customColumn->getCount()); |
|
| 134 | + if (!is_null($customColumn) && $customColumn->isSearchable()) { |
|
| 135 | + array_push($this->entryArray, $customColumn->getCount()); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | - $this->entryArray = array_merge ($this->entryArray, Book::getCount()); |
|
| 138 | + $this->entryArray = array_merge($this->entryArray, Book::getCount()); |
|
| 139 | 139 | |
| 140 | - if (Base::isMultipleDatabaseEnabled ()) $this->title = Base::getDbName (); |
|
| 140 | + if (Base::isMultipleDatabaseEnabled()) $this->title = Base::getDbName(); |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function isPaginated () |
|
| 144 | + public function isPaginated() |
|
| 145 | 145 | { |
| 146 | - return (getCurrentOption ("max_item_per_page") != -1 && |
|
| 146 | + return (getCurrentOption("max_item_per_page") != -1 && |
|
| 147 | 147 | $this->totalNumber != -1 && |
| 148 | - $this->totalNumber > getCurrentOption ("max_item_per_page")); |
|
| 148 | + $this->totalNumber > getCurrentOption("max_item_per_page")); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - public function getNextLink () |
|
| 151 | + public function getNextLink() |
|
| 152 | 152 | { |
| 153 | - $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ()); |
|
| 154 | - if (($this->n) * getCurrentOption ("max_item_per_page") < $this->totalNumber) { |
|
| 155 | - return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", localize ("paging.next.alternate")); |
|
| 153 | + $currentUrl = preg_replace("/\&n=.*?$/", "", "?" . getQueryString()); |
|
| 154 | + if (($this->n) * getCurrentOption("max_item_per_page") < $this->totalNumber) { |
|
| 155 | + return new LinkNavigation($currentUrl . "&n=" . ($this->n + 1), "next", localize("paging.next.alternate")); |
|
| 156 | 156 | } |
| 157 | 157 | return NULL; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public function getPrevLink () |
|
| 160 | + public function getPrevLink() |
|
| 161 | 161 | { |
| 162 | - $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ()); |
|
| 162 | + $currentUrl = preg_replace("/\&n=.*?$/", "", "?" . getQueryString()); |
|
| 163 | 163 | if ($this->n > 1) { |
| 164 | - return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", localize ("paging.previous.alternate")); |
|
| 164 | + return new LinkNavigation($currentUrl . "&n=" . ($this->n - 1), "previous", localize("paging.previous.alternate")); |
|
| 165 | 165 | } |
| 166 | 166 | return NULL; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - public function getMaxPage () |
|
| 169 | + public function getMaxPage() |
|
| 170 | 170 | { |
| 171 | - return ceil ($this->totalNumber / getCurrentOption ("max_item_per_page")); |
|
| 171 | + return ceil($this->totalNumber / getCurrentOption("max_item_per_page")); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function containsBook () |
|
| 174 | + public function containsBook() |
|
| 175 | 175 | { |
| 176 | - if (count ($this->entryArray) == 0) return false; |
|
| 177 | - if (get_class ($this->entryArray [0]) == "EntryBook") return true; |
|
| 176 | + if (count($this->entryArray) == 0) return false; |
|
| 177 | + if (get_class($this->entryArray [0]) == "EntryBook") return true; |
|
| 178 | 178 | return false; |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -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 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | if (($this->n) * getCurrentOption ("max_item_per_page") < $this->totalNumber) { |
| 155 | 155 | return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", localize ("paging.next.alternate")); |
| 156 | 156 | } |
| 157 | - return NULL; |
|
| 157 | + return null; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | public function getPrevLink () |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | if ($this->n > 1) { |
| 164 | 164 | return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", localize ("paging.previous.alternate")); |
| 165 | 165 | } |
| 166 | - return NULL; |
|
| 166 | + return null; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public function getMaxPage () |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageCustomDetail extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $customId = getURLParam ("custom", NULL); |
|
| 14 | - $custom = CustomColumn::createCustom ($customId, $this->idGet); |
|
| 15 | - $this->idPage = $custom->getEntryId (); |
|
| 13 | + $customId = getURLParam("custom", NULL); |
|
| 14 | + $custom = CustomColumn::createCustom($customId, $this->idGet); |
|
| 15 | + $this->idPage = $custom->getEntryId(); |
|
| 16 | 16 | $this->title = $custom->value; |
| 17 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByCustom ($custom, $this->idGet, $this->n); |
|
| 17 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByCustom($custom, $this->idGet, $this->n); |
|
| 18 | 18 | } |
| 19 | 19 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function InitializeContent () |
| 12 | 12 | { |
| 13 | - $customId = getURLParam ("custom", NULL); |
|
| 13 | + $customId = getURLParam ("custom", null); |
|
| 14 | 14 | $custom = CustomColumn::createCustom ($customId, $this->idGet); |
| 15 | 15 | $this->idPage = $custom->getEntryId (); |
| 16 | 16 | $this->title = $custom->value; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if ($post = $result->fetchObject()) { |
| 58 | 58 | return new CustomColumn ($id, $post->name, $this); |
| 59 | 59 | } |
| 60 | - return NULL; |
|
| 60 | + return null; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | protected function getAllCustomValuesFromDatabase() |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if ($post = $result->fetchObject()) { |
| 93 | 93 | return new CustomColumn($post->id, $post->name, $this); |
| 94 | 94 | } |
| 95 | - return new CustomColumn(NULL, localize("customcolumn.enum.unknown"), $this); |
|
| 95 | + return new CustomColumn(null, localize("customcolumn.enum.unknown"), $this); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public function isSearchable() |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $result = Base::getDb()->prepare(str_format("SELECT id, value AS name FROM {0} WHERE id = ?", $this->getTableName())); |
| 56 | 56 | $result->execute(array($id)); |
| 57 | 57 | if ($post = $result->fetchObject()) { |
| 58 | - return new CustomColumn ($id, $post->name, $this); |
|
| 58 | + return new CustomColumn($id, $post->name, $this); |
|
| 59 | 59 | } |
| 60 | 60 | return NULL; |
| 61 | 61 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | $entryArray = array(); |
| 70 | 70 | while ($post = $result->fetchObject()) { |
| 71 | 71 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 72 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id))); |
|
| 72 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id))); |
|
| 73 | 73 | |
| 74 | - $entry = new Entry ($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
|
| 74 | + $entry = new Entry($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
|
| 75 | 75 | |
| 76 | 76 | array_push($entryArray, $entry); |
| 77 | 77 | } |