diff --git a/.htaccess b/.htaccess index 0603a65..d124065 100644 --- a/.htaccess +++ b/.htaccess @@ -19,8 +19,10 @@ RewriteEngine on -RewriteRule ^download/(.*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L] -RewriteRule ^download/(.*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L] +RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L] +RewriteRule ^download/(\d*)/(\d*)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3 [L] +RewriteRule ^download/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L] +RewriteRule ^download/(\d*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L] ########################################### diff --git a/data.php b/data.php index eb2e41b..0430bd8 100644 --- a/data.php +++ b/data.php @@ -95,10 +95,12 @@ class Data extends Base { if ($config['cops_use_url_rewriting'] == "1") { + $database = ""; + if (!is_null (GetUrlParam (DB))) $database = GetUrlParam (DB) . "/"; if ($config['cops_provide_kepub'] == "1" && preg_match("/Kobo/", $_SERVER['HTTP_USER_AGENT'])) { - return "download/" . $this->id . "/" . urlencode ($this->getUpdatedFilenameKepub ()); + return "download/" . $this->id . "/" . $database . urlencode ($this->getUpdatedFilenameKepub ()); } else { - return "download/" . $this->id . "/" . urlencode ($this->getFilename ()); + return "download/" . $this->id . "/" . $database . urlencode ($this->getFilename ()); } } else