diff --git a/.hgtags b/.hgtags index 1d0aed5..a28b7a9 100644 --- a/.hgtags +++ b/.hgtags @@ -11,3 +11,6 @@ c5703623704b81dca4228e211830125029cf86a1 0.2.3 5cc3b8ed121d9df57e013e050a75e5602cf2198e 0.3.0 aca483636af460c93f9817e083e85d1976aa1b7d 0.3.1 5888006bc559842de0364ec3e67f641aa1653d0e 0.3.2 +2ff58ed42cecf00b24d981426dff507fa1e86c20 0.3.3 +3cdee8daedf28e6611203ce90c90bb8906003e22 0.3.4 +89ed9654ac9c5de1695f63992aa92d55ef82f2b9 0.4.0 diff --git a/.htaccess b/.htaccess index 0603a65..d124065 100644 --- a/.htaccess +++ b/.htaccess @@ -19,8 +19,10 @@ RewriteEngine on -RewriteRule ^download/(.*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L] -RewriteRule ^download/(.*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L] +RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L] +RewriteRule ^download/(\d*)/(\d*)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3 [L] +RewriteRule ^download/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L] +RewriteRule ^download/(\d*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L] ########################################### diff --git a/CHANGELOG b/CHANGELOG index 5ba5751..f1a11c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,26 @@ +0.4.0 - 20130507 + * Add multiple database support. Check the documentation of $config['calibre_directory'] in config-default.php to see how ot enable it. + * Include jquery library in COPS's repository to be sure that COPS will work on LAN (without Internet access). + * Prepare the switch to HTML5. Thanks to Thomas Severinsen for most of the code. + * Update the locale strings to be more strict with plurals. Thanks to Tobias Ausländer for the code. + * If Fancybox is not enabled ($config['cops_use_fancyapps'] = "0") then it's not used at all (even in the about box). + * Fix book comments if it contains UTF8 characters. Reported by Alain. + * Link to the book permalink was not working correctly in some cases. Reported by celta. + * Moved some external resources to a resources directory. + * Add chinese translation. Thanks to wogong for the pull request. + +0.3.4 - 20130327 + * Hopefully fix metadata update. Beware you should remove the directory php-epub-meta if you have one. Thanks to Mario for his time. + * Fix two warnings. Reported by Goner and Mario. + +0.3.3 - 20130323 + * Fix catalog if book summary contains bad HTML again :(. + * Upgrade to Fancybox 2.4.0 and JQuery 1.9.1. + * Search is now dependant on the page you're in. For now if you're on author page it'll look for author name. + * Update checkconfig to check if the database provided comes from Calibre. + * Update to latest php-epub-meta should fix the metadata update with Epub. + * Fix OPDS catalog with Ibis Reader. It didn't like empty language. + 0.3.2 - 20130303 * Add dutch translation. Provided by Northguy. * Fix an ugly bug introduced in 0.3.1. Reported by mariosipad. diff --git a/OPDS_renderer.php b/OPDS_renderer.php index a8da8a3..5d0ced5 100644 --- a/OPDS_renderer.php +++ b/OPDS_renderer.php @@ -60,7 +60,11 @@ class OPDSRenderer $xml->endElement (); $xml->startElement ("Url"); $xml->writeAttribute ("type", 'application/atom+xml'); - $xml->writeAttribute ("template", $config['cops_full_url'] . 'feed.php?query={searchTerms}'); + $urlparam = "?query={searchTerms}"; + if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB)); + $urlparam = str_replace ("%7B", "{", $urlparam); + $urlparam = str_replace ("%7D", "}", $urlparam); + $xml->writeAttribute ("template", $config['cops_full_url'] . 'feed.php' . $urlparam); $xml->endElement (); $xml->startElement ("Query"); $xml->writeAttribute ("role", "example"); @@ -92,7 +96,9 @@ class OPDSRenderer self::getXmlStream ()->startElement ("id"); if ($page->idPage) { - self::getXmlStream ()->text ($page->idPage); + $idPage = $page->idPage; + if (!is_null (GetUrlParam (DB))) $idPage = GetUrlParam (DB) . ":" . $idPage; + self::getXmlStream ()->text ($idPage); } else { @@ -120,14 +126,16 @@ class OPDSRenderer self::renderLink ($link); $link = new LinkNavigation ("?" . $_SERVER['QUERY_STRING'], "self"); self::renderLink ($link); + $urlparam = "?page=" . self::PAGE_OPENSEARCH; + if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB)); if ($config['cops_generate_invalid_opds_stream'] == 0 || preg_match("/(MantanoReader|FBReader)/", $_SERVER['HTTP_USER_AGENT'])) { // Good and compliant way of handling search - $link = new Link ("feed.php?page=" . self::PAGE_OPENSEARCH, "application/opensearchdescription+xml", "search", "Search here"); + $link = new Link ("feed.php" . $urlparam, "application/opensearchdescription+xml", "search", "Search here"); } else { // Bad way, will be removed when OPDS client are fixed - $link = new Link ($config['cops_full_url'] . 'feed.php?query={searchTerms}', "application/atom+xml", "search", "Search here"); + $link = new Link ($config['cops_full_url'] . 'feed.php' . $urlparam, "application/atom+xml", "search", "Search here"); } self::renderLink ($link); if ($page->containsBook () && !is_null ($config['cops_books_filter']) && count ($config['cops_books_filter']) > 0) { @@ -217,7 +225,7 @@ class OPDSRenderer } $lang = $entry->book->getLanguages (); - if (!is_null ($lang)) { + if (!empty ($lang)) { self::getXmlStream ()->startElement ("dcterms:language"); self::getXmlStream ()->text ($lang); self::getXmlStream ()->endElement (); diff --git a/about.xml b/about.xml new file mode 100644 index 0000000..35043ed --- /dev/null +++ b/about.xml @@ -0,0 +1,29 @@ +
+
Authors
+
+

COPS is developped and maintained by Sébastien Lucas.

+ +

See full history on Github to check all authors.

+ +

COPS use some external librairies, check README for the details.

+
+
Copyright
+
+

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

+ +

The complete content of license is provided in file COPYING within distribution and also available online.

+
+
Contact
+
+

For more info please visit COPS Home Page

+ +

You can also check COPS's topic on MobileRead forum.

+
+
Thanks
+
+

Thanks a lot to Kovid Goyal for Calibre.

+ +

And many thanks to all those who helped test COPS.

+
+ +
\ No newline at end of file diff --git a/author.php b/author.php index d41bb84..9b9bcee 100644 --- a/author.php +++ b/author.php @@ -39,7 +39,7 @@ class Author extends Base { public static function getCount() { $nAuthors = parent::getDb ()->query('select count(*) from authors')->fetchColumn(); $entry = new Entry (localize("authors.title"), self::ALL_AUTHORS_ID, - str_format (localize("authors.alphabetical"), $nAuthors), "text", + str_format (localize("authors.alphabetical", $nAuthors), $nAuthors), "text", array ( new LinkNavigation ("?page=".parent::PAGE_ALL_AUTHORS))); return $entry; } diff --git a/base.php b/base.php index 56503c6..a78c5e9 100644 --- a/base.php +++ b/base.php @@ -6,7 +6,8 @@ * @author Sébastien Lucas */ -define ("VERSION", "0.3.2"); +define ("VERSION", "0.4.0"); +define ("DB", "db"); date_default_timezone_set($config['default_timezone']); function getURLParam ($name, $default = NULL) { @@ -27,14 +28,66 @@ function xml2xhtml($xml) { '), $xml); } +function display_xml_error($error) +{ + $return .= str_repeat('-', $error->column) . "^\n"; + + switch ($error->level) { + case LIBXML_ERR_WARNING: + $return .= "Warning $error->code: "; + break; + case LIBXML_ERR_ERROR: + $return .= "Error $error->code: "; + break; + case LIBXML_ERR_FATAL: + $return .= "Fatal Error $error->code: "; + break; + } + + $return .= trim($error->message) . + "\n Line: $error->line" . + "\n Column: $error->column"; + + if ($error->file) { + $return .= "\n File: $error->file"; + } + + return "$return\n\n--------------------------------------------\n\n"; +} + +function are_libxml_errors_ok () +{ + $errors = libxml_get_errors(); + + foreach ($errors as $error) { + if ($error->code == 801) return false; + } + return true; +} + function html2xhtml ($html) { $doc = new DOMDocument(); - $doc->loadHTML($html); // Load the HTML - $output = utf8_decode($doc->saveXML($doc->documentElement)); // Transform to an Ansi xml stream - $output = xml2xhtml($output); // Fix the br / hr ... - if (preg_match ("/(.*)<\/body><\/html>/", $output, $matches)) { + libxml_use_internal_errors(true); + + $doc->loadHTML('' . + $html . ''); // Load the HTML + $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream + $output = xml2xhtml($output); + if (preg_match ('#(.*)#ms', $output, $matches)) { $output = $matches [1]; // Remove } + /* + // In case of error with summary, use it to debug + $errors = libxml_get_errors(); + + foreach ($errors as $error) { + $output .= display_xml_error($error); + } + */ + + if (!are_libxml_errors_ok ()) $output = "HTML code not valid."; + + libxml_use_internal_errors(false); return $output; } @@ -100,14 +153,19 @@ function localize($phrase, $count=-1) { } function addURLParameter($urlParams, $paramName, $paramValue) { + $start = ""; + if (preg_match ("#^\?(.*)#", $urlParams, $matches)) { + $start = "?"; + $urlParams = $matches[1]; + } $params = array(); parse_str($urlParams, $params); - if (empty ($paramValue)) { + if (empty ($paramValue) && $paramValue != 0) { unset ($params[$paramName]); } else { $params[$paramName] = $paramValue; } - return http_build_query($params); + return $start . http_build_query($params); } class Link @@ -143,7 +201,13 @@ class LinkNavigation extends Link { public function __construct($phref, $prel = NULL, $ptitle = NULL) { parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); - $this->href = $_SERVER["SCRIPT_NAME"] . $this->href; + if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); + if (!preg_match ("#^\?(.*)#", $this->href) && !empty ($this->href)) $this->href = "?" . $this->href; + if (preg_match ("/bookdetail.php/", $_SERVER["SCRIPT_NAME"])) { + $this->href = "index.php" . $this->href; + } else { + $this->href = $_SERVER["SCRIPT_NAME"] . $this->href; + } } } @@ -151,6 +215,7 @@ class LinkFacet extends Link { public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) { parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet); + if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); $this->href = $_SERVER["SCRIPT_NAME"] . $this->href; } } @@ -203,6 +268,8 @@ class Entry } } } + + if (!is_null (GetUrlParam (DB))) $this->id = GetUrlParam (DB) . ":" . $this->id; } } @@ -276,6 +343,8 @@ class Page return new PageQueryResult ($id, $query, $n); case Base::PAGE_BOOK_DETAIL : return new PageBookDetail ($id, $query, $n); + case Base::PAGE_ABOUT : + return new PageAbout ($id, $query, $n); default: $page = new Page ($id, $query, $n); $page->idPage = "cops:catalog"; @@ -297,16 +366,29 @@ class Page global $config; $this->title = $config['cops_title_default']; $this->subtitle = $config['cops_subtitle_default']; - array_push ($this->entryArray, Author::getCount()); - array_push ($this->entryArray, Serie::getCount()); - array_push ($this->entryArray, Tag::getCount()); - foreach ($config['cops_calibre_custom_column'] as $lookup) { - $customId = CustomColumn::getCustomId ($lookup); - if (!is_null ($customId)) { - array_push ($this->entryArray, CustomColumn::getCount($customId)); + $database = GetUrlParam (DB); + if (is_array ($config['calibre_directory']) && is_null ($database)) { + $i = 0; + foreach ($config['calibre_directory'] as $key => $value) { + array_push ($this->entryArray, new Entry ($key, "{$i}:cops:catalog", + "", "text", + array ( new LinkNavigation ("?" . DB . "={$i}")))); + $i++; } + } else { + array_push ($this->entryArray, Author::getCount()); + array_push ($this->entryArray, Serie::getCount()); + array_push ($this->entryArray, Tag::getCount()); + foreach ($config['cops_calibre_custom_column'] as $lookup) { + $customId = CustomColumn::getCustomId ($lookup); + if (!is_null ($customId)) { + array_push ($this->entryArray, CustomColumn::getCount($customId)); + } + } + $this->entryArray = array_merge ($this->entryArray, Book::getCount()); + + if (!is_null ($database)) $this->title = Base::getDbName (); } - $this->entryArray = array_merge ($this->entryArray, Book::getCount()); } public function isPaginated () @@ -498,8 +580,32 @@ class PageQueryResult extends Page { public function InitializeContent () { - $this->title = "Search result for query *" . $this->query . "*"; // TODO I18N - list ($this->entryArray, $this->totalNumber) = Book::getBooksByQuery ($this->query, $this->n); + global $config; + $this->title = str_format (localize ("search.result"), $this->query); + $currentPage = getURLParam ("current", NULL); + + // Special case when we are doing a search and no database is selected + if (is_array ($config['calibre_directory']) && is_null (GetUrlParam (DB))) { + $i = 0; + foreach ($config['calibre_directory'] as $key => $value) { + Base::clearDb (); + list ($array, $totalNumber) = Book::getBooksByQuery ($this->query, $this->n, $i); + array_push ($this->entryArray, new Entry ($key, DB . ":query:{$i}", + str_format (localize ("bookword", count($array)), count($array)), "text", + array ( new LinkNavigation ("?" . DB . "={$i}&page=9&query=" . $this->query)))); + $i++; + } + return; + } + + switch ($currentPage) { + case Base::PAGE_ALL_AUTHORS : + case Base::PAGE_AUTHORS_FIRST_LETTER : + $this->entryArray = Author::getAuthorsByStartingLetter ('%' . $this->query); + break; + default: + list ($this->entryArray, $this->totalNumber) = Book::getBooksByQuery ($this->query, $this->n); + } } } @@ -512,6 +618,15 @@ class PageBookDetail extends Page } } +class PageAbout extends Page +{ + public function InitializeContent () + { + $this->title = localize ("about.title"); + } +} + + abstract class Base { const PAGE_INDEX = "index"; @@ -530,21 +645,51 @@ abstract class Base const PAGE_BOOK_DETAIL = "13"; const PAGE_ALL_CUSTOMS = "14"; const PAGE_CUSTOM_DETAIL = "15"; + const PAGE_ABOUT = "16"; const COMPATIBILITY_XML_ALDIKO = "aldiko"; private static $db = NULL; - public static function getDbFileName () { + public static function getDbList () { global $config; - return $config['calibre_directory'] .'metadata.db'; + if (is_array ($config['calibre_directory'])) { + return $config['calibre_directory']; + } else { + return array ("" => $config['calibre_directory']); + } + } + + public static function getDbName ($database = NULL) { + global $config; + if (is_array ($config['calibre_directory'])) { + if (is_null ($database)) $database = GetUrlParam (DB, 0); + $array = array_keys ($config['calibre_directory']); + return $array[$database]; + } + return ""; + } + + public static function getDbDirectory ($database = NULL) { + global $config; + if (is_array ($config['calibre_directory'])) { + if (is_null ($database)) $database = GetUrlParam (DB, 0); + $array = array_values ($config['calibre_directory']); + return $array[$database]; + } + return $config['calibre_directory']; + } + + + public static function getDbFileName ($database = NULL) { + return self::getDbDirectory ($database) .'metadata.db'; } - public static function getDb () { + public static function getDb ($database = NULL) { global $config; if (is_null (self::$db)) { try { - self::$db = new PDO('sqlite:'. self::getDbFileName ()); + self::$db = new PDO('sqlite:'. self::getDbFileName ($database)); } catch (Exception $e) { header("location: checkconfig.php?err=1"); exit(); @@ -553,14 +698,18 @@ abstract class Base return self::$db; } - public static function executeQuery($query, $columns, $filter, $params, $n) { + public static function clearDb () { + self::$db = NULL; + } + + public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL) { global $config; $totalResult = -1; if ($config['cops_max_item_per_page'] != -1 && $n != -1) { // First check total number of results - $result = self::getDb ()->prepare (str_format ($query, "count(*)", $filter)); + $result = self::getDb ($database)->prepare (str_format ($query, "count(*)", $filter)); $result->execute ($params); $totalResult = $result->fetchColumn (); @@ -569,10 +718,10 @@ abstract class Base array_push ($params, ($n - 1) * $config['cops_max_item_per_page'], $config['cops_max_item_per_page']); } - $result = self::getDb ()->prepare(str_format ($query, $columns, $filter)); + $result = self::getDb ($database)->prepare(str_format ($query, $columns, $filter)); $result->execute ($params); return array ($totalResult, $result); } } -?> \ No newline at end of file +?> diff --git a/book.php b/book.php index e870a58..a7d434c 100644 --- a/book.php +++ b/book.php @@ -12,7 +12,7 @@ require_once('author.php'); require_once('tag.php'); require_once ("customcolumn.php"); require_once('data.php'); -require_once('php-epub-meta/epub.php'); +require_once('resources/php-epub-meta/epub.php'); // Silly thing because PHP forbid string concatenation in class const define ('SQL_BOOKS_LEFT_JOIN', "left outer join comments on comments.book = books.id @@ -72,7 +72,7 @@ class Book extends Base { $this->title = $line->title; $this->timestamp = strtotime ($line->timestamp); $this->pubdate = strtotime ($line->pubdate); - $this->path = $config['calibre_directory'] . $line->path; + $this->path = Base::getDbDirectory () . $line->path; $this->relativePath = $line->path; $this->seriesIndex = $line->series_index; $this->comment = $line->comment; @@ -94,15 +94,18 @@ class Book extends Base { } public function getUri () { - return "?page=".parent::PAGE_BOOK_DETAIL."&id=$this->id"; + return "?page=".parent::PAGE_BOOK_DETAIL."&id=$this->id"; } - public function getDetailUrl () { + public function getDetailUrl ($permalink = false) { global $config; - if ($config['cops_use_fancyapps'] == 0) { - return 'index.php' . $this->getUri (); + $urlParam = $this->getUri (); + if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB)); + $urlParam = str_replace ("&", "&", $urlParam); + if ($permalink || $config['cops_use_fancyapps'] == 0) { + return 'index.php' . $urlParam; } else { - return 'bookdetail.php?id=' . $this->id; + return 'bookdetail.php' . $urlParam; } } @@ -117,7 +120,7 @@ class Book extends Base { return $this->authors; } - public function getFilterString () { + public static function getFilterString () { $filter = getURLParam ("tag", NULL); if (empty ($filter)) return ""; @@ -137,17 +140,7 @@ class Book extends Base { } public function getAuthorsName () { - $authorList = null; - foreach ($this->getAuthors () as $author) { - if ($authorList) { - $authorList = $authorList . ", " . $author->name; - } - else - { - $authorList = $author->name; - } - } - return $authorList; + return implode (", ", array_map (function ($author) { return $author->name; }, $this->getAuthors ())); } public function getSerie () { @@ -219,17 +212,7 @@ class Book extends Base { public function getTagsName () { - $tagList = null; - foreach ($this->getTags () as $tag) { - if ($tagList) { - $tagList = $tagList . ", " . $tag->name; - } - else - { - $tagList = $tag->name; - } - } - return $tagList; + return implode (", ", array_map (function ($tag) { return $tag->name; }, $this->getTags ())); } public function getRating () { @@ -349,15 +332,8 @@ class Book extends Base { if ($this->hasCover) { array_push ($linkArray, Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)); - $height = "50"; - if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) { - $height = $config['cops_opds_thumbnail_height']; - } - else - { - $height = $config['cops_html_thumbnail_height']; - } - array_push ($linkArray, new Link ("fetch.php?id=$this->id&height=" . $height, "image/jpeg", Link::OPDS_THUMBNAIL_TYPE)); + + array_push ($linkArray, Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL)); } foreach ($this->getDatas () as $data) @@ -393,7 +369,7 @@ class Book extends Base { $result = array(); $entry = new Entry (localize ("allbooks.title"), self::ALL_BOOKS_ID, - str_format (localize ("allbooks.alphabetical"), $nBooks), "text", + str_format (localize ("allbooks.alphabetical", $nBooks), $nBooks), "text", array ( new LinkNavigation ("?page=".parent::PAGE_ALL_BOOKS))); array_push ($result, $entry); $entry = new Entry (localize ("recent.title"), @@ -451,8 +427,8 @@ where data.book = books.id and data.id = ?'); return NULL; } - public static function getBooksByQuery($query, $n) { - return self::getEntryArray (self::SQL_BOOKS_QUERY, array ("%" . $query . "%", "%" . $query . "%"), $n); + public static function getBooksByQuery($query, $n, $database = NULL) { + return self::getEntryArray (self::SQL_BOOKS_QUERY, array ("%" . $query . "%", "%" . $query . "%"), $n, $database); } public static function getAllBooks() { @@ -474,8 +450,8 @@ order by substr (upper (sort), 1, 1)"); return self::getEntryArray (self::SQL_BOOKS_BY_FIRST_LETTER, array ($letter . "%"), $n); } - public static function getEntryArray ($query, $params, $n) { - list ($totalNumber, $result) = parent::executeQuery ($query, self::BOOK_COLUMNS, self::getFilterString (), $params, $n); + public static function getEntryArray ($query, $params, $n, $database = NULL) { + list ($totalNumber, $result) = parent::executeQuery ($query, self::BOOK_COLUMNS, self::getFilterString (), $params, $n, $database); $entryArray = array(); while ($post = $result->fetchObject ()) { diff --git a/bookdetail.php b/bookdetail.php index 4cb77b3..8bce647 100644 --- a/bookdetail.php +++ b/bookdetail.php @@ -32,7 +32,9 @@ $book->getLinkArray (); hasCover) { ?> - <?php echo localize(" /> + hrefXhtml () ?>"> + hrefXhtml () ?>" alt="" /> + @@ -54,7 +56,7 @@ $book->getLinkArray (); foreach ($authors as $author) { if ($i > 0) echo ", "; ?> - getUri ()) ?>">name) ?> + name) ?> @@ -69,7 +71,7 @@ $book->getLinkArray (); foreach ($tags as $tag) { if ($i > 0) echo ", "; ?> - getUri ()) ?>">name) ?> + name) ?> @@ -79,7 +81,7 @@ $book->getLinkArray (); if (!is_null ($serie)) { ?> -

getUri ()) ?>">:

+

:

seriesIndex, htmlspecialchars ($serie->name)) ?>
- +
+
Check if libxml is properly installed and loaded
+
+ +
+
+ $database) { +?>
Check if Calibre database file exists and is readable
  • Value of \$config['calibre_directory'] in config_local.php
  • @@ -99,14 +114,33 @@ Please check
    +
    +
    Check if Calibre database file contains at least some of the needed tables
    +
    + query("select count(*) FROM sqlite_master WHERE type='table' AND name in ('books', 'authors', 'tags', 'series')")->fetchColumn(); + if ($count == 4) { + echo "{$name} OK"; + } else { + echo "{$name} Not all Calibre tables were found. Are you you're using the correct database."; + } + } catch (Exception $e) { + echo "{$name} If the file is readable, check your php configuration. Exception detail : " . $e; + } + ?> +
    +
    +
    diff --git a/config_default.php b/config_default.php index 36d7a98..c734107 100644 --- a/config_default.php +++ b/config_default.php @@ -13,6 +13,8 @@ * The directory containing calibre's metadata.db file, with sub-directories * containing all the formats. * BEWARE : it has to end with a / + * You can enable multiple database with this notation instead of a simple string : + * $config['calibre_directory'] = array ("My database name" => "/home/directory/calibre1/", "My other database name" => "/home/directory/calibre2/"); */ $config['calibre_directory'] = './feedbook/'; @@ -93,7 +95,7 @@ /* * use URL rewriting for downloading of ebook in HTML catalog - * See README for more information + * See Github wiki for more information * 1 : enable * 0 : disable */ @@ -164,4 +166,5 @@ * 0 : No */ $config['cops_provide_kepub'] = "0"; + ?> \ No newline at end of file diff --git a/customcolumn.php b/customcolumn.php index 4218040..72a5501 100644 --- a/customcolumn.php +++ b/customcolumn.php @@ -68,13 +68,12 @@ class CustomColumn extends Base { public static function getCount($customId) { $nCustoms = parent::getDb ()->query('select count(*) from ' . self::getTableName ($customId))->fetchColumn(); $entry = new Entry (self::getAllTitle ($customId), self::getAllCustomsId ($customId), - str_format (localize("tags.alphabetical"), $nCustoms), "text", + str_format (localize("tags.alphabetical", $nCustoms), $nCustoms), "text", array ( new LinkNavigation (self::getUriAllCustoms ($customId)))); return $entry; } public static function getCustomById ($customId, $id) { - $test = 'select id, value as name from ' . self::getTableName ($customId) . ' where id = ?'; $result = parent::getDb ()->prepare('select id, value as name from ' . self::getTableName ($customId) . ' where id = ?'); $result->execute (array ($id)); if ($post = $result->fetchObject ()) { @@ -84,12 +83,6 @@ class CustomColumn extends Base { } public static function getAllCustoms($customId) { - $test = str_format ("{0} - {1} - {2}", self::getTableName ($customId), self::getTableLinkName ($customId), self::getTableLinkColumn ($customId)); - $test = str_format ('select {0}.id as id, {0}.value as name, count(*) as count -from {0}, {1} -where {0}.id = {1}.{2} -group by {0}.id, {0}.value -order by {0}.value', self::getTableName ($customId), self::getTableLinkName ($customId), self::getTableLinkColumn ($customId)); $result = parent::getDb ()->query(str_format ('select {0}.id as id, {0}.value as name, count(*) as count from {0}, {1} where {0}.id = {1}.{2} diff --git a/data.php b/data.php index cdd05d5..0430bd8 100644 --- a/data.php +++ b/data.php @@ -95,10 +95,12 @@ class Data extends Base { if ($config['cops_use_url_rewriting'] == "1") { + $database = ""; + if (!is_null (GetUrlParam (DB))) $database = GetUrlParam (DB) . "/"; if ($config['cops_provide_kepub'] == "1" && preg_match("/Kobo/", $_SERVER['HTTP_USER_AGENT'])) { - return "download/" . $this->id . "/" . urlencode ($this->getUpdatedFilenameKepub ()); + return "download/" . $this->id . "/" . $database . urlencode ($this->getUpdatedFilenameKepub ()); } else { - return "download/" . $this->id . "/" . urlencode ($this->getFilename ()); + return "download/" . $this->id . "/" . $database . urlencode ($this->getFilename ()); } } else @@ -107,22 +109,33 @@ class Data extends Base { } } - public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL) + public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) { global $config; - $textData = ""; - if (!is_null ($idData)) - { - $textData = "&data=" . $idData; - } + $urlParam = addURLParameter("", "data", $idData); - if (preg_match ('/^\//', $config['calibre_directory']) || // Linux / - preg_match ('/^\w\:/', $config['calibre_directory']) || // Windows X: + if (preg_match ('/^\//', Base::getDbDirectory ()) || // Linux / + preg_match ('/^\w\:/', Base::getDbDirectory ()) || // Windows X: + $rel == Link::OPDS_THUMBNAIL_TYPE || ($type == "epub" && $config['cops_update_epub-metadata'])) { - if ($type != "jpg") $textData .= "&type=" . $type; - return new Link ("fetch.php?id=$book->id" . $textData, $mime, $rel, $title); + if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type); + if ($rel == Link::OPDS_THUMBNAIL_TYPE) { + if (is_null ($height)) { + if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) { + $height = $config['cops_opds_thumbnail_height']; + } + else + { + $height = $config['cops_html_thumbnail_height']; + } + } + $urlParam = addURLParameter($urlParam, "height", $height); + } + $urlParam = addURLParameter($urlParam, "id", $book->id); + if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB)); + return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title); } else { diff --git a/fancybox/jquery.fancybox.pack.js b/fancybox/jquery.fancybox.pack.js deleted file mode 100644 index 088b5c6..0000000 --- a/fancybox/jquery.fancybox.pack.js +++ /dev/null @@ -1,45 +0,0 @@ -/*! fancyBox v2.1.3 fancyapps.com | fancyapps.com/fancybox/#license */ -(function(B,x,f,q){var r=f(B),m=f(x),b=f.fancybox=function(){b.open.apply(this,arguments)},u=null,n=x.createTouch!==q,s=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},E=function(a){return p(a)&&0
    ',image:'',iframe:'",error:'

    The requested content cannot be loaded.
    Please try again later.

    ',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing", -openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null, -isActive:!1,isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=s(a)?f(a).get():[a]),f.each(a,function(e,c){var j={},g,h,i,l,k;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),s(c)?(j={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0, -j,c.metadata())):j=c);g=d.href||j.href||(p(c)?c:null);h=d.title!==q?d.title:j.title||"";l=(i=d.content||j.content)?"html":d.type||j.type;!l&&j.isDom&&(l=c.data("fancybox-type"),l||(l=(l=c.prop("class").match(/fancybox\.(\w+)/))?l[1]:null));p(g)&&(l||(b.isImage(g)?l="image":b.isSWF(g)?l="swf":"#"===g.charAt(0)?l="inline":p(c)&&(l="html",i=c)),"ajax"===l&&(k=g.split(/\s+/,2),g=k.shift(),k=k.shift()));i||("inline"===l?g?i=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):j.isDom&&(i=c):"html"===l?i=g:!l&&(!g&& -j.isDom)&&(l="inline",i=c));f.extend(j,{href:g,type:l,content:i,title:h,selector:k});a[e]=j}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==q&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| -b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= -setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==q&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,j;c&&(j=b._getPosition(d),a&&"scroll"===a.type?(delete j.position,c.stop(!0,!0).animate(j,200)):(c.css(j),e.pos=f.extend({}, -e.dim,j)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(u),u=null);b.isOpen&&!u&&(u=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),u=null)},e&&!n?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,n&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), -b.trigger("onUpdate")),b.update())},hideLoading:function(){m.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
    ').click(b.cancel).appendTo("body");m.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| -!1,d={x:r.scrollLeft(),y:r.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=n&&B.innerWidth?B.innerWidth:r.width(),d.h=n&&B.innerHeight?B.innerHeight:r.height());return d},unbindEvents:function(){b.wrap&&s(b.wrap)&&b.wrap.unbind(".fb");m.unbind(".fb");r.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(r.bind("orientationchange.fb"+(n?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&m.bind("keydown.fb",function(e){var c=e.which||e.keyCode,j= -e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!j||!j.type&&!f(j).is("[contenteditable]")))&&f.each(d,function(d,j){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!i&&1g||0>j)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, -e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c,a=k(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& -(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive= -!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&n&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(n?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,v(d.padding[a]))});b.trigger("onReady"); -if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= -this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g, -(new Date).getTime())).attr("scrolling",n?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);n||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= -b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,j,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); -e=a.content;c=a.type;j=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
    ").html(e).find(a.selector):s(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
    ').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", -!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!s(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); -a.inner.css("overflow","yes"===j?"scroll":"no"===j?"hidden":j);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,j=b.skin,g=b.inner,h=b.current,c=h.width,i=h.height,l=h.minWidth,t=h.minHeight,m=h.maxWidth, -n=h.maxHeight,r=h.scrolling,p=h.scrollOutside?h.scrollbarWidth:0,w=h.margin,y=k(w[1]+w[3]),q=k(w[0]+w[2]),x,z,s,C,A,F,B,D,u;e.add(j).add(g).width("auto").height("auto").removeClass("fancybox-tmp");w=k(j.outerWidth(!0)-j.width());x=k(j.outerHeight(!0)-j.height());z=y+w;s=q+x;C=E(c)?(a.w-z)*k(c)/100:c;A=E(i)?(a.h-s)*k(i)/100:i;if("iframe"===h.type){if(u=h.content,h.autoHeight&&1===u.data("ready"))try{u[0].contentWindow.document.location&&(g.width(C).height(9999),F=u.contents().find("body"),p&&F.css("overflow-x", -"hidden"),A=F.height())}catch(G){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=k(C);i=k(A);D=C/A;l=k(E(l)?k(l,"w")-z:l);m=k(E(m)?k(m,"w")-z:m);t=k(E(t)?k(t,"h")-s:t);n=k(E(n)?k(n,"h")-s:n);F=m;B=n;h.fitToView&&(m=Math.min(a.w-z,m),n=Math.min(a.h-s,n));z=a.w-y;q=a.h-q;h.aspectRatio?(c>m&&(c=m,i=k(c/D)),i>n&&(i=n,c=k(i*D)),cz||y>q)&&(c>l&&i>t)&&!(19m&&(c=m,i=k(c/D)),g.width(c).height(i),e.width(c+w),a=e.width(),y=e.height();else c=Math.max(l,Math.min(c,c-(a-z))),i=Math.max(t,Math.min(i,i-(y-q)));p&&("auto"===r&&iz||y>q)&&c>l&&i>t;c=h.aspectRatio?ct&&i
    ').appendTo("body");this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this,a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(r.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&& -(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()},close:function(){f(".fancybox-overlay").remove();r.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");f.browser.msie?(b=Math.max(x.documentElement.offsetWidth,x.body.offsetWidth),m.width()>b&&(a=m.width())):m.width()>r.width()&&(a=m.width());this.overlay.width(a).height(m.height())}, -onReady:function(a,b){f(".fancybox-overlay").stop(!0,!0);this.overlay||(this.margin=m.height()>r.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=x.all&&!x.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",k(this.margin)+ -b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
    '+e+"
    ");switch(c){case "inside":c=b.skin;break;case "outside":c= -b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),f.browser.msie&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(k(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",j=function(g){var h=f(this).blur(),i=d,j,k;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(j=a.groupAttr||"data-fancybox-group",k=h.attr(j),k||(j="rel", -k=h.get(0)[j]),k&&(""!==k&&"nofollow"!==k)&&(h=c.length?f(c):e,h=h.filter("["+j+'="'+k+'"]'),i=h.index(this)),a.index=i,!1!==b.open(h,a)&&g.preventDefault())},a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",j):m.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",j);this.filter("[data-fancybox-start=1]").trigger("click");return this};m.ready(function(){f.scrollbarWidth===q&&(f.scrollbarWidth=function(){var a=f('
    ').appendTo("body"), -b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===q){var a=f.support,d=f('
    ').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery); \ No newline at end of file diff --git a/fetch.php b/fetch.php index bbde6fd..855f3fd 100644 --- a/fetch.php +++ b/fetch.php @@ -100,7 +100,7 @@ $dir = $config['calibre_internal_directory']; if (empty ($config['calibre_internal_directory'])) { - $dir = $config['calibre_directory']; + $dir = Base::getDbDirectory (); } if (empty ($config['cops_x_accel_redirect'])) { diff --git a/images/ajax-loader.gif b/images/ajax-loader.gif deleted file mode 100644 index 1560b64..0000000 Binary files a/images/ajax-loader.gif and /dev/null differ diff --git a/index.php b/index.php index 7f862ec..8236ace 100644 --- a/index.php +++ b/index.php @@ -24,11 +24,12 @@ $withToolbar = false; if (!isset($_COOKIE['toolbar'])) $withToolbar = true; - header ("Content-Type:application/xhtml+xml"); + header ("Content-Type:application/xhtml+xml;charset=utf-8"); $page = getURLParam ("page", Base::PAGE_INDEX); $query = getURLParam ("query"); $qid = getURLParam ("id"); $n = getURLParam ("n", "1"); + $database = GetUrlParam (DB); $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -52,13 +53,15 @@ <?php echo htmlspecialchars ($currentPage->title) ?> - - - + - + + + " media="screen" /> + + + - " media="screen" /> @@ -89,7 +92,6 @@ nextEffect : 'none' }); - $(".fancyabout").fancybox({ 'type' : 'ajax', @@ -98,6 +100,7 @@ nextEffect : 'none' }); + $(".headright").click(function(){ if ($("#tool").is(":hidden")) { @@ -109,6 +112,7 @@ } }); + $(".bookdetail").click(function(){ var url = $(this).find("a").attr("href"); @@ -124,6 +128,7 @@ return false; }); + }); -
    -

    waiting Please Wait

    -
    - "> - " alt="Home" /> + "> + " alt="" /> " alt="Settings and menu" />

    title) ?>

    - entryArray as $entry) { if (get_class ($entry) != "EntryBook") { - ?> +?>