2012-05-28 08:01:33 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* COPS (Calibre OPDS PHP Server) class file
|
|
|
|
*
|
|
|
|
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
2013-10-10 07:25:04 +03:00
|
|
|
* @author Sébastien Lucas <sebastien@slucas.fr>
|
2012-05-28 08:01:33 +03:00
|
|
|
*/
|
|
|
|
|
2012-05-28 08:06:12 +03:00
|
|
|
if (!isset($config))
|
|
|
|
$config = array();
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-05-28 08:01:33 +03:00
|
|
|
/*
|
|
|
|
* The directory containing calibre's metadata.db file, with sub-directories
|
|
|
|
* containing all the formats.
|
2012-05-28 08:06:12 +03:00
|
|
|
* BEWARE : it has to end with a /
|
2013-04-09 11:58:01 +03:00
|
|
|
* 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/");
|
2012-05-28 08:01:33 +03:00
|
|
|
*/
|
|
|
|
$config['calibre_directory'] = './';
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-05-28 08:01:33 +03:00
|
|
|
/*
|
2013-01-20 14:49:08 +02:00
|
|
|
* SPECIFIC TO NGINX
|
2012-05-28 08:01:33 +03:00
|
|
|
* The internal directory set in nginx config file
|
2013-01-20 14:49:08 +02:00
|
|
|
* Leave empty if you don't know what you're doing
|
2012-05-28 08:01:33 +03:00
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['calibre_internal_directory'] = '';
|
2012-05-28 08:01:33 +03:00
|
|
|
|
|
|
|
/*
|
2012-05-28 08:06:12 +03:00
|
|
|
* Full URL prefix (with trailing /)
|
2013-12-12 21:54:53 +02:00
|
|
|
* useful especially for Opensearch where a full URL is often required
|
2013-11-04 15:37:12 +02:00
|
|
|
* For example Mantano, Aldiko and Marvin require it.
|
2012-05-28 08:06:12 +03:00
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['cops_full_url'] = '';
|
|
|
|
|
2012-05-28 08:06:12 +03:00
|
|
|
/*
|
|
|
|
* Number of recent books to show
|
2012-05-28 08:01:33 +03:00
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['cops_recentbooks_limit'] = '50';
|
|
|
|
|
2013-10-10 07:25:04 +03:00
|
|
|
/*
|
|
|
|
* Catalog's author name
|
|
|
|
*/
|
|
|
|
$config['cops_author_name'] = "Sébastien Lucas";
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Catalog's author uri
|
|
|
|
*/
|
|
|
|
$config['cops_author_uri'] = "http://blog.slucas.fr";
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Catalog's author email
|
|
|
|
*/
|
|
|
|
$config['cops_author_email'] = "sebastien@slucas.fr";
|
|
|
|
|
2012-05-28 08:01:33 +03:00
|
|
|
/*
|
2012-10-12 16:44:05 +03:00
|
|
|
* Catalog's title
|
2012-05-28 08:01:33 +03:00
|
|
|
*/
|
2013-01-20 15:35:23 +02:00
|
|
|
$config['cops_title_default'] = "COPS";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-12-22 19:23:17 +02:00
|
|
|
/*
|
|
|
|
* Catalog's subtitle
|
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['cops_subtitle_default'] = "";
|
|
|
|
|
2012-05-28 08:05:05 +03:00
|
|
|
/*
|
|
|
|
* Wich header to use when downloading books outside the web directory
|
|
|
|
* Possible values are :
|
2013-01-19 07:19:46 +02:00
|
|
|
* X-Accel-Redirect : For Nginx
|
|
|
|
* X-Sendfile : For Lightttpd or Apache (with mod_xsendfile)
|
|
|
|
* No value (default) : Let PHP handle the download
|
2012-05-28 08:05:05 +03:00
|
|
|
*/
|
2013-01-19 07:19:46 +02:00
|
|
|
$config['cops_x_accel_redirect'] = "";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-05-28 08:07:49 +03:00
|
|
|
/*
|
|
|
|
* Height of thumbnail image for OPDS
|
|
|
|
*/
|
2013-09-03 22:10:58 +03:00
|
|
|
$config['cops_opds_thumbnail_height'] = "164";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-05-28 08:07:49 +03:00
|
|
|
/*
|
|
|
|
* Height of thumbnail image for HTML
|
|
|
|
*/
|
2013-07-04 23:37:27 +03:00
|
|
|
$config['cops_html_thumbnail_height'] = "164";
|
2012-12-22 19:03:52 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Icon for both OPDS and HTML catalog
|
|
|
|
* Note that this has to be a real icon (.ico)
|
|
|
|
*/
|
|
|
|
$config['cops_icon'] = "favicon.ico";
|
|
|
|
|
2012-05-28 08:07:49 +03:00
|
|
|
/*
|
|
|
|
* Show icon for authors, series, tags and books on OPDS feed
|
|
|
|
* 1 : enable
|
|
|
|
* 0 : disable
|
|
|
|
*/
|
|
|
|
$config['cops_show_icons'] = "1";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-06-23 15:50:50 +03:00
|
|
|
/*
|
2013-12-05 11:52:51 +02:00
|
|
|
* Default timezone
|
2012-06-23 15:50:50 +03:00
|
|
|
* Check following link for other timezones :
|
|
|
|
* http://www.php.net/manual/en/timezones.php
|
|
|
|
*/
|
|
|
|
$config['default_timezone'] = "Europe/Paris";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-06-24 09:16:47 +03:00
|
|
|
/*
|
|
|
|
* Prefered format for HTML catalog
|
|
|
|
* The two first will be displayed in book entries
|
|
|
|
* The other only appear in book detail
|
|
|
|
*/
|
2013-07-29 08:50:02 +03:00
|
|
|
$config['cops_prefered_format'] = array ("EPUB", "PDF", "AZW3", "AZW", "MOBI", "CBR", "CBZ");
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-07-01 15:24:54 +03:00
|
|
|
/*
|
|
|
|
* use URL rewriting for downloading of ebook in HTML catalog
|
2013-03-23 10:43:15 +02:00
|
|
|
* See Github wiki for more information
|
2012-07-01 15:24:54 +03:00
|
|
|
* 1 : enable
|
|
|
|
* 0 : disable
|
|
|
|
*/
|
|
|
|
$config['cops_use_url_rewriting'] = "0";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2012-09-08 16:09:52 +03:00
|
|
|
/*
|
|
|
|
* generate a invalid OPDS stream to allow bad OPDS client to use search
|
2013-09-22 17:00:24 +03:00
|
|
|
* Example of non compliant OPDS client : Moon+ Reader
|
|
|
|
* Example of good OPDS client : Mantano, FBReader
|
2012-09-08 16:09:52 +03:00
|
|
|
* 1 : enable support for non compliant OPDS client
|
|
|
|
* 0 : always generate valid OPDS code
|
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['cops_generate_invalid_opds_stream'] = "0";
|
|
|
|
|
2012-09-18 16:39:22 +03:00
|
|
|
/*
|
|
|
|
* Max number of items per page
|
2012-09-29 15:45:27 +03:00
|
|
|
* -1 unlimited
|
2012-09-18 16:39:22 +03:00
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['cops_max_item_per_page'] = "-1";
|
2012-09-18 16:39:22 +03:00
|
|
|
|
2012-09-29 15:45:27 +03:00
|
|
|
/*
|
|
|
|
* split authors by first letter
|
|
|
|
* 1 : Yes
|
|
|
|
* 0 : No
|
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['cops_author_split_first_letter'] = "1";
|
2013-11-08 18:53:11 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* split titles by first letter
|
|
|
|
* 1 : Yes
|
|
|
|
* 0 : No
|
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['cops_titles_split_first_letter'] = "1";
|
|
|
|
|
2012-12-10 07:06:45 +02:00
|
|
|
/*
|
2013-07-24 15:36:32 +03:00
|
|
|
* Enable the Lightboxes (for popups)
|
2012-12-10 07:06:45 +02:00
|
|
|
* 1 : Yes (enable)
|
|
|
|
* 0 : No
|
|
|
|
*/
|
2013-12-05 11:52:51 +02:00
|
|
|
$config['cops_use_fancyapps'] = "1";
|
|
|
|
|
2013-01-02 22:50:44 +02:00
|
|
|
/*
|
|
|
|
* Update Epub metadata before download
|
|
|
|
* 1 : Yes (enable)
|
|
|
|
* 0 : No
|
|
|
|
*/
|
2013-01-11 16:16:15 +02:00
|
|
|
$config['cops_update_epub-metadata'] = "0";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2013-01-11 16:16:15 +02:00
|
|
|
/*
|
|
|
|
* Filter on tags to book list
|
2013-07-04 00:36:38 +03:00
|
|
|
* Only works with the OPDS catalog
|
2013-12-05 11:52:51 +02:00
|
|
|
* Usage : array ("I only want to see books using the tag : Tag1" => "Tag1",
|
2013-01-25 22:12:05 +02:00
|
|
|
* "I only want to see books not using the tag : Tag1" => "!Tag1",
|
2013-01-27 08:52:56 +02:00
|
|
|
* "I want to see every books" => "",
|
|
|
|
*
|
|
|
|
* Example : array ("All" => "", "Unread" => "!Read", "Read" => "Read")
|
2013-01-11 16:16:15 +02:00
|
|
|
*/
|
2013-01-27 08:52:56 +02:00
|
|
|
$config['cops_books_filter'] = array ();
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2013-01-19 08:08:47 +02:00
|
|
|
/*
|
2013-12-05 11:52:51 +02:00
|
|
|
* Custom Columns to add as an array containing the lookup names
|
2013-01-19 08:08:47 +02:00
|
|
|
* configured in Calibre
|
|
|
|
*
|
2013-12-05 11:52:51 +02:00
|
|
|
* For example : array ("genre", "mycolumn");
|
2013-01-19 08:08:47 +02:00
|
|
|
*
|
|
|
|
* Note that for now only the first, second and forth type of custom columns are supported
|
|
|
|
*/
|
2013-12-02 16:20:00 +02:00
|
|
|
$config['cops_calibre_custom_column'] = array ();
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2013-02-05 22:08:28 +02:00
|
|
|
/*
|
|
|
|
* Rename .epub to .kepub.epub if downloaded from a Kobo eReader
|
|
|
|
* The ebook will then be recognized a Kepub so with chaptered paging, statistics, ...
|
|
|
|
* You have to enable URL rewriting if you want to enable kepup.epub download
|
2013-02-05 22:15:04 +02:00
|
|
|
* 1 : Yes (enable)
|
|
|
|
* 0 : No
|
2013-02-05 22:08:28 +02:00
|
|
|
*/
|
2013-02-05 22:15:04 +02:00
|
|
|
$config['cops_provide_kepub'] = "0";
|
2013-04-17 14:42:23 +03:00
|
|
|
|
2013-12-05 11:52:51 +02:00
|
|
|
/*
|
2013-06-06 10:07:52 +03:00
|
|
|
* Enable and configure Send To Kindle (or Email) feature.
|
|
|
|
*
|
2013-12-05 11:52:51 +02:00
|
|
|
* Don't forget to authorize the sender email you configured in your Kindle's Approved Personal Document E-mail List.
|
2013-06-06 10:07:52 +03:00
|
|
|
*
|
|
|
|
* If you want to use a simple smtp server (provided by your ISP for example), you can configure it like that :
|
|
|
|
* $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.free.fr",
|
|
|
|
* "smtp.username" => "",
|
|
|
|
* "smtp.password" => "",
|
|
|
|
* "smtp.secure" => "",
|
|
|
|
* "address.from" => "cops@slucas.fr"
|
|
|
|
* );
|
|
|
|
*
|
2013-07-24 15:36:32 +03:00
|
|
|
* For Gmail (ssl is mandatory) :
|
2013-06-06 10:07:52 +03:00
|
|
|
* $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.gmail.com",
|
|
|
|
* "smtp.username" => "YOUR GMAIL ADRESS",
|
|
|
|
* "smtp.password" => "YOUR GMAIL PASSWORD",
|
|
|
|
* "smtp.secure" => "ssl",
|
|
|
|
* "address.from" => "cops@slucas.fr"
|
|
|
|
* );
|
|
|
|
*/
|
2013-07-29 08:50:02 +03:00
|
|
|
$config['cops_mail_configuration'] = NULL;
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2013-07-04 00:36:38 +03:00
|
|
|
/*
|
|
|
|
* Use filter in HTML catalog
|
|
|
|
* 1 : Yes (enable)
|
|
|
|
* 0 : No
|
|
|
|
*/
|
2013-07-04 00:37:18 +03:00
|
|
|
$config['cops_html_tag_filter'] = "0";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2013-08-22 16:20:30 +03:00
|
|
|
/*
|
|
|
|
* Thumbnails are generated on-the-fly so it can be problematic on servers with slow CPU (Raspberry Pi, Dockstar, Piratebox, ...).
|
|
|
|
* This configuration item allow to customize how thumbnail will be generated
|
|
|
|
* "" : Generate thumbnail (CPU hungry)
|
|
|
|
* "1" : always send the full size image (Network hungry)
|
2013-08-26 22:15:54 +03:00
|
|
|
* any url : Send a constant image as the thumbnail (you can try "images/bookcover.png")
|
2013-08-22 16:20:30 +03:00
|
|
|
*/
|
2013-08-26 22:15:54 +03:00
|
|
|
$config['cops_thumbnail_handling'] = "";
|
2013-12-05 11:52:51 +02:00
|
|
|
|
2013-08-22 16:20:30 +03:00
|
|
|
/*
|
|
|
|
* Contains a list of user agent for browsers not compatible with client side rendering
|
2013-09-05 16:29:33 +03:00
|
|
|
* For now : Kindle, Sony PRS-T1, Sony PRS-T2, All Cybook devices (maybe a little extreme).
|
2013-08-22 16:20:30 +03:00
|
|
|
* This item is used as regular expression so "." will force server side rendering for all devices
|
|
|
|
*/
|
2013-09-05 16:29:33 +03:00
|
|
|
$config['cops_server_side_render'] = "Kindle|EBRD1101|EBRD1201|cybook";
|
2013-12-08 22:01:17 +02:00
|
|
|
|
|
|
|
/*
|
2013-12-17 21:56:41 +02:00
|
|
|
* Specify the ignored categories for the home screen and with search
|
2013-12-08 22:01:17 +02:00
|
|
|
* Meaning that if you don't want to search in publishers or tags just add them from the list
|
|
|
|
* Only accepted values :
|
|
|
|
* - author
|
|
|
|
* - book
|
|
|
|
* - series
|
|
|
|
* - tag
|
|
|
|
* - publisher
|
2014-03-05 12:15:20 +02:00
|
|
|
* - rating
|
2013-12-17 21:56:41 +02:00
|
|
|
* - language
|
2013-12-08 22:01:17 +02:00
|
|
|
*/
|
2013-12-17 21:56:41 +02:00
|
|
|
$config ['cops_ignored_categories'] = array ();
|
2013-12-10 22:34:19 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If you use a Sony eReader or Aldiko you can't download ebooks if your catalog
|
|
|
|
* is password protected. A simple workaround is to leave fetch.php not protected (see .htaccess).
|
2014-05-03 17:44:01 +03:00
|
|
|
* But In that case your COPS installation is not completely safe.
|
2013-12-10 22:34:19 +02:00
|
|
|
* Setting this parameter to "1" ensure that nobody can access fetch.php before accessing
|
2014-05-03 17:44:01 +03:00
|
|
|
* index.php or feed.php first.
|
2013-12-10 22:34:19 +02:00
|
|
|
* BEWARE : Do not touch this if you're not using password, not using PRS-TX or not using Aldiko.
|
|
|
|
*/
|
|
|
|
$config ['cops_fetch_protect'] = "0";
|
2014-05-03 18:57:06 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Make the search better (don't care about diacritics, uppercase should work on Cyrillic) but slower.
|
|
|
|
* 1 : Yes (enable)
|
|
|
|
* 0 : No
|
|
|
|
*/
|
|
|
|
$config ['cops_normalized_search'] = "0";
|