summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/file_proxy.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers/file_proxy.php')
-rw-r--r--modules/gallery/controllers/file_proxy.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php
index 22854fbd..98f4e839 100644
--- a/modules/gallery/controllers/file_proxy.php
+++ b/modules/gallery/controllers/file_proxy.php
@@ -27,10 +27,13 @@
* input is sanitized against the database before we perform any file I/O.
*/
class File_Proxy_Controller extends Controller {
+ const ALLOW_PRIVATE_GALLERY = true;
public function __call($function, $args) {
- // request_uri: gallery3/var/trunk/albums/foo/bar.jpg
+ // request_uri: gallery3/var/albums/foo/bar.jpg?m=1234
$request_uri = rawurldecode(Input::instance()->server("REQUEST_URI"));
+ // get rid of query parameters
+ // request_uri: gallery3/var/albums/foo/bar.jpg
$request_uri = preg_replace("/\?.*/", "", $request_uri);
// var_uri: gallery3/var/
@@ -42,13 +45,11 @@ class File_Proxy_Controller extends Controller {
throw new Kohana_404_Exception();
}
+ // file_uri: albums/foo/bar.jpg
$file_uri = substr($request_uri, strlen($var_uri));
- // Make sure that we don't leave the var dir
- if (strpos($file_uri, "..") !== false) {
- throw new Kohana_404_Exception();
- }
-
+ // type: albums
+ // path: foo/bar.jpg
list ($type, $path) = explode("/", $file_uri, 2);
if ($type != "resizes" && $type != "albums" && $type != "thumbs") {
throw new Kohana_404_Exception();