@@ -8,8 +8,8 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageAbout extends Page |
| 10 | 10 | { |
| 11 | - public function InitializeContent () |
|
| 11 | + public function InitializeContent() |
|
| 12 | 12 | { |
| 13 | - $this->title = localize ("about.title"); |
|
| 13 | + $this->title = localize("about.title"); |
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $id = $date->format("Y-m-d"); |
| 50 | 50 | |
| 51 | 51 | $entryPContent = str_format(localize("bookword", $post->count), $post->count); |
| 52 | - $entryPLinkArray = array(new LinkNavigation ($this->getUri($id))); |
|
| 52 | + $entryPLinkArray = array(new LinkNavigation($this->getUri($id))); |
|
| 53 | 53 | |
| 54 | 54 | $entry = new Entry($date->format(localize("customcolumn.date.format")), $this->getEntryId($id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count); |
| 55 | 55 | |
@@ -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); |
@@ -14,52 +14,52 @@ discard block |
||
| 14 | 14 | * @param Book $book |
| 15 | 15 | * @return array |
| 16 | 16 | */ |
| 17 | - public static function getBookContentArray ($book) { |
|
| 17 | + public static function getBookContentArray($book) { |
|
| 18 | 18 | global $config; |
| 19 | 19 | $i = 0; |
| 20 | - $preferedData = array (); |
|
| 20 | + $preferedData = array(); |
|
| 21 | 21 | foreach ($config['cops_prefered_format'] as $format) |
| 22 | 22 | { |
| 23 | 23 | if ($i == 2) { break; } |
| 24 | - if ($data = $book->getDataFormat ($format)) { |
|
| 24 | + if ($data = $book->getDataFormat($format)) { |
|
| 25 | 25 | $i++; |
| 26 | - array_push ($preferedData, array ("url" => $data->getHtmlLink (), "name" => $format)); |
|
| 26 | + array_push($preferedData, array("url" => $data->getHtmlLink(), "name" => $format)); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $publisher = $book->getPublisher(); |
| 31 | - if (is_null ($publisher)) { |
|
| 31 | + if (is_null($publisher)) { |
|
| 32 | 32 | $pn = ""; |
| 33 | 33 | $pu = ""; |
| 34 | 34 | } else { |
| 35 | 35 | $pn = $publisher->name; |
| 36 | - $link = new LinkNavigation ($publisher->getUri ()); |
|
| 37 | - $pu = $link->hrefXhtml (); |
|
| 36 | + $link = new LinkNavigation($publisher->getUri()); |
|
| 37 | + $pu = $link->hrefXhtml(); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $serie = $book->getSerie (); |
|
| 41 | - if (is_null ($serie)) { |
|
| 40 | + $serie = $book->getSerie(); |
|
| 41 | + if (is_null($serie)) { |
|
| 42 | 42 | $sn = ""; |
| 43 | 43 | $scn = ""; |
| 44 | 44 | $su = ""; |
| 45 | 45 | } else { |
| 46 | 46 | $sn = $serie->name; |
| 47 | - $scn = str_format (localize ("content.series.data"), $book->seriesIndex, $serie->name); |
|
| 48 | - $link = new LinkNavigation ($serie->getUri ()); |
|
| 49 | - $su = $link->hrefXhtml (); |
|
| 47 | + $scn = str_format(localize("content.series.data"), $book->seriesIndex, $serie->name); |
|
| 48 | + $link = new LinkNavigation($serie->getUri()); |
|
| 49 | + $su = $link->hrefXhtml(); |
|
| 50 | 50 | } |
| 51 | 51 | $cc = $book->getCustomColumnValues($config['cops_calibre_custom_column_list'], true); |
| 52 | 52 | |
| 53 | - return array ("id" => $book->id, |
|
| 53 | + return array("id" => $book->id, |
|
| 54 | 54 | "hasCover" => $book->hasCover, |
| 55 | 55 | "preferedData" => $preferedData, |
| 56 | - "rating" => $book->getRating (), |
|
| 56 | + "rating" => $book->getRating(), |
|
| 57 | 57 | "publisherName" => $pn, |
| 58 | 58 | "publisherurl" => $pu, |
| 59 | - "pubDate" => $book->getPubDate (), |
|
| 60 | - "languagesName" => $book->getLanguages (), |
|
| 61 | - "authorsName" => $book->getAuthorsName (), |
|
| 62 | - "tagsName" => $book->getTagsName (), |
|
| 59 | + "pubDate" => $book->getPubDate(), |
|
| 60 | + "languagesName" => $book->getLanguages(), |
|
| 61 | + "authorsName" => $book->getAuthorsName(), |
|
| 62 | + "tagsName" => $book->getTagsName(), |
|
| 63 | 63 | "seriesName" => $sn, |
| 64 | 64 | "seriesIndex" => $book->seriesIndex, |
| 65 | 65 | "seriesCompleteName" => $scn, |
@@ -71,85 +71,85 @@ discard block |
||
| 71 | 71 | * @param Book $book |
| 72 | 72 | * @return array |
| 73 | 73 | */ |
| 74 | - public static function getFullBookContentArray ($book) { |
|
| 74 | + public static function getFullBookContentArray($book) { |
|
| 75 | 75 | global $config; |
| 76 | - $out = self::getBookContentArray ($book); |
|
| 77 | - $database = GetUrlParam (DB); |
|
| 78 | - |
|
| 79 | - $out ["coverurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml (); |
|
| 80 | - $out ["thumbnailurl"] = Data::getLink ($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml (); |
|
| 81 | - $out ["content"] = $book->getComment (false); |
|
| 82 | - $out ["datas"] = array (); |
|
| 83 | - $dataKindle = $book->GetMostInterestingDataToSendToKindle (); |
|
| 76 | + $out = self::getBookContentArray($book); |
|
| 77 | + $database = GetUrlParam(DB); |
|
| 78 | + |
|
| 79 | + $out ["coverurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml(); |
|
| 80 | + $out ["thumbnailurl"] = Data::getLink($book, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, $config['cops_html_thumbnail_height'] * 2)->hrefXhtml(); |
|
| 81 | + $out ["content"] = $book->getComment(false); |
|
| 82 | + $out ["datas"] = array(); |
|
| 83 | + $dataKindle = $book->GetMostInterestingDataToSendToKindle(); |
|
| 84 | 84 | foreach ($book->getDatas() as $data) { |
| 85 | - $tab = array ("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink (), "mail" => 0, "readerUrl" => ""); |
|
| 86 | - if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) { |
|
| 85 | + $tab = array("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink(), "mail" => 0, "readerUrl" => ""); |
|
| 86 | + if (!empty ($config['cops_mail_configuration']) && !is_null($dataKindle) && $data->id == $dataKindle->id) { |
|
| 87 | 87 | $tab ["mail"] = 1; |
| 88 | 88 | } |
| 89 | 89 | if ($data->format == "EPUB") { |
| 90 | 90 | $tab ["readerUrl"] = "epubreader.php?data={$data->id}&db={$database}"; |
| 91 | 91 | } |
| 92 | - array_push ($out ["datas"], $tab); |
|
| 92 | + array_push($out ["datas"], $tab); |
|
| 93 | 93 | } |
| 94 | - $out ["authors"] = array (); |
|
| 95 | - foreach ($book->getAuthors () as $author) { |
|
| 96 | - $link = new LinkNavigation ($author->getUri ()); |
|
| 97 | - array_push ($out ["authors"], array ("name" => $author->name, "url" => $link->hrefXhtml ())); |
|
| 94 | + $out ["authors"] = array(); |
|
| 95 | + foreach ($book->getAuthors() as $author) { |
|
| 96 | + $link = new LinkNavigation($author->getUri()); |
|
| 97 | + array_push($out ["authors"], array("name" => $author->name, "url" => $link->hrefXhtml())); |
|
| 98 | 98 | } |
| 99 | - $out ["tags"] = array (); |
|
| 100 | - foreach ($book->getTags () as $tag) { |
|
| 101 | - $link = new LinkNavigation ($tag->getUri ()); |
|
| 102 | - array_push ($out ["tags"], array ("name" => $tag->name, "url" => $link->hrefXhtml ())); |
|
| 99 | + $out ["tags"] = array(); |
|
| 100 | + foreach ($book->getTags() as $tag) { |
|
| 101 | + $link = new LinkNavigation($tag->getUri()); |
|
| 102 | + array_push($out ["tags"], array("name" => $tag->name, "url" => $link->hrefXhtml())); |
|
| 103 | 103 | } |
| 104 | 104 | $out ["customcolumns_preview"] = $book->getCustomColumnValues($config['cops_calibre_custom_column_preview'], true); |
| 105 | 105 | |
| 106 | 106 | return $out; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public static function getContentArray ($entry) { |
|
| 109 | + public static function getContentArray($entry) { |
|
| 110 | 110 | if ($entry instanceof EntryBook) { |
| 111 | - $out = array ( "title" => $entry->title); |
|
| 112 | - $out ["book"] = self::getBookContentArray ($entry->book); |
|
| 111 | + $out = array("title" => $entry->title); |
|
| 112 | + $out ["book"] = self::getBookContentArray($entry->book); |
|
| 113 | 113 | return $out; |
| 114 | 114 | } |
| 115 | - return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement ); |
|
| 115 | + return array("title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink(), "number" => $entry->numberOfElement); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public static function getContentArrayTypeahead ($page) { |
|
| 119 | - $out = array (); |
|
| 118 | + public static function getContentArrayTypeahead($page) { |
|
| 119 | + $out = array(); |
|
| 120 | 120 | foreach ($page->entryArray as $entry) { |
| 121 | 121 | if ($entry instanceof EntryBook) { |
| 122 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ())); |
|
| 122 | + array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->book->getDetailUrl())); |
|
| 123 | 123 | } else { |
| 124 | - if (empty ($entry->className) xor Base::noDatabaseSelected ()) { |
|
| 125 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink ())); |
|
| 124 | + if (empty ($entry->className) xor Base::noDatabaseSelected()) { |
|
| 125 | + array_push($out, array("class" => $entry->className, "title" => $entry->title, "navlink" => $entry->getNavLink())); |
|
| 126 | 126 | } else { |
| 127 | - array_push ($out, array ("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink ())); |
|
| 127 | + array_push($out, array("class" => $entry->className, "title" => $entry->content, "navlink" => $entry->getNavLink())); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | return $out; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public static function addCompleteArray ($in) { |
|
| 134 | + public static function addCompleteArray($in) { |
|
| 135 | 135 | global $config; |
| 136 | 136 | $out = $in; |
| 137 | 137 | |
| 138 | - $out ["c"] = array ("version" => VERSION, "i18n" => array ( |
|
| 138 | + $out ["c"] = array("version" => VERSION, "i18n" => array( |
|
| 139 | 139 | "coverAlt" => localize("i18n.coversection"), |
| 140 | 140 | "authorsTitle" => localize("authors.title"), |
| 141 | 141 | "bookwordTitle" => localize("bookword.title"), |
| 142 | 142 | "tagsTitle" => localize("tags.title"), |
| 143 | 143 | "seriesTitle" => localize("series.title"), |
| 144 | - "customizeTitle" => localize ("customize.title"), |
|
| 145 | - "aboutTitle" => localize ("about.title"), |
|
| 146 | - "previousAlt" => localize ("paging.previous.alternate"), |
|
| 147 | - "nextAlt" => localize ("paging.next.alternate"), |
|
| 148 | - "searchAlt" => localize ("search.alternate"), |
|
| 149 | - "sortAlt" => localize ("sort.alternate"), |
|
| 150 | - "homeAlt" => localize ("home.alternate"), |
|
| 151 | - "cogAlt" => localize ("cog.alternate"), |
|
| 152 | - "permalinkAlt" => localize ("permalink.alternate"), |
|
| 144 | + "customizeTitle" => localize("customize.title"), |
|
| 145 | + "aboutTitle" => localize("about.title"), |
|
| 146 | + "previousAlt" => localize("paging.previous.alternate"), |
|
| 147 | + "nextAlt" => localize("paging.next.alternate"), |
|
| 148 | + "searchAlt" => localize("search.alternate"), |
|
| 149 | + "sortAlt" => localize("sort.alternate"), |
|
| 150 | + "homeAlt" => localize("home.alternate"), |
|
| 151 | + "cogAlt" => localize("cog.alternate"), |
|
| 152 | + "permalinkAlt" => localize("permalink.alternate"), |
|
| 153 | 153 | "publisherName" => localize("publisher.name"), |
| 154 | 154 | "pubdateTitle" => localize("pubdate.title"), |
| 155 | 155 | "languagesTitle" => localize("language.title"), |
@@ -157,15 +157,15 @@ discard block |
||
| 157 | 157 | "sortorderAsc" => localize("search.sortorder.asc"), |
| 158 | 158 | "sortorderDesc" => localize("search.sortorder.desc"), |
| 159 | 159 | "customizeEmail" => localize("customize.email")), |
| 160 | - "url" => array ( |
|
| 160 | + "url" => array( |
|
| 161 | 161 | "detailUrl" => "index.php?page=13&id={0}&db={1}", |
| 162 | 162 | "coverUrl" => "fetch.php?id={0}&db={1}", |
| 163 | 163 | "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"), |
| 164 | - "config" => array ( |
|
| 164 | + "config" => array( |
|
| 165 | 165 | "use_fancyapps" => $config ["cops_use_fancyapps"], |
| 166 | 166 | "max_item_per_page" => $config['cops_max_item_per_page'], |
| 167 | 167 | "kindleHack" => "", |
| 168 | - "server_side_rendering" => useServerSideRendering (), |
|
| 168 | + "server_side_rendering" => useServerSideRendering(), |
|
| 169 | 169 | "html_tag_filter" => $config['cops_html_tag_filter'])); |
| 170 | 170 | if ($config['cops_thumbnail_handling'] == "1") { |
| 171 | 171 | $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"]; |
@@ -178,32 +178,32 @@ discard block |
||
| 178 | 178 | return $out; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public static function getJson ($complete = false) { |
|
| 181 | + public static function getJson($complete = false) { |
|
| 182 | 182 | global $config; |
| 183 | - $page = getURLParam ("page", Base::PAGE_INDEX); |
|
| 184 | - $query = getURLParam ("query"); |
|
| 185 | - $search = getURLParam ("search"); |
|
| 186 | - $qid = getURLParam ("id"); |
|
| 187 | - $n = getURLParam ("n", "1"); |
|
| 188 | - $database = GetUrlParam (DB); |
|
| 183 | + $page = getURLParam("page", Base::PAGE_INDEX); |
|
| 184 | + $query = getURLParam("query"); |
|
| 185 | + $search = getURLParam("search"); |
|
| 186 | + $qid = getURLParam("id"); |
|
| 187 | + $n = getURLParam("n", "1"); |
|
| 188 | + $database = GetUrlParam(DB); |
|
| 189 | 189 | |
| 190 | - $currentPage = Page::getPage ($page, $qid, $query, $n); |
|
| 191 | - $currentPage->InitializeContent (); |
|
| 190 | + $currentPage = Page::getPage($page, $qid, $query, $n); |
|
| 191 | + $currentPage->InitializeContent(); |
|
| 192 | 192 | |
| 193 | 193 | if ($search) { |
| 194 | - return self::getContentArrayTypeahead ($currentPage); |
|
| 194 | + return self::getContentArrayTypeahead($currentPage); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $out = array ( "title" => $currentPage->title); |
|
| 198 | - $entries = array (); |
|
| 197 | + $out = array("title" => $currentPage->title); |
|
| 198 | + $entries = array(); |
|
| 199 | 199 | foreach ($currentPage->entryArray as $entry) { |
| 200 | - array_push ($entries, self::getContentArray ($entry)); |
|
| 200 | + array_push($entries, self::getContentArray($entry)); |
|
| 201 | 201 | } |
| 202 | - if (!is_null ($currentPage->book)) { |
|
| 203 | - $out ["book"] = self::getFullBookContentArray ($currentPage->book); |
|
| 202 | + if (!is_null($currentPage->book)) { |
|
| 203 | + $out ["book"] = self::getFullBookContentArray($currentPage->book); |
|
| 204 | 204 | } |
| 205 | - $out ["databaseId"] = GetUrlParam (DB, ""); |
|
| 206 | - $out ["databaseName"] = Base::getDbName (); |
|
| 205 | + $out ["databaseId"] = GetUrlParam(DB, ""); |
|
| 206 | + $out ["databaseName"] = Base::getDbName(); |
|
| 207 | 207 | if ($out ["databaseId"] == "") { |
| 208 | 208 | $out ["databaseName"] = ""; |
| 209 | 209 | } |
@@ -212,42 +212,42 @@ discard block |
||
| 212 | 212 | $out ["fullTitle"] = $out ["databaseName"] . " > " . $out ["fullTitle"]; |
| 213 | 213 | } |
| 214 | 214 | $out ["page"] = $page; |
| 215 | - $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0; |
|
| 215 | + $out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled()?1:0; |
|
| 216 | 216 | $out ["entries"] = $entries; |
| 217 | 217 | $out ["isPaginated"] = 0; |
| 218 | - if ($currentPage->isPaginated ()) { |
|
| 219 | - $prevLink = $currentPage->getPrevLink (); |
|
| 220 | - $nextLink = $currentPage->getNextLink (); |
|
| 218 | + if ($currentPage->isPaginated()) { |
|
| 219 | + $prevLink = $currentPage->getPrevLink(); |
|
| 220 | + $nextLink = $currentPage->getNextLink(); |
|
| 221 | 221 | $out ["isPaginated"] = 1; |
| 222 | 222 | $out ["prevLink"] = ""; |
| 223 | - if (!is_null ($prevLink)) { |
|
| 224 | - $out ["prevLink"] = $prevLink->hrefXhtml (); |
|
| 223 | + if (!is_null($prevLink)) { |
|
| 224 | + $out ["prevLink"] = $prevLink->hrefXhtml(); |
|
| 225 | 225 | } |
| 226 | 226 | $out ["nextLink"] = ""; |
| 227 | - if (!is_null ($nextLink)) { |
|
| 228 | - $out ["nextLink"] = $nextLink->hrefXhtml (); |
|
| 227 | + if (!is_null($nextLink)) { |
|
| 228 | + $out ["nextLink"] = $nextLink->hrefXhtml(); |
|
| 229 | 229 | } |
| 230 | - $out ["maxPage"] = $currentPage->getMaxPage (); |
|
| 230 | + $out ["maxPage"] = $currentPage->getMaxPage(); |
|
| 231 | 231 | $out ["currentPage"] = $currentPage->n; |
| 232 | 232 | } |
| 233 | - if (!is_null (getURLParam ("complete")) || $complete) { |
|
| 234 | - $out = self::addCompleteArray ($out); |
|
| 233 | + if (!is_null(getURLParam("complete")) || $complete) { |
|
| 234 | + $out = self::addCompleteArray($out); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $out ["containsBook"] = 0; |
| 238 | - if ($currentPage->containsBook ()) { |
|
| 238 | + if ($currentPage->containsBook()) { |
|
| 239 | 239 | $out ["containsBook"] = 1; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - $out["abouturl"] = "index.php" . addURLParameter ("?page=" . Base::PAGE_ABOUT, DB, $database); |
|
| 242 | + $out["abouturl"] = "index.php" . addURLParameter("?page=" . Base::PAGE_ABOUT, DB, $database); |
|
| 243 | 243 | |
| 244 | 244 | if ($page == Base::PAGE_ABOUT) { |
| 245 | - $temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); |
|
| 245 | + $temp = preg_replace("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); |
|
| 246 | 246 | $out ["fullhtml"] = $temp; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $out ["homeurl"] = "index.php"; |
| 250 | - if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); |
|
| 250 | + if ($page != Base::PAGE_INDEX && !is_null($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter("", DB, $database); |
|
| 251 | 251 | |
| 252 | 252 | return $out; |
| 253 | 253 | } |
@@ -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 | |