From 56a3c1200b27376f209a64f79c954a07bbe86286 Mon Sep 17 00:00:00 2001 From: Jan Grewe <jan@faked.org> Date: Wed, 19 Mar 2014 22:42:58 +0100 Subject: [PATCH] fix check for query strings add .htaccess for Apache --- .htaccess | 4 ++++ index.php | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..738c31f --- /dev/null +++ b/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine on +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^(.*)$ index.php [QSA,L] diff --git a/index.php b/index.php index 91ef4fa..c46329b 100644 --- a/index.php +++ b/index.php @@ -652,6 +652,7 @@ $origin_domain = strtolower( $exploded[1] ); $origin_domain_exception = array_key_exists( $origin_domain, $origin_domain_exceptions ) ? $origin_domain_exceptions[$origin_domain] : 0; $scheme = 'http' . ( array_key_exists( 'ssl', $_GET ) ? 's' : '' ) . '://'; + parse_str( ( empty( $parsed['query'] ) ? '' : $parsed['query'] ), $_GET ); $ext = strtolower( pathinfo( $parsed['path'], PATHINFO_EXTENSION ) ); @@ -663,10 +664,10 @@ $url = $scheme . substr( $parsed['path'], 1 ); $url = preg_replace( '/#.*$/', '', $url ); $url = apply_filters( 'url', $url ); -if ( isset( $_GET['q'] ) ) { +if ( isset( $parsed['query'] ) ) { if ( $origin_domain_exception & PHOTON__ALLOW_QUERY_STRINGS ) { - $url .= '?' . preg_replace( '/#.*$/', '', (string) $_GET['q'] ); - unset( $_GET['q'] ); + $url .= '?' . preg_replace( '/#.*$/', '', (string) $parsed['query'] ); + unset( $parsed['query'] ); } else { httpdie( '400 Bad Request', "Sorry, the parameters you provided were not valid" ); } -- GitLab