Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config_default.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
*/
$config['cops_prefered_format'] = array('EPUB', 'PDF', 'AZW3', 'AZW', 'MOBI', 'CBR', 'CBZ');

/*
* Specify the ignored formats that will never display in COPS
*/
$config['cops_ignored_formats'] = array();

/*
* use URL rewriting for downloading of ebook in HTML catalog
* See Github wiki for more information
Expand Down
15 changes: 13 additions & 2 deletions lib/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,20 @@ public function getHtmlLinkWithRewriting ($title = NULL, $view = false) {
}

public static function getDataByBook ($book) {
global $config;

$out = array ();
$result = parent::getDb ()->prepare('select id, format, name
from data where book = ?');

$sql = 'select id, format, name from data where book = ?';

$ignored_formats = $config['cops_ignored_formats'];
if (count($ignored_formats) > 0) {
$sql .= " and format not in ('"
. implode("','", $ignored_formats)
. "')";
}

$result = parent::getDb ()->prepare($sql);
$result->execute (array ($book->id));

while ($post = $result->fetchObject ())
Expand Down