From 36f6cced9f8dcbd81f1e12561178d6b4a35773f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 5 Aug 2015 16:57:05 +0200 Subject: [PATCH 1/5] Add a fix with user based configuration and Apache / PHP FPM. fix #213 --- .htaccess | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.htaccess b/.htaccess index 89f503a..108e46c 100644 --- a/.htaccess +++ b/.htaccess @@ -13,6 +13,13 @@ DirectoryIndex index.php #XSendFile On #XSendFileAllowAbove on +########################################### +# 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 + ########################################### # On WAMP one user had to add this line in his httpd.conf # None of the abose was working From 5fb661f19564f0dbe57967c840438007f88213cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 6 Aug 2015 09:06:50 +0200 Subject: [PATCH 2/5] Changed the dutch translation to be more like Calibre's own dutch translation. thanks to FPCUser --- lang/Localization_nl.json | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lang/Localization_nl.json b/lang/Localization_nl.json index 011949c..7f78b24 100644 --- a/lang/Localization_nl.json +++ b/lang/Localization_nl.json @@ -17,12 +17,12 @@ "bookword.one":"1 boek", "bookword.title":"Boeken", "cog.alternate":"Zoeken, sorteren en filters", -"content.series":"Series:", -"content.series.data":"Boek {0} in de {1} serie", +"content.series":"Reeksen:", +"content.series.data":"Boek {0} in de {1} reeks", "content.summary":"Samenvatting", "customize.email":"E-mailadres ontvanger (om boeken te versturen per elektronische post)", "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.paging":"Maximaal aantal boeken per pagina (-1 voor oneindig aantal)", "customize.style":"Opmaak COPS gebruikersomgeving", @@ -62,28 +62,28 @@ "search.result.author":"Zoekresultaat voor *{0}* in auteurs", "search.result.book":"Zoekresultaat voor *{0}* in boeken", "search.result.publisher":"Zoekresultaat voor *{0}* in uitgevers", -"search.result.series":"Zoekresultaat voor *{0}* in series", -"search.result.tag":"Zoekresultaat voor *{0}* in tags", +"search.result.series":"Zoekresultaat voor *{0}* in reeksen", +"search.result.tag":"Zoekresultaat voor *{0}* in labels", "search.sortorder.asc":"A-Z", "search.sortorder.desc":"Z-A", -"series.alphabetical.many":"Alfabetische index van {0} series", -"series.alphabetical.none":"Alfabetische index van absoluut geen enkele serie", -"series.alphabetical.one":"Alfabetische index van 1 serie", -"series.title":"Series", -"seriesword.many":"{0} series", -"seriesword.none":"Geen series", -"seriesword.one":"1 serie", +"series.alphabetical.many":"Alfabetische index van {0} reeksen", +"series.alphabetical.none":"Alfabetische index van absoluut geen enkele reeks", +"series.alphabetical.one":"Alfabetische index van 1 reeks", +"series.title":"Reeksen", +"seriesword.many":"{0} reeksen", +"seriesword.none":"Geen reeks", +"seriesword.one":"1 reeks", "sort.alternate":"Sorteren", "splitByLetter.book.other":"Andere boeken", "splitByLetter.letter":"{0} beginnend met {1}", -"tags.alphabetical.many":"Alfabetische index van {0} tags", -"tags.alphabetical.none":"Alfabetische index van absoluut geen enkele tag", -"tags.alphabetical.one":"Alfabetische index van 1 tag", -"tags.title":"Tags", -"tagword.many":"{0} tags", -"tagword.none":"Geen tag", -"tagword.one":"1 tag", -"tagword.title":"Tags", +"tags.alphabetical.many":"Alfabetische index van {0} labels", +"tags.alphabetical.none":"Alfabetische index van absoluut geen enkele label", +"tags.alphabetical.one":"Alfabetische index van 1 label", +"tags.title":"Labels", +"tagword.many":"{0} labels", +"tagword.none":"Geen label", +"tagword.one":"1 label", +"tagword.title":"Labels", "languages.abk":"Abchazisch", "languages.aaf":"Afar", "languages.afr":"Afrikaans", From 933292553d98d9ab746da989fd18f2e0c61e2842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 14 Oct 2015 17:46:59 +0200 Subject: [PATCH 3/5] Add a check for a altered database id in the query. Fixes the problem reported in the issue but there may be a lot more to do. fix #216 --- base.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/base.php b/base.php index 0816fce..8d9aa06 100644 --- a/base.php +++ b/base.php @@ -1264,6 +1264,9 @@ abstract class Base global $config; if (self::isMultipleDatabaseEnabled ()) { 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']); return $array[$database]; } @@ -1274,6 +1277,9 @@ abstract class Base global $config; if (self::isMultipleDatabaseEnabled ()) { 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']); return $array[$database]; } @@ -1285,11 +1291,11 @@ abstract class Base return self::getDbDirectory ($database) .'metadata.db'; } - private static function error () { + private static function error ($database) { if (php_sapi_name() != "cli") { 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) { @@ -1301,10 +1307,10 @@ abstract class Base self::$db->sqliteCreateFunction ('normAndUp', 'normAndUp', 1); } } else { - self::error (); + self::error ($database); } } catch (Exception $e) { - self::error (); + self::error ($database); } } return self::$db; From eac1837e5e4b4e9839fe8777f214fb60d92ae634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 14 Oct 2015 17:53:59 +0200 Subject: [PATCH 4/5] Add some information about non debian based linux flavour. fix #218 --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index c8f2504..da7314d 100644 --- a/README +++ b/README @@ -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 : aptitude install php5-gd php5-sqlite php5-json +On Centos you may have to add : + yum install php-xml + = Install = 1. Extract the zip file to a folder in web space (visible to the web server). From 058fb303b326e6d404250b523e5a23c574754c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 14 Oct 2015 17:54:26 +0200 Subject: [PATCH 5/5] Reorder the .htaccess to make it more consistant --- .htaccess | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.htaccess b/.htaccess index 108e46c..9a18ad1 100644 --- a/.htaccess +++ b/.htaccess @@ -13,6 +13,12 @@ DirectoryIndex index.php #XSendFile On #XSendFileAllowAbove on +########################################### +# On WAMP one user had to add this line in his httpd.conf +# None of the above was working +########################################### +#XSendFilePath + ########################################### # If you want to use user based configuration with # apache 2.4 + php-fpm enable this @@ -20,12 +26,6 @@ DirectoryIndex index.php ########################################### #SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 -########################################### -# On WAMP one user had to add this line in his httpd.conf -# None of the abose was working -########################################### -#XSendFilePath - RewriteEngine on RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L]