Merge branch 'master' of github.com:seblucas/cops

This commit is contained in:
George Litos 2015-10-29 19:46:06 +02:00
commit 62a7034ab8
4 changed files with 41 additions and 25 deletions

View file

@ -15,10 +15,17 @@ DirectoryIndex index.php
########################################### ###########################################
# On WAMP one user had to add this line in his httpd.conf # On WAMP one user had to add this line in his httpd.conf
# None of the abose was working # None of the above was working
########################################### ###########################################
#XSendFilePath <YourCalibrePath> #XSendFilePath <YourCalibrePath>
###########################################
# If you want to use user based configuration with
# apache 2.4 + php-fpm enable this
# https://github.com/seblucas/cops/issues/213
###########################################
#SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine on RewriteEngine on
RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L] RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L]

3
README
View file

@ -39,6 +39,9 @@ If you want to use the OPDS feed don't forget to specify feed.php at the end of
On any Debian base Linux you can use : On any Debian base Linux you can use :
aptitude install php5-gd php5-sqlite php5-json aptitude install php5-gd php5-sqlite php5-json
On Centos you may have to add :
yum install php-xml
= Install = = Install =
1. Extract the zip file to a folder in web space (visible to the web server). 1. Extract the zip file to a folder in web space (visible to the web server).

View file

@ -1201,6 +1201,9 @@ abstract class Base
global $config; global $config;
if (self::isMultipleDatabaseEnabled ()) { if (self::isMultipleDatabaseEnabled ()) {
if (is_null ($database)) $database = GetUrlParam (DB, 0); if (is_null ($database)) $database = GetUrlParam (DB, 0);
if (!is_null($database) && !preg_match('/^\d+$/', $database)) {
return self::error ($database);
}
$array = array_keys ($config['calibre_directory']); $array = array_keys ($config['calibre_directory']);
return $array[$database]; return $array[$database];
} }
@ -1211,6 +1214,9 @@ abstract class Base
global $config; global $config;
if (self::isMultipleDatabaseEnabled ()) { if (self::isMultipleDatabaseEnabled ()) {
if (is_null ($database)) $database = GetUrlParam (DB, 0); if (is_null ($database)) $database = GetUrlParam (DB, 0);
if (!is_null($database) && !preg_match('/^\d+$/', $database)) {
return self::error ($database);
}
$array = array_values ($config['calibre_directory']); $array = array_values ($config['calibre_directory']);
return $array[$database]; return $array[$database];
} }
@ -1222,11 +1228,11 @@ abstract class Base
return self::getDbDirectory ($database) .'metadata.db'; return self::getDbDirectory ($database) .'metadata.db';
} }
private static function error () { private static function error ($database) {
if (php_sapi_name() != "cli") { if (php_sapi_name() != "cli") {
header("location: checkconfig.php?err=1"); header("location: checkconfig.php?err=1");
} }
throw new Exception('Database not found.'); throw new Exception("Database <{$database}> not found.");
} }
public static function getDb ($database = NULL) { public static function getDb ($database = NULL) {
@ -1238,10 +1244,10 @@ abstract class Base
self::$db->sqliteCreateFunction ('normAndUp', 'normAndUp', 1); self::$db->sqliteCreateFunction ('normAndUp', 'normAndUp', 1);
} }
} else { } else {
self::error (); self::error ($database);
} }
} catch (Exception $e) { } catch (Exception $e) {
self::error (); self::error ($database);
} }
} }
return self::$db; return self::$db;

View file

@ -17,12 +17,12 @@
"bookword.one":"1 boek", "bookword.one":"1 boek",
"bookword.title":"Boeken", "bookword.title":"Boeken",
"cog.alternate":"Zoeken, sorteren en filters", "cog.alternate":"Zoeken, sorteren en filters",
"content.series":"Series:", "content.series":"Reeksen:",
"content.series.data":"Boek {0} in de {1} serie", "content.series.data":"Boek {0} in de {1} reeks",
"content.summary":"Samenvatting", "content.summary":"Samenvatting",
"customize.email":"E-mailadres ontvanger (om boeken te versturen per elektronische post)", "customize.email":"E-mailadres ontvanger (om boeken te versturen per elektronische post)",
"customize.fancybox":"Gebruik een Lightbox", "customize.fancybox":"Gebruik een Lightbox",
"customize.filter":"Zet filteren op tag aan", "customize.filter":"Zet filteren op label aan",
"customize.ignored":"Niet opgenomen categorieën", "customize.ignored":"Niet opgenomen categorieën",
"customize.paging":"Maximaal aantal boeken per pagina (-1 voor oneindig aantal)", "customize.paging":"Maximaal aantal boeken per pagina (-1 voor oneindig aantal)",
"customize.style":"Opmaak COPS gebruikersomgeving", "customize.style":"Opmaak COPS gebruikersomgeving",
@ -62,28 +62,28 @@
"search.result.author":"Zoekresultaat voor *{0}* in auteurs", "search.result.author":"Zoekresultaat voor *{0}* in auteurs",
"search.result.book":"Zoekresultaat voor *{0}* in boeken", "search.result.book":"Zoekresultaat voor *{0}* in boeken",
"search.result.publisher":"Zoekresultaat voor *{0}* in uitgevers", "search.result.publisher":"Zoekresultaat voor *{0}* in uitgevers",
"search.result.series":"Zoekresultaat voor *{0}* in series", "search.result.series":"Zoekresultaat voor *{0}* in reeksen",
"search.result.tag":"Zoekresultaat voor *{0}* in tags", "search.result.tag":"Zoekresultaat voor *{0}* in labels",
"search.sortorder.asc":"A-Z", "search.sortorder.asc":"A-Z",
"search.sortorder.desc":"Z-A", "search.sortorder.desc":"Z-A",
"series.alphabetical.many":"Alfabetische index van {0} series", "series.alphabetical.many":"Alfabetische index van {0} reeksen",
"series.alphabetical.none":"Alfabetische index van absoluut geen enkele serie", "series.alphabetical.none":"Alfabetische index van absoluut geen enkele reeks",
"series.alphabetical.one":"Alfabetische index van 1 serie", "series.alphabetical.one":"Alfabetische index van 1 reeks",
"series.title":"Series", "series.title":"Reeksen",
"seriesword.many":"{0} series", "seriesword.many":"{0} reeksen",
"seriesword.none":"Geen series", "seriesword.none":"Geen reeks",
"seriesword.one":"1 serie", "seriesword.one":"1 reeks",
"sort.alternate":"Sorteren", "sort.alternate":"Sorteren",
"splitByLetter.book.other":"Andere boeken", "splitByLetter.book.other":"Andere boeken",
"splitByLetter.letter":"{0} beginnend met {1}", "splitByLetter.letter":"{0} beginnend met {1}",
"tags.alphabetical.many":"Alfabetische index van {0} tags", "tags.alphabetical.many":"Alfabetische index van {0} labels",
"tags.alphabetical.none":"Alfabetische index van absoluut geen enkele tag", "tags.alphabetical.none":"Alfabetische index van absoluut geen enkele label",
"tags.alphabetical.one":"Alfabetische index van 1 tag", "tags.alphabetical.one":"Alfabetische index van 1 label",
"tags.title":"Tags", "tags.title":"Labels",
"tagword.many":"{0} tags", "tagword.many":"{0} labels",
"tagword.none":"Geen tag", "tagword.none":"Geen label",
"tagword.one":"1 tag", "tagword.one":"1 label",
"tagword.title":"Tags", "tagword.title":"Labels",
"languages.abk":"Abchazisch", "languages.abk":"Abchazisch",
"languages.aaf":"Afar", "languages.aaf":"Afar",
"languages.afr":"Afrikaans", "languages.afr":"Afrikaans",