diff --git a/fever/.htaccess b/fever/.htaccess new file mode 100644 index 0000000..7084940 --- /dev/null +++ b/fever/.htaccess @@ -0,0 +1,13 @@ +RewriteEngine on + +RewriteBase / + +# only if the requested file does not exists +RewriteCond %{REQUEST_FILENAME} !-f + +# Store the current location in an environment variable CWD +RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$ +RewriteRule ^.*$ - [E=CWD:%2] + +# Just by prefixing the environment variable, we can safely rewrite anything now +RewriteRule ^([^/]*) %{ENV:CWD}index.php?database=$1 [QSA,L] \ No newline at end of file diff --git a/fever/index.php b/fever/index.php index cfa56b6..c8da528 100644 --- a/fever/index.php +++ b/fever/index.php @@ -29,6 +29,10 @@ function response(array $response) // Fever authentication function auth() { + if (!empty($_GET['database'])) { + Model\Database\select($_GET['database']); + } + $credentials = Database::get('db')->table('config') ->columns('username', 'fever_token') ->findOne();