@@ -8,15 +8,15 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAllBooksLetter extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - list ($this->entryArray, $this->totalNumber) = Book::getBooksByStartingLetter ($this->idGet, $this->n); |
|
| 14 | - $this->idPage = Book::getEntryIdByLetter ($this->idGet); |
|
| 13 | + list ($this->entryArray, $this->totalNumber) = Book::getBooksByStartingLetter($this->idGet, $this->n); |
|
| 14 | + $this->idPage = Book::getEntryIdByLetter($this->idGet); |
|
| 15 | 15 | |
| 16 | 16 | $count = $this->totalNumber; |
| 17 | 17 | if ($count == -1) |
| 18 | - $count = count ($this->entryArray); |
|
| 18 | + $count = count($this->entryArray); |
|
| 19 | 19 | |
| 20 | - $this->title = str_format (localize ("splitByLetter.letter"), str_format (localize ("bookword", $count), $count), $this->idGet); |
|
| 20 | + $this->title = str_format(localize("splitByLetter.letter"), str_format(localize("bookword", $count), $count), $this->idGet); |
|
| 21 | 21 | } |
| 22 | 22 | } |
@@ -9,10 +9,10 @@ |
||
| 9 | 9 | class LinkNavigation extends Link |
| 10 | 10 | { |
| 11 | 11 | public function __construct($phref, $prel = NULL, $ptitle = NULL) { |
| 12 | - parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
|
| 13 | - if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); |
|
| 14 | - if (!preg_match ("#^\?(.*)#", $this->href) && !empty ($this->href)) $this->href = "?" . $this->href; |
|
| 15 | - if (preg_match ("/(bookdetail|getJSON).php/", parent::getScriptName())) { |
|
| 12 | + parent::__construct($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); |
|
| 13 | + if (!is_null(GetUrlParam(DB))) $this->href = addURLParameter($this->href, DB, GetUrlParam(DB)); |
|
| 14 | + if (!preg_match("#^\?(.*)#", $this->href) && !empty ($this->href)) $this->href = "?" . $this->href; |
|
| 15 | + if (preg_match("/(bookdetail|getJSON).php/", parent::getScriptName())) { |
|
| 16 | 16 | $this->href = "index.php" . $this->href; |
| 17 | 17 | } else { |
| 18 | 18 | $this->href = parent::getScriptName() . $this->href; |
@@ -31,23 +31,23 @@ discard block |
||
| 31 | 31 | Publisher::ALL_PUBLISHERS_ID => 'images/publisher.png' |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - public function getUpdatedTime () { |
|
| 35 | - if (!is_null ($this->localUpdated)) { |
|
| 36 | - return date (DATE_ATOM, $this->localUpdated); |
|
| 34 | + public function getUpdatedTime() { |
|
| 35 | + if (!is_null($this->localUpdated)) { |
|
| 36 | + return date(DATE_ATOM, $this->localUpdated); |
|
| 37 | 37 | } |
| 38 | - if (is_null (self::$updated)) { |
|
| 38 | + if (is_null(self::$updated)) { |
|
| 39 | 39 | self::$updated = time(); |
| 40 | 40 | } |
| 41 | - return date (DATE_ATOM, self::$updated); |
|
| 41 | + return date(DATE_ATOM, self::$updated); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function getNavLink () { |
|
| 44 | + public function getNavLink() { |
|
| 45 | 45 | foreach ($this->linkArray as $link) { |
| 46 | 46 | /* @var $link LinkNavigation */ |
| 47 | 47 | |
| 48 | 48 | if ($link->type != Link::OPDS_NAVIGATION_TYPE) { continue; } |
| 49 | 49 | |
| 50 | - return $link->hrefXhtml (); |
|
| 50 | + return $link->hrefXhtml(); |
|
| 51 | 51 | } |
| 52 | 52 | return "#"; |
| 53 | 53 | } |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | foreach (self::$icons as $reg => $image) |
| 68 | 68 | { |
| 69 | - if (preg_match ("/" . $reg . "/", $pid)) { |
|
| 70 | - array_push ($this->linkArray, new Link (getUrlWithVersion ($image), "image/png", Link::OPDS_THUMBNAIL_TYPE)); |
|
| 69 | + if (preg_match("/" . $reg . "/", $pid)) { |
|
| 70 | + array_push($this->linkArray, new Link(getUrlWithVersion($image), "image/png", Link::OPDS_THUMBNAIL_TYPE)); |
|
| 71 | 71 | break; |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if (!is_null (GetUrlParam (DB))) $this->id = str_replace ("cops:", "cops:" . GetUrlParam (DB) . ":", $this->id); |
|
| 76 | + if (!is_null(GetUrlParam(DB))) $this->id = str_replace("cops:", "cops:" . GetUrlParam(DB) . ":", $this->id); |
|
| 77 | 77 | } |
| 78 | 78 | } |
@@ -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); |
@@ -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 | } |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | require_once dirname(__FILE__) . '/config.php'; |
| 4 | 4 | require_once dirname(__FILE__) . '/base.php'; |
| 5 | 5 | |
| 6 | -function checkConfiguration () { |
|
| 6 | +function checkConfiguration() { |
|
| 7 | 7 | global $config; |
| 8 | 8 | |
| 9 | - if (is_null ($config['cops_mail_configuration']) || |
|
| 10 | - !is_array ($config['cops_mail_configuration']) || |
|
| 9 | + if (is_null($config['cops_mail_configuration']) || |
|
| 10 | + !is_array($config['cops_mail_configuration']) || |
|
| 11 | 11 | empty ($config['cops_mail_configuration']["smtp.host"]) || |
| 12 | 12 | empty ($config['cops_mail_configuration']["address.from"])) { |
| 13 | 13 | return "NOK. bad configuration."; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | return False; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -function checkRequest ($idData, $emailDest) { |
|
| 18 | +function checkRequest($idData, $emailDest) { |
|
| 19 | 19 | if (empty ($idData)) { |
| 20 | 20 | return 'No data sent.'; |
| 21 | 21 | } |
@@ -29,22 +29,22 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | global $config; |
| 31 | 31 | |
| 32 | -if ($error = checkConfiguration ()) { |
|
| 32 | +if ($error = checkConfiguration()) { |
|
| 33 | 33 | echo $error; |
| 34 | 34 | exit; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $idData = $_REQUEST["data"]; |
| 38 | 38 | $emailDest = $_REQUEST["email"]; |
| 39 | -if ($error = checkRequest ($idData, $emailDest)) { |
|
| 39 | +if ($error = checkRequest($idData, $emailDest)) { |
|
| 40 | 40 | echo $error; |
| 41 | 41 | exit; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $book = Book::getBookByDataId($idData); |
| 45 | -$data = $book->getDataById ($idData); |
|
| 45 | +$data = $book->getDataById($idData); |
|
| 46 | 46 | |
| 47 | -if (filesize ($data->getLocalPath ()) > 10 * 1024 * 1024) { |
|
| 47 | +if (filesize($data->getLocalPath()) > 10 * 1024 * 1024) { |
|
| 48 | 48 | echo 'Attachment too big'; |
| 49 | 49 | exit; |
| 50 | 50 | } |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | $mail->From = $config['cops_mail_configuration']["address.from"]; |
| 67 | 67 | $mail->FromName = $config['cops_title_default']; |
| 68 | 68 | |
| 69 | -foreach (explode (";", $emailDest) as $emailAddress) { |
|
| 69 | +foreach (explode(";", $emailDest) as $emailAddress) { |
|
| 70 | 70 | if (empty ($emailAddress)) { continue; } |
| 71 | 71 | $mail->AddAddress($emailAddress); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | -$mail->AddAttachment($data->getLocalPath ()); |
|
| 74 | +$mail->AddAttachment($data->getLocalPath()); |
|
| 75 | 75 | |
| 76 | 76 | $mail->IsHTML(true); |
| 77 | 77 | $mail->CharSet = "UTF-8"; |
@@ -79,15 +79,15 @@ discard block |
||
| 79 | 79 | if (!empty ($config['cops_mail_configuration']["subject"])) { |
| 80 | 80 | $mail->Subject = $config['cops_mail_configuration']["subject"]; |
| 81 | 81 | } |
| 82 | -$mail->Subject .= $data->getUpdatedFilename (); |
|
| 83 | -$mail->Body = "<h1>" . $book->title . "</h1><h2>" . $book->getAuthorsName () . "</h2>" . $book->getComment (); |
|
| 82 | +$mail->Subject .= $data->getUpdatedFilename(); |
|
| 83 | +$mail->Body = "<h1>" . $book->title . "</h1><h2>" . $book->getAuthorsName() . "</h2>" . $book->getComment(); |
|
| 84 | 84 | $mail->AltBody = "Sent by COPS"; |
| 85 | 85 | |
| 86 | 86 | if (!$mail->Send()) { |
| 87 | - echo localize ("mail.messagenotsent"); |
|
| 87 | + echo localize("mail.messagenotsent"); |
|
| 88 | 88 | echo 'Mailer Error: ' . $mail->ErrorInfo; |
| 89 | 89 | exit; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | -echo localize ("mail.messagesent"); |
|
| 92 | +echo localize("mail.messagesent"); |
|
| 93 | 93 | |
@@ -12,20 +12,20 @@ |
||
| 12 | 12 | require dirname(__FILE__) . '/config_local.php'; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | -$remote_user = array_key_exists('PHP_AUTH_USER', $_SERVER) ? $_SERVER['PHP_AUTH_USER'] : ''; |
|
| 15 | +$remote_user = array_key_exists('PHP_AUTH_USER', $_SERVER)?$_SERVER['PHP_AUTH_USER']:''; |
|
| 16 | 16 | // Clean username, only allow a-z, A-Z, 0-9, -_ chars |
| 17 | -$remote_user = preg_replace( '/[^a-zA-Z0-9_-]/', '', $remote_user); |
|
| 17 | +$remote_user = preg_replace('/[^a-zA-Z0-9_-]/', '', $remote_user); |
|
| 18 | 18 | $user_config_file = 'config_local.' . $remote_user . '.php'; |
| 19 | 19 | if (file_exists(dirname(__FILE__) . '/' . $user_config_file) && (php_sapi_name() !== 'cli')) { |
| 20 | 20 | require dirname(__FILE__) . '/' . $user_config_file; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if(!is_null($config['cops_basic_authentication']) && |
|
| 23 | +if (!is_null($config['cops_basic_authentication']) && |
|
| 24 | 24 | is_array($config['cops_basic_authentication'])) |
| 25 | 25 | { |
| 26 | 26 | if (!isset($_SERVER['PHP_AUTH_USER']) || |
| 27 | 27 | (isset($_SERVER['PHP_AUTH_USER']) && |
| 28 | - ($_SERVER['PHP_AUTH_USER']!=$config['cops_basic_authentication']['username'] || |
|
| 28 | + ($_SERVER['PHP_AUTH_USER'] != $config['cops_basic_authentication']['username'] || |
|
| 29 | 29 | $_SERVER['PHP_AUTH_PW'] != $config['cops_basic_authentication']['password']))) |
| 30 | 30 | { |
| 31 | 31 | header('WWW-Authenticate: Basic realm="COPS Authentication"'); |
@@ -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 | } |
@@ -7,55 +7,55 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Silly thing because PHP forbid string concatenation in class const |
| 10 | -define ('SQL_BOOKS_LEFT_JOIN', 'left outer join comments on comments.book = books.id |
|
| 10 | +define('SQL_BOOKS_LEFT_JOIN', 'left outer join comments on comments.book = books.id |
|
| 11 | 11 | left outer join books_ratings_link on books_ratings_link.book = books.id |
| 12 | 12 | left outer join ratings on books_ratings_link.rating = ratings.id '); |
| 13 | -define ('SQL_BOOKS_ALL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' order by books.sort '); |
|
| 14 | -define ('SQL_BOOKS_BY_PUBLISHER', 'select {0} from books_publishers_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 13 | +define('SQL_BOOKS_ALL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' order by books.sort '); |
|
| 14 | +define('SQL_BOOKS_BY_PUBLISHER', 'select {0} from books_publishers_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 15 | 15 | where books_publishers_link.book = books.id and publisher = ? {1} order by publisher'); |
| 16 | -define ('SQL_BOOKS_BY_FIRST_LETTER', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 16 | +define('SQL_BOOKS_BY_FIRST_LETTER', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 17 | 17 | where upper (books.sort) like ? order by books.sort'); |
| 18 | -define ('SQL_BOOKS_BY_AUTHOR', 'select {0} from books_authors_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 18 | +define('SQL_BOOKS_BY_AUTHOR', 'select {0} from books_authors_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 19 | 19 | left outer join books_series_link on books_series_link.book = books.id |
| 20 | 20 | where books_authors_link.book = books.id and author = ? {1} order by series desc, series_index asc, pubdate asc'); |
| 21 | -define ('SQL_BOOKS_BY_SERIE', 'select {0} from books_series_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 21 | +define('SQL_BOOKS_BY_SERIE', 'select {0} from books_series_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 22 | 22 | where books_series_link.book = books.id and series = ? {1} order by series_index'); |
| 23 | -define ('SQL_BOOKS_BY_TAG', 'select {0} from books_tags_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 23 | +define('SQL_BOOKS_BY_TAG', 'select {0} from books_tags_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 24 | 24 | where books_tags_link.book = books.id and tag = ? {1} order by sort'); |
| 25 | -define ('SQL_BOOKS_BY_LANGUAGE', 'select {0} from books_languages_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 25 | +define('SQL_BOOKS_BY_LANGUAGE', 'select {0} from books_languages_link, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 26 | 26 | where books_languages_link.book = books.id and lang_code = ? {1} order by sort'); |
| 27 | -define ('SQL_BOOKS_BY_CUSTOM', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 27 | +define('SQL_BOOKS_BY_CUSTOM', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 28 | 28 | where {2}.book = books.id and {2}.{3} = ? {1} order by sort'); |
| 29 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_TRUE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 29 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_TRUE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 30 | 30 | where {2}.book = books.id and {2}.value = 1 {1} order by sort'); |
| 31 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_FALSE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 31 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_FALSE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 32 | 32 | where {2}.book = books.id and {2}.value = 0 {1} order by sort'); |
| 33 | -define ('SQL_BOOKS_BY_CUSTOM_BOOL_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 33 | +define('SQL_BOOKS_BY_CUSTOM_BOOL_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 34 | 34 | where books.id not in (select book from {2}) {1} order by sort'); |
| 35 | -define ('SQL_BOOKS_BY_CUSTOM_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 35 | +define('SQL_BOOKS_BY_CUSTOM_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 36 | 36 | left join {2} on {2}.book = books.id |
| 37 | 37 | left join {3} on {3}.id = {2}.{4} |
| 38 | 38 | where {3}.value = ? order by sort'); |
| 39 | -define ('SQL_BOOKS_BY_CUSTOM_RATING_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 39 | +define('SQL_BOOKS_BY_CUSTOM_RATING_NULL', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 40 | 40 | left join {2} on {2}.book = books.id |
| 41 | 41 | left join {3} on {3}.id = {2}.{4} |
| 42 | 42 | where ((books.id not in (select {2}.book from {2})) or ({3}.value = 0)) {1} order by sort'); |
| 43 | -define ('SQL_BOOKS_BY_CUSTOM_DATE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 43 | +define('SQL_BOOKS_BY_CUSTOM_DATE', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 44 | 44 | where {2}.book = books.id and date({2}.value) = ? {1} order by sort'); |
| 45 | -define ('SQL_BOOKS_BY_CUSTOM_DIRECT', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 45 | +define('SQL_BOOKS_BY_CUSTOM_DIRECT', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 46 | 46 | where {2}.book = books.id and {2}.value = ? {1} order by sort'); |
| 47 | -define ('SQL_BOOKS_BY_CUSTOM_DIRECT_ID', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 47 | +define('SQL_BOOKS_BY_CUSTOM_DIRECT_ID', 'select {0} from {2}, books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 48 | 48 | where {2}.book = books.id and {2}.id = ? {1} order by sort'); |
| 49 | -define ('SQL_BOOKS_QUERY', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 49 | +define('SQL_BOOKS_QUERY', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 50 | 50 | where ( |
| 51 | 51 | exists (select null from authors, books_authors_link where book = books.id and author = authors.id and authors.name like ?) or |
| 52 | 52 | exists (select null from tags, books_tags_link where book = books.id and tag = tags.id and tags.name like ?) or |
| 53 | 53 | exists (select null from series, books_series_link on book = books.id and books_series_link.series = series.id and series.name like ?) or |
| 54 | 54 | exists (select null from publishers, books_publishers_link where book = books.id and books_publishers_link.publisher = publishers.id and publishers.name like ?) or |
| 55 | 55 | title like ?) {1} order by books.sort'); |
| 56 | -define ('SQL_BOOKS_RECENT', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 56 | +define('SQL_BOOKS_RECENT', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 57 | 57 | where 1=1 {1} order by timestamp desc limit '); |
| 58 | -define ('SQL_BOOKS_BY_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 58 | +define('SQL_BOOKS_BY_RATING', 'select {0} from books ' . SQL_BOOKS_LEFT_JOIN . ' |
|
| 59 | 59 | where books_ratings_link.book = books.id and ratings.id = ? {1} order by sort'); |
| 60 | 60 | |
| 61 | 61 | class Book extends Base |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | public $serie = NULL; |
| 106 | 106 | public $tags = NULL; |
| 107 | 107 | public $languages = NULL; |
| 108 | - public $format = array (); |
|
| 108 | + public $format = array(); |
|
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | public function __construct($line) { |
@@ -127,24 +127,24 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function getEntryId() { |
| 130 | - return self::ALL_BOOKS_UUID.':'.$this->uuid; |
|
| 130 | + return self::ALL_BOOKS_UUID . ':' . $this->uuid; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public static function getEntryIdByLetter ($startingLetter) { |
|
| 134 | - return self::ALL_BOOKS_ID.':letter:'.$startingLetter; |
|
| 133 | + public static function getEntryIdByLetter($startingLetter) { |
|
| 134 | + return self::ALL_BOOKS_ID . ':letter:' . $startingLetter; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function getUri () { |
|
| 138 | - return '?page='.parent::PAGE_BOOK_DETAIL.'&id=' . $this->id; |
|
| 137 | + public function getUri() { |
|
| 138 | + return '?page=' . parent::PAGE_BOOK_DETAIL . '&id=' . $this->id; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function getDetailUrl () { |
|
| 141 | + public function getDetailUrl() { |
|
| 142 | 142 | $urlParam = $this->getUri(); |
| 143 | - if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam (DB)); |
|
| 143 | + if (!is_null(GetUrlParam(DB))) $urlParam = addURLParameter($urlParam, DB, GetUrlParam(DB)); |
|
| 144 | 144 | return 'index.php' . $urlParam; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - public function getTitle () { |
|
| 147 | + public function getTitle() { |
|
| 148 | 148 | return $this->title; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -153,22 +153,22 @@ discard block |
||
| 153 | 153 | /** |
| 154 | 154 | * @return Author[] |
| 155 | 155 | */ |
| 156 | - public function getAuthors () { |
|
| 156 | + public function getAuthors() { |
|
| 157 | 157 | if (is_null($this->authors)) { |
| 158 | 158 | $this->authors = Author::getAuthorByBookId($this->id); |
| 159 | 159 | } |
| 160 | 160 | return $this->authors; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - public function getAuthorsName () { |
|
| 164 | - return implode(', ', array_map(function ($author) { return $author->name; }, $this->getAuthors())); |
|
| 163 | + public function getAuthorsName() { |
|
| 164 | + return implode(', ', array_map(function($author) { return $author->name; }, $this->getAuthors())); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - public function getAuthorsSort () { |
|
| 168 | - return implode(', ', array_map(function ($author) { return $author->sort; }, $this->getAuthors())); |
|
| 167 | + public function getAuthorsSort() { |
|
| 168 | + return implode(', ', array_map(function($author) { return $author->sort; }, $this->getAuthors())); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - public function getPublisher () { |
|
| 171 | + public function getPublisher() { |
|
| 172 | 172 | if (is_null($this->publisher)) { |
| 173 | 173 | $this->publisher = Publisher::getPublisherByBookId($this->id); |
| 174 | 174 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @return Tag[] |
| 208 | 208 | */ |
| 209 | 209 | public function getTags() { |
| 210 | - if (is_null ($this->tags)) { |
|
| 210 | + if (is_null($this->tags)) { |
|
| 211 | 211 | $this->tags = array(); |
| 212 | 212 | |
| 213 | 213 | $result = parent::getDb()->prepare('select tags.id as id, name |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | public function getTagsName() { |
| 228 | - return implode(', ', array_map(function ($tag) { return $tag->name; }, $this->getTags())); |
|
| 228 | + return implode(', ', array_map(function($tag) { return $tag->name; }, $this->getTags())); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | public function getDataById($idData) |
| 279 | 279 | { |
| 280 | - $reduced = array_filter($this->getDatas(), function ($data) use ($idData) { |
|
| 280 | + $reduced = array_filter($this->getDatas(), function($data) use ($idData) { |
|
| 281 | 281 | return $data->id == $idData; |
| 282 | 282 | }); |
| 283 | 283 | return reset($reduced); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | if (empty ($this->pubdate)) { |
| 302 | 302 | return ''; |
| 303 | 303 | } |
| 304 | - $dateY = (int) substr($this->pubdate, 0, 4); |
|
| 304 | + $dateY = (int)substr($this->pubdate, 0, 4); |
|
| 305 | 305 | if ($dateY > 102) { |
| 306 | 306 | return str_pad($dateY, 4, '0', STR_PAD_LEFT); |
| 307 | 307 | } |
@@ -310,8 +310,8 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | public function getComment($withSerie = true) { |
| 312 | 312 | $addition = ''; |
| 313 | - $se = $this->getSerie (); |
|
| 314 | - if (!is_null ($se) && $withSerie) { |
|
| 313 | + $se = $this->getSerie(); |
|
| 314 | + if (!is_null($se) && $withSerie) { |
|
| 315 | 315 | $addition = $addition . '<strong>' . localize('content.series') . '</strong>' . str_format(localize('content.series.data'), $this->seriesIndex, htmlspecialchars($se->name)) . "<br />\n"; |
| 316 | 316 | } |
| 317 | 317 | if (preg_match('/<\/(div|p|a|span)>/', $this->comment)) |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | public function getDataFormat($format) { |
| 328 | - $reduced = array_filter($this->getDatas(), function ($data) use ($format) { |
|
| 328 | + $reduced = array_filter($this->getDatas(), function($data) use ($format) { |
|
| 329 | 329 | return $data->format == $format; |
| 330 | 330 | }); |
| 331 | 331 | return reset($reduced); |
@@ -346,11 +346,11 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | if ($relative) |
| 348 | 348 | { |
| 349 | - return $this->relativePath.'/'.$file; |
|
| 349 | + return $this->relativePath . '/' . $file; |
|
| 350 | 350 | } |
| 351 | 351 | else |
| 352 | 352 | { |
| 353 | - return $this->path.'/'.$file; |
|
| 353 | + return $this->path . '/' . $file; |
|
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | $epub->Authors($authorArray); |
| 372 | 372 | $epub->Language($this->getLanguages()); |
| 373 | - $epub->Description ($this->getComment(false)); |
|
| 373 | + $epub->Description($this->getComment(false)); |
|
| 374 | 374 | $epub->Subjects($this->getTagsName()); |
| 375 | 375 | $epub->Cover2($this->getFilePath('jpg'), 'image/jpeg'); |
| 376 | 376 | $epub->Calibre($this->uuid); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $epub->SerieIndex($this->seriesIndex); |
| 381 | 381 | } |
| 382 | 382 | $filename = $data->getUpdatedFilenameEpub(); |
| 383 | - if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) { |
|
| 383 | + if ($config['cops_provide_kepub'] == '1' && preg_match('/Kobo/', $_SERVER['HTTP_USER_AGENT'])) { |
|
| 384 | 384 | $epub->updateForKepub(); |
| 385 | 385 | $filename = $data->getUpdatedFilenameKepub(); |
| 386 | 386 | } |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | if (!is_null($width)) { |
| 407 | 407 | $nw = $width; |
| 408 | 408 | if ($nw >= $w) { return false; } |
| 409 | - $nh = ($nw*$h)/$w; |
|
| 409 | + $nh = ($nw * $h) / $w; |
|
| 410 | 410 | } else { |
| 411 | 411 | $nh = $height; |
| 412 | 412 | if ($nh >= $h) { return false; } |
| 413 | - $nw = ($nh*$w)/$h; |
|
| 413 | + $nw = ($nh * $w) / $h; |
|
| 414 | 414 | } |
| 415 | 415 | } else { |
| 416 | 416 | return false; |
@@ -418,16 +418,16 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | //draw the image |
| 420 | 420 | $src_img = imagecreatefromjpeg($file); |
| 421 | - $dst_img = imagecreatetruecolor($nw,$nh); |
|
| 422 | - imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h);//resizing the image |
|
| 423 | - imagejpeg($dst_img,$outputfile,80); |
|
| 421 | + $dst_img = imagecreatetruecolor($nw, $nh); |
|
| 422 | + imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h); //resizing the image |
|
| 423 | + imagejpeg($dst_img, $outputfile, 80); |
|
| 424 | 424 | imagedestroy($src_img); |
| 425 | 425 | imagedestroy($dst_img); |
| 426 | 426 | |
| 427 | 427 | return true; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - public function getLinkArray () |
|
| 430 | + public function getLinkArray() |
|
| 431 | 431 | { |
| 432 | 432 | $linkArray = array(); |
| 433 | 433 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | $serie = $this->getSerie(); |
| 455 | - if (!is_null ($serie)) { |
|
| 455 | + if (!is_null($serie)) { |
|
| 456 | 456 | array_push($linkArray, new LinkNavigation($serie->getUri(), 'related', str_format(localize('content.series.data'), $this->seriesIndex, $serie->name))); |
| 457 | 457 | } |
| 458 | 458 | |
@@ -477,13 +477,13 @@ discard block |
||
| 477 | 477 | $entry = new Entry(localize('allbooks.title'), |
| 478 | 478 | self::ALL_BOOKS_ID, |
| 479 | 479 | str_format(localize('allbooks.alphabetical', $nBooks), $nBooks), 'text', |
| 480 | - array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
| 480 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS)), '', $nBooks); |
|
| 481 | 481 | array_push($result, $entry); |
| 482 | 482 | if ($config['cops_recentbooks_limit'] > 0) { |
| 483 | 483 | $entry = new Entry(localize('recent.title'), |
| 484 | 484 | self::ALL_RECENT_BOOKS_ID, |
| 485 | 485 | str_format(localize('recent.list'), $config['cops_recentbooks_limit']), 'text', |
| 486 | - array ( new LinkNavigation ('?page='.parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
| 486 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_RECENT_BOOKS)), '', $config['cops_recentbooks_limit']); |
|
| 487 | 487 | array_push($result, $entry); |
| 488 | 488 | } |
| 489 | 489 | return $result; |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | public static function getBooks($n) { |
| 582 | - list ($entryArray, $totalNumber) = self::getEntryArray(self::SQL_BOOKS_ALL , array (), $n); |
|
| 582 | + list ($entryArray, $totalNumber) = self::getEntryArray(self::SQL_BOOKS_ALL, array(), $n); |
|
| 583 | 583 | return array($entryArray, $totalNumber); |
| 584 | 584 | } |
| 585 | 585 | |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | { |
| 597 | 597 | array_push($entryArray, new Entry($post->title, Book::getEntryIdByLetter($post->title), |
| 598 | 598 | str_format(localize('bookword', $post->count), $post->count), 'text', |
| 599 | - array(new LinkNavigation('?page='.parent::PAGE_ALL_BOOKS_LETTER.'&id='. rawurlencode($post->title))), '', $post->count)); |
|
| 599 | + array(new LinkNavigation('?page=' . parent::PAGE_ALL_BOOKS_LETTER . '&id=' . rawurlencode($post->title))), '', $post->count)); |
|
| 600 | 600 | } |
| 601 | 601 | return $entryArray; |
| 602 | 602 | } |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | |
| 622 | 622 | public static function getAllRecentBooks() { |
| 623 | 623 | global $config; |
| 624 | - list ($entryArray, ) = self::getEntryArray(self::SQL_BOOKS_RECENT . $config['cops_recentbooks_limit'], array(), -1); |
|
| 624 | + list ($entryArray,) = self::getEntryArray(self::SQL_BOOKS_RECENT . $config['cops_recentbooks_limit'], array(), -1); |
|
| 625 | 625 | return $entryArray; |
| 626 | 626 | } |
| 627 | 627 | |