Browse Source

Fix default config to reduce the minimum things to change.

Removed Nginx limitations which are not true anymore.
master
Sébastien Lucas 11 years ago
parent
commit
d2d639dcd5
2 changed files with 10 additions and 6 deletions
  1. +3
    -4
      config_default.php
  2. +7
    -2
      fetch.php

+ 3
- 4
config_default.php View File

@@ -12,17 +12,16 @@
/*
* The directory containing calibre's metadata.db file, with sub-directories
* containing all the formats.
* If this directory starts with a / EPUB download will only work with Nginx
* and the calibre_internal_directory has to be set properly
* BEWARE : it has to end with a /
*/
$config['calibre_directory'] = './';
/*
* SPECIFIC TO NGINX
* The internal directory set in nginx config file
* or the same directory as calibre_directory with X-Sendfile
* Leave empty if you don't know what you're doing
*/
$config['calibre_internal_directory'] = '/Calibre/';
$config['calibre_internal_directory'] = '';

/*
* Full URL prefix (with trailing /)


+ 7
- 2
fetch.php View File

@@ -98,13 +98,18 @@
header('Content-Disposition: attachment; filename="' . basename ($file) . '"');
}
$dir = $config['calibre_internal_directory'];
if (empty ($config['calibre_internal_directory'])) {
$dir = $config['calibre_directory'];
}
if (empty ($config['cops_x_accel_redirect'])) {
$filename = $config['calibre_internal_directory'] . $file;
$filename = $dir . $file;
$fp = fopen($filename, 'rb');
header("Content-Length: " . filesize($filename));
fpassthru($fp);
}
else {
header ($config['cops_x_accel_redirect'] . ": " . $config['calibre_internal_directory'] . $file);
header ($config['cops_x_accel_redirect'] . ": " . $dir . $file);
}
?>

Loading…
Cancel
Save