Add a config option to not use URL rewriting by default
Also fix a bug preventing download
This commit is contained in:
parent
93f1f72a65
commit
fe55e86def
|
@ -80,4 +80,12 @@
|
||||||
* The other only appear in book detail
|
* The other only appear in book detail
|
||||||
*/
|
*/
|
||||||
$config['cops_prefered_format'] = array ("EPUB", "PDF", "MOBI", "CBR", "CBZ");
|
$config['cops_prefered_format'] = array ("EPUB", "PDF", "MOBI", "CBR", "CBZ");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* use URL rewriting for downloading of ebook in HTML catalog
|
||||||
|
* See README for more information
|
||||||
|
* 1 : enable
|
||||||
|
* 0 : disable
|
||||||
|
*/
|
||||||
|
$config['cops_use_url_rewriting'] = "0";
|
||||||
?>
|
?>
|
11
data.php
11
data.php
|
@ -70,7 +70,16 @@ class Data extends Base {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHtmlLink () {
|
public function getHtmlLink () {
|
||||||
return "download/" . $this->id . "/" . urlencode ($this->getFilename ());
|
global $config;
|
||||||
|
|
||||||
|
if ($config['cops_use_url_rewriting'] == "1")
|
||||||
|
{
|
||||||
|
return "download/" . $this->id . "/" . urlencode ($this->getFilename ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return str_replace ("&", "&", "fetch.php?id=" . $this->book->id . "&data=" . $this->id . "&type=" . $this->extension);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL)
|
public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
require_once ("config.php");
|
require_once ("config.php");
|
||||||
require_once ("book.php");
|
require_once ("book.php");
|
||||||
|
require_once ("data.php");
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
$expires = 60*60*24*14;
|
$expires = 60*60*24*14;
|
||||||
|
@ -82,7 +83,7 @@
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
header("Content-type: " . Book::$mimetypes[$type]);
|
header("Content-type: " . Data::$mimetypes[$type]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$file = $book->getFilePath ($type, $idData, true);
|
$file = $book->getFilePath ($type, $idData, true);
|
||||||
|
|
Loading…
Reference in a new issue